Add server-only crossbow ammunition and copper rail speed controls

This commit is contained in:
2026-09-13 09:16:42 +03:00
commit c6c222ef36
155 changed files with 9238 additions and 0 deletions
@@ -0,0 +1,17 @@
package online.astradev.content.rail;
import net.minecraft.resources.Identifier;
public record RailKind(int age, boolean waxed) {
public RailKind { if (age < 0 || age > 3) throw new IllegalArgumentException("Oxidation: " + age); }
public int speed() { return 20 - 4 * age; }
public int code() { return age + (waxed ? 4 : 0); }
public static RailKind decode(int code) { return new RailKind(code & 3, (code & 4) != 0); }
public Identifier id() {
return Identifier.fromNamespaceAndPath("astracontent", (waxed ? "waxed_" : "")
+ new String[]{"", "exposed_", "weathered_", "oxidized_"}[age] + "copper_rail");
}
public static RailKind fromId(Identifier id) {
for (int code = 0; code < 8; code++) if (decode(code).id().equals(id)) return decode(code);
return null;
}
}