mirror of
https://github.com/Pumpkin-MC/Pumpkin.git
synced 2026-08-30 20:14:23 +00:00
pumpkun-data: Add fuels (#1005)
This commit is contained in:
271
assets/fuels.json
Normal file
271
assets/fuels.json
Normal file
@@ -0,0 +1,271 @@
|
||||
{
|
||||
"969": 20000,
|
||||
"83": 16000,
|
||||
"1071": 2400,
|
||||
"860": 1600,
|
||||
"861": 1600,
|
||||
"141": 300,
|
||||
"178": 300,
|
||||
"154": 300,
|
||||
"165": 300,
|
||||
"140": 300,
|
||||
"177": 300,
|
||||
"155": 300,
|
||||
"166": 300,
|
||||
"134": 300,
|
||||
"171": 300,
|
||||
"148": 300,
|
||||
"159": 300,
|
||||
"138": 300,
|
||||
"175": 300,
|
||||
"152": 300,
|
||||
"163": 300,
|
||||
"136": 300,
|
||||
"173": 300,
|
||||
"150": 300,
|
||||
"161": 300,
|
||||
"137": 300,
|
||||
"174": 300,
|
||||
"151": 300,
|
||||
"162": 300,
|
||||
"135": 300,
|
||||
"172": 300,
|
||||
"149": 300,
|
||||
"160": 300,
|
||||
"142": 300,
|
||||
"179": 300,
|
||||
"156": 300,
|
||||
"167": 300,
|
||||
"139": 300,
|
||||
"176": 300,
|
||||
"153": 300,
|
||||
"164": 300,
|
||||
"147": 300,
|
||||
"170": 300,
|
||||
"36": 300,
|
||||
"37": 300,
|
||||
"38": 300,
|
||||
"39": 300,
|
||||
"40": 300,
|
||||
"42": 300,
|
||||
"43": 300,
|
||||
"44": 300,
|
||||
"45": 300,
|
||||
"41": 300,
|
||||
"48": 300,
|
||||
"412": 300,
|
||||
"413": 300,
|
||||
"414": 300,
|
||||
"415": 300,
|
||||
"416": 300,
|
||||
"418": 300,
|
||||
"419": 300,
|
||||
"420": 300,
|
||||
"421": 300,
|
||||
"417": 300,
|
||||
"422": 300,
|
||||
"270": 150,
|
||||
"271": 150,
|
||||
"272": 150,
|
||||
"273": 150,
|
||||
"274": 150,
|
||||
"276": 150,
|
||||
"277": 150,
|
||||
"278": 150,
|
||||
"279": 150,
|
||||
"275": 150,
|
||||
"280": 150,
|
||||
"769": 300,
|
||||
"767": 300,
|
||||
"771": 300,
|
||||
"772": 300,
|
||||
"768": 300,
|
||||
"765": 300,
|
||||
"766": 300,
|
||||
"773": 300,
|
||||
"774": 300,
|
||||
"770": 300,
|
||||
"731": 300,
|
||||
"732": 300,
|
||||
"733": 300,
|
||||
"734": 300,
|
||||
"735": 300,
|
||||
"737": 300,
|
||||
"738": 300,
|
||||
"739": 300,
|
||||
"740": 300,
|
||||
"736": 300,
|
||||
"332": 300,
|
||||
"336": 300,
|
||||
"338": 300,
|
||||
"339": 300,
|
||||
"333": 300,
|
||||
"334": 300,
|
||||
"335": 300,
|
||||
"340": 300,
|
||||
"341": 300,
|
||||
"337": 300,
|
||||
"789": 300,
|
||||
"787": 300,
|
||||
"791": 300,
|
||||
"792": 300,
|
||||
"788": 300,
|
||||
"785": 300,
|
||||
"786": 300,
|
||||
"793": 300,
|
||||
"794": 300,
|
||||
"790": 300,
|
||||
"712": 300,
|
||||
"305": 300,
|
||||
"306": 300,
|
||||
"701": 300,
|
||||
"331": 300,
|
||||
"319": 300,
|
||||
"709": 300,
|
||||
"320": 300,
|
||||
"705": 300,
|
||||
"1214": 300,
|
||||
"1215": 300,
|
||||
"1216": 300,
|
||||
"1217": 300,
|
||||
"1218": 300,
|
||||
"1219": 300,
|
||||
"1220": 300,
|
||||
"1221": 300,
|
||||
"1222": 300,
|
||||
"1223": 300,
|
||||
"1224": 300,
|
||||
"1225": 300,
|
||||
"1226": 300,
|
||||
"1227": 300,
|
||||
"1228": 300,
|
||||
"1229": 300,
|
||||
"858": 300,
|
||||
"1008": 300,
|
||||
"323": 300,
|
||||
"943": 200,
|
||||
"944": 200,
|
||||
"945": 200,
|
||||
"947": 200,
|
||||
"946": 200,
|
||||
"949": 200,
|
||||
"950": 200,
|
||||
"951": 200,
|
||||
"952": 200,
|
||||
"948": 200,
|
||||
"955": 800,
|
||||
"956": 800,
|
||||
"957": 800,
|
||||
"959": 800,
|
||||
"960": 800,
|
||||
"958": 800,
|
||||
"961": 800,
|
||||
"962": 800,
|
||||
"963": 800,
|
||||
"964": 800,
|
||||
"876": 200,
|
||||
"875": 200,
|
||||
"879": 200,
|
||||
"878": 200,
|
||||
"877": 200,
|
||||
"744": 200,
|
||||
"745": 200,
|
||||
"746": 200,
|
||||
"747": 200,
|
||||
"748": 200,
|
||||
"750": 200,
|
||||
"751": 200,
|
||||
"752": 200,
|
||||
"753": 200,
|
||||
"749": 200,
|
||||
"827": 1200,
|
||||
"829": 1200,
|
||||
"831": 1200,
|
||||
"833": 1200,
|
||||
"835": 1200,
|
||||
"839": 1200,
|
||||
"841": 1200,
|
||||
"843": 1200,
|
||||
"845": 1200,
|
||||
"837": 1200,
|
||||
"828": 1200,
|
||||
"830": 1200,
|
||||
"832": 1200,
|
||||
"834": 1200,
|
||||
"836": 1200,
|
||||
"840": 1200,
|
||||
"842": 1200,
|
||||
"844": 1200,
|
||||
"846": 1200,
|
||||
"838": 1200,
|
||||
"213": 100,
|
||||
"214": 100,
|
||||
"215": 100,
|
||||
"216": 100,
|
||||
"217": 100,
|
||||
"218": 100,
|
||||
"219": 100,
|
||||
"220": 100,
|
||||
"221": 100,
|
||||
"222": 100,
|
||||
"223": 100,
|
||||
"224": 100,
|
||||
"225": 100,
|
||||
"226": 100,
|
||||
"227": 100,
|
||||
"228": 100,
|
||||
"715": 100,
|
||||
"716": 100,
|
||||
"717": 100,
|
||||
"718": 100,
|
||||
"719": 100,
|
||||
"721": 100,
|
||||
"722": 100,
|
||||
"723": 100,
|
||||
"724": 100,
|
||||
"720": 100,
|
||||
"905": 100,
|
||||
"49": 100,
|
||||
"50": 100,
|
||||
"51": 100,
|
||||
"52": 100,
|
||||
"53": 100,
|
||||
"55": 100,
|
||||
"56": 100,
|
||||
"205": 100,
|
||||
"206": 100,
|
||||
"57": 100,
|
||||
"54": 100,
|
||||
"856": 100,
|
||||
"476": 67,
|
||||
"477": 67,
|
||||
"478": 67,
|
||||
"479": 67,
|
||||
"480": 67,
|
||||
"481": 67,
|
||||
"482": 67,
|
||||
"483": 67,
|
||||
"484": 67,
|
||||
"485": 67,
|
||||
"486": 67,
|
||||
"487": 67,
|
||||
"488": 67,
|
||||
"489": 67,
|
||||
"490": 67,
|
||||
"491": 67,
|
||||
"982": 4001,
|
||||
"1274": 300,
|
||||
"269": 50,
|
||||
"207": 100,
|
||||
"209": 100,
|
||||
"210": 100,
|
||||
"687": 50,
|
||||
"1276": 300,
|
||||
"1289": 300,
|
||||
"1292": 300,
|
||||
"1293": 300,
|
||||
"1295": 300,
|
||||
"1288": 300,
|
||||
"143": 300,
|
||||
"260": 100
|
||||
}
|
||||
@@ -14,6 +14,7 @@ mod entity_status;
|
||||
mod entity_type;
|
||||
mod flower_pot_transformations;
|
||||
mod fluid;
|
||||
mod fuels;
|
||||
mod game_event;
|
||||
mod game_rules;
|
||||
mod item;
|
||||
@@ -74,6 +75,7 @@ pub fn main() {
|
||||
);
|
||||
write_generated_file(recipes::build(), "recipes.rs");
|
||||
write_generated_file(enchantments::build(), "enchantment.rs");
|
||||
write_generated_file(fuels::build(), "fuels.rs");
|
||||
}
|
||||
|
||||
pub fn array_to_tokenstream(array: &[String]) -> TokenStream {
|
||||
|
||||
48
pumpkin-data/build/fuels.rs
Normal file
48
pumpkin-data/build/fuels.rs
Normal file
@@ -0,0 +1,48 @@
|
||||
use proc_macro2::TokenStream;
|
||||
use quote::quote;
|
||||
use std::{collections::HashMap, fs};
|
||||
pub(crate) fn build() -> TokenStream {
|
||||
println!("cargo:rerun-if-changed=../assets/fuels.json");
|
||||
|
||||
let fuels: HashMap<u16, u16> =
|
||||
serde_json::from_str(&fs::read_to_string("../assets/fuels.json").unwrap())
|
||||
.expect("Failed to parse fuels.json");
|
||||
|
||||
let fuel_list_tokens = fuels
|
||||
.iter()
|
||||
.map(|(item_id, burn_ticks)| {
|
||||
quote! {
|
||||
(#item_id, #burn_ticks)
|
||||
}
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
let fuel_list_len = fuel_list_tokens.len();
|
||||
|
||||
let burn_tick_list_tokens = fuels
|
||||
.iter()
|
||||
.map(|(item_id, burn_ticks)| {
|
||||
quote! {
|
||||
#item_id => Some(#burn_ticks),
|
||||
}
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
quote! {
|
||||
pub static FUELS: [(u16,u16); #fuel_list_len] = [
|
||||
#(#fuel_list_tokens),*
|
||||
];
|
||||
|
||||
#[must_use]
|
||||
pub const fn get_item_burn_ticks(item_id: u16) -> Option<u16> {
|
||||
match item_id {
|
||||
#(#burn_tick_list_tokens)*
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub const fn is_fuel(item_id: u16) -> bool {
|
||||
get_item_burn_ticks(item_id).is_some()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -137,6 +137,10 @@ pub mod composter_increase_chance;
|
||||
#[path = "generated/flower_pot_transformations.rs"]
|
||||
pub mod flower_pot_transformations;
|
||||
|
||||
#[rustfmt::skip]
|
||||
#[path = "generated/fuels.rs"]
|
||||
pub mod fuels;
|
||||
|
||||
mod block_direction;
|
||||
pub mod block_state;
|
||||
mod blocks;
|
||||
|
||||
Reference in New Issue
Block a user