fix: < 26 item ids

This commit is contained in:
Alexander Medvedev 2026-04-06 17:52:31 +02:00
parent 82ce8e9633
commit eb8931f5f3
6 changed files with 1189 additions and 997 deletions

View File

@ -58,7 +58,11 @@ pub fn build() -> TokenStream {
value: "../assets/viaversion/data/mappings-1.21.9to1.21.11.nbt", value: "../assets/viaversion/data/mappings-1.21.9to1.21.11.nbt",
child: Some(&node_1_21_7), child: Some(&node_1_21_7),
}; };
let node_1_21_11 = MappingNode {
version: MinecraftVersion::V_1_21_11,
value: "../assets/viaversion/data/mappings-1.21.11to26.1.nbt",
child: Some(&node_1_21_9),
};
let remapper: Remapper<_, Option<Vec<u16>>> = Remapper { let remapper: Remapper<_, Option<Vec<u16>>> = Remapper {
version: MinecraftVersion::V_26_1, version: MinecraftVersion::V_26_1,
remapper: |first, second| match (first, second) { remapper: |first, second| match (first, second) {
@ -82,7 +86,7 @@ pub fn build() -> TokenStream {
}, },
}; };
let all_mappings = remapper.process(&node_1_21_9); let all_mappings = remapper.process(&node_1_21_11);
let mapping_size = all_mappings let mapping_size = all_mappings
.iter() .iter()
.map(|(_, mapping)| mapping.as_ref().map(|x| x.len()).unwrap_or(0)) .map(|(_, mapping)| mapping.as_ref().map(|x| x.len()).unwrap_or(0))

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
use crate::generation::proto_chunk::GenerationCache; use crate::generation::proto_chunk::GenerationCache;
use pumpkin_data::BlockDirection; use pumpkin_data::{BlockDirection, tag};
use pumpkin_util::{ use pumpkin_util::{
math::position::BlockPos, math::position::BlockPos,
random::{RandomGenerator, RandomImpl}, random::{RandomGenerator, RandomImpl},
@ -20,7 +20,7 @@ impl CoralClawFeature {
pos: BlockPos, pos: BlockPos,
) -> bool { ) -> bool {
// First lets get a random coral // First lets get a random coral
let block = CoralFeature::get_random_tag_entry("minecraft:coral_blocks", random); let block = CoralFeature::get_random_tag_entry(tag::Block::MINECRAFT_CORAL_BLOCKS, random);
if !CoralFeature::generate_coral_piece(chunk, random, block, pos) { if !CoralFeature::generate_coral_piece(chunk, random, block, pos) {
return false; return false;
} }

View File

@ -1,4 +1,5 @@
use crate::generation::proto_chunk::GenerationCache; use crate::generation::proto_chunk::GenerationCache;
use pumpkin_data::tag;
use pumpkin_util::{ use pumpkin_util::{
math::{position::BlockPos, vector3::Vector3}, math::{position::BlockPos, vector3::Vector3},
random::{RandomGenerator, RandomImpl}, random::{RandomGenerator, RandomImpl},
@ -19,7 +20,7 @@ impl CoralMushroomFeature {
pos: BlockPos, pos: BlockPos,
) -> bool { ) -> bool {
// First lets get a random coral // First lets get a random coral
let block = CoralFeature::get_random_tag_entry("minecraft:coral_blocks", random); let block = CoralFeature::get_random_tag_entry(tag::Block::MINECRAFT_CORAL_BLOCKS, random);
let i = random.next_bounded_i32(3) + 3; let i = random.next_bounded_i32(3) + 3;
let j = random.next_bounded_i32(3) + 3; let j = random.next_bounded_i32(3) + 3;

View File

@ -1,5 +1,5 @@
use crate::generation::proto_chunk::GenerationCache; use crate::generation::proto_chunk::GenerationCache;
use pumpkin_data::BlockDirection; use pumpkin_data::{BlockDirection, tag};
use pumpkin_util::{ use pumpkin_util::{
math::position::BlockPos, math::position::BlockPos,
random::{RandomGenerator, RandomImpl}, random::{RandomGenerator, RandomImpl},
@ -20,7 +20,7 @@ impl CoralTreeFeature {
pos: BlockPos, pos: BlockPos,
) -> bool { ) -> bool {
// First lets get a random coral // First lets get a random coral
let block = CoralFeature::get_random_tag_entry("minecraft:coral_blocks", random); let block = CoralFeature::get_random_tag_entry(tag::Block::MINECRAFT_CORAL_BLOCKS, random);
let mut pos = pos; let mut pos = pos;
let i = random.next_bounded_i32(3) + 1; let i = random.next_bounded_i32(3) + 1;
for _ in 0..i { for _ in 0..i {

View File

@ -2,7 +2,7 @@ use crate::generation::proto_chunk::GenerationCache;
use pumpkin_data::{ use pumpkin_data::{
Block, BlockDirection, BlockState, Block, BlockDirection, BlockState,
block_properties::{BlockProperties, EnumVariants, Integer1To4, SeaPickleLikeProperties}, block_properties::{BlockProperties, EnumVariants, Integer1To4, SeaPickleLikeProperties},
tag::{self, RegistryKey, get_tag_ids}, tag,
}; };
use pumpkin_util::{ use pumpkin_util::{
math::position::BlockPos, math::position::BlockPos,
@ -34,7 +34,7 @@ impl CoralFeature {
if random.next_f32() < 0.25 { if random.next_f32() < 0.25 {
chunk.set_block_state( chunk.set_block_state(
&pos.0, &pos.0,
Self::get_random_tag_entry("minecraft:corals", random), Self::get_random_tag_entry(tag::Block::MINECRAFT_CORALS, random),
); );
} else if random.next_f32() < 0.05 { } else if random.next_f32() < 0.05 {
let mut props = SeaPickleLikeProperties::default(&Block::SEA_PICKLE); let mut props = SeaPickleLikeProperties::default(&Block::SEA_PICKLE);
@ -51,7 +51,8 @@ impl CoralFeature {
{ {
continue; continue;
} }
let wall_coral = Self::get_random_tag_entry_block("minecraft:wall_corals", random); let wall_coral =
Self::get_random_tag_entry_block(tag::Block::MINECRAFT_WALL_CORALS, random);
let original_props = &wall_coral let original_props = &wall_coral
.properties(wall_coral.default_state.id) .properties(wall_coral.default_state.id)
.unwrap() .unwrap()
@ -77,13 +78,19 @@ impl CoralFeature {
true true
} }
pub fn get_random_tag_entry(tag: &str, random: &mut RandomGenerator) -> &'static BlockState { pub fn get_random_tag_entry(
tag: tag::Tag,
random: &mut RandomGenerator,
) -> &'static BlockState {
let block = Self::get_random_tag_entry_block(tag, random); let block = Self::get_random_tag_entry_block(tag, random);
block.default_state block.default_state
} }
pub fn get_random_tag_entry_block(tag: &str, random: &mut RandomGenerator) -> &'static Block { pub fn get_random_tag_entry_block(
let values = get_tag_ids(RegistryKey::Block, tag).unwrap(); tag: tag::Tag,
random: &mut RandomGenerator,
) -> &'static Block {
let values = tag.1;
let value = values[random.next_bounded_i32(values.len() as i32) as usize]; let value = values[random.next_bounded_i32(values.len() as i32) as usize];
Block::from_id(value) Block::from_id(value)
} }