This commit is contained in:
zyl 2024-07-08 22:52:10 -07:00
parent 47b99a28ba
commit bde8af01d3
Signed by: zyl
SSH key fingerprint: SHA256:uxxbSXbdroP/OnKBGnEDk5q7EKB2razvstC/KmzdXXs
8 changed files with 109 additions and 5 deletions

View file

@ -0,0 +1,20 @@
---
title: i built a minecraft classic server
timestamp: 2024-07-08T10:37:00.00Z
tags: [minecraft, minecraft classic, dev]
desc: i got bored and built a minecraft classic server
header_image_file: 2024/07/classic2.png
header_image_alt: Screenshot of my Minecraft classic server showing two players standing in front of a stack of blocks.
---
a while ago i was looking for something to do and my brain decided i should.. build a complete reimplementation of the minecraft server, naturally. i knew i'd never get anywhere close to finishing that project before losing steam so instead, i redirected this inspiration into [a minecraft classic server](https://github.com/zyllian/classics)!
<md class="float-left w50" type="blog-image" src="cdn$2024/07/classic1.png" content="at one point while changing my world format, worlds started getting sent to clients diagonally! don't remember what caused this, though."></md>
minecraft classic has [fairly simple networking](https://wiki.vg/Classic_Protocol) as it turns out, so building a server which vanilla classic clients can connect to isn't too bad if you know what you're doing, and with no need to stay true to the vanilla map format, you can simplify things even further!
minecraft classic actually still has a decently large community around it, and what i believe are the most popular clients/servers all implement [an extended networking protocol](https://wiki.vg/Classic_Protocol_Extension) to add extra features that vanilla classic doesn't support.
my implementation lacks basically any kind of anti-cheat and is lacking most of the community protocol extensions, but it's still pretty cool to have built it! i love working on random projects and it's nice to see one which is actually useable, even if there's [a lot to add](https://zyllian/classics/issues)!
<md type="blog-image" src="cdn$2024/07/classic3.png" content="screenshot of me stress testing how many players i could connect to the server :3"></md>

View file

@ -8,7 +8,10 @@ hi! i'm zyl, a trans doggirlthing <abbr title="therian">ΘΔ</abbr> in the pnw.
if you're interested, check out [my youtube](me$https://youtube.com/@zylpup) to see what i've got going on there
if you're an adult i have a couple socials floating around:
if you're an adult i have a few socials floating around:
- [cohost](me$https://cohost.org/zyl)
- [instagram?](me$https://www.instagram.com/zylbarker/)
- [tumblr](me$https://www.tumblr.com/zyllian)
if you like what i do or just wanna help me out [check out my payment info](/pay-me) :)

View file

@ -10,6 +10,8 @@ embed:
you should send trans people money. here's how you can send _me_ money:
(preferred methods are feeless, so i'll receive the full amount you send)
- **[\$zylpup](https://cash.app/$zylpup)** on cashapp **(preferred)**
- **z@zyl.gay** on apple cash **(preferred)**
- [github sponsors](https://github.com/sponsors/zyllian)

View file

@ -74,8 +74,14 @@ embed:
</ul>
</details>
<details>
<details open>
<summary>changelog</summary>
<details>
<summary>07/08/2024</summary>
<ul>
<li>slow pet food/happiness decay</li>
</ul>
</details>
<details>
<summary>07/04/2024</summary>
<ul>

View file

@ -12,7 +12,7 @@
/** the amount of time it takes for a pet to have to GO */
const POTTY_TIME = 100;
/** how fast a pet's food value decays */
const FOOD_DECAY = MAX_FOOD / (UPDATES_PER_HOUR * 8); // to stay on top should be fed roughly once every 8 hours?
const FOOD_DECAY = MAX_FOOD / (UPDATES_PER_HOUR * 12); // to stay on top should be fed roughly once every 8 hours?
/** the rate at which a pet ages */
const AGING_RATE = 1;
/** how fast a pet's potty need decays */
@ -20,7 +20,7 @@
/** how much mess can be in a pet's space at once */
const MAX_MESS = 5;
/** how fast a pet's happiness decays */
const HAPPINESS_DECAY = FOOD_DECAY;
const HAPPINESS_DECAY = FOOD_DECAY / 1.5;
/** a pet's maximum happiness */
const MAX_HAPPINESS = 100;
/** how quickly a pet's happiness will be reduced by when hungry */

View file

@ -117,6 +117,7 @@ abbr {
}
.blog-post {
margin-top: 16px;
margin-left: auto;
margin-right: auto;
max-width: max(1000px, 40%);
@ -157,9 +158,38 @@ abbr {
h6 {
text-indent: 0;
}
.image {
width: 100%;
padding: 8px;
background-color: var(--accent-color);
text-indent: 0;
box-sizing: border-box;
margin: 8px;
&.w50 {
width: 50%;
}
img {
width: 100%;
}
span {
color: var(--accent-text-color);
}
}
}
}
.float-left {
float: left;
}
.float-right {
float: right;
}
#pet-counter {
display: none;
position: fixed;

View file

@ -17,6 +17,7 @@
{{#each resources}}
<div class="post">
<p class="title"><a href="/blog/{{id}}">{{title}}</a></p>
<p class="timestamp">{{timestamp}}</p>
<p class="short-desc">{{desc}}</p>
</div>
{{/each}}

View file

@ -2,7 +2,7 @@
use std::path::PathBuf;
use eyre::Context;
use eyre::{eyre, Context, OptionExt};
use gray_matter::{engine::YAML, Matter};
use handlebars::Handlebars;
use lol_html::{element, html_content::ContentType, HtmlRewriter, Settings};
@ -180,9 +180,51 @@ impl<'a> SiteBuilder<'a> {
}
}
Ok(())
}),
element!("md", |el| {
el.remove();
let class = el.get_attribute("class");
let md_type = el
.get_attribute("type")
.ok_or_eyre("missing type attribute on markdown tag")?;
if md_type == "blog-image" {
let mut src = el
.get_attribute("src")
.ok_or_eyre("missing src attribute")?;
if src.starts_with("cdn$") {
src = self.site.config.cdn_url(&src[4..])?.to_string();
}
let class = format!("image {}", class.unwrap_or_default());
let content = el
.get_attribute("content")
.ok_or_eyre("missing content attribute")?;
el.replace(
&format!(
r#"
<div class="{class}">
<a href="{src}">
<img src="{src}">
</a>
<span>{content}</span>
</div>
"#
),
ContentType::Html,
);
} else {
return Err(eyre!("unknown markdown tag type: {md_type}").into());
}
Ok(())
}),
],
strict: true,
..Default::default()
},
|c: &[u8]| output.extend_from_slice(c),