This commit is contained in:
MCxzfwq 2025-12-05 12:52:56 +00:00 committed by GitHub
commit 8bc2a760ad
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 42 additions and 2 deletions

View file

@ -187,3 +187,4 @@ Iniquit
DSFdsfWxp
Someone's Shadow
buj
MCxzfwq/m1cxzfw3q

View file

@ -94,16 +94,18 @@ public class Blocks{
//sandbox
powerSource, powerVoid, itemSource, itemVoid, liquidSource, liquidVoid, payloadSource, payloadVoid, illuminator, heatSource,
//defense
//walls
copperWall, copperWallLarge, titaniumWall, titaniumWallLarge, plastaniumWall, plastaniumWallLarge, thoriumWall, thoriumWallLarge, door, doorLarge,
phaseWall, phaseWallLarge, surgeWall, surgeWallLarge,
scrapWall, scrapWallLarge, scrapWallHuge, scrapWallGigantic, thruster, //ok, these names are getting ridiculous, but at least I don't have humongous walls yet
//walls - erekir
berylliumWall, berylliumWallLarge, tungstenWall, tungstenWallLarge, blastDoor, reinforcedSurgeWall, reinforcedSurgeWallLarge, carbideWall, carbideWallLarge,
shieldedWall,
//defense
mender, mendProjector, overdriveProjector, overdriveDome, forceProjector, shockMine,
scrapWall, scrapWallLarge, scrapWallHuge, scrapWallGigantic, thruster, //ok, these names are getting ridiculous, but at least I don't have humongous walls yet
//defense - erekir
radar,

View file

@ -516,12 +516,43 @@ public class ContentParser{
}
}
case "powerBuffered" -> block.consumePowerBuffered(child.asFloat());
case "itemsBoost" -> block.consume(
child.isArray()? new ConsumeItems(parser.readValue(ItemStack[].class, child)) :
child.isString() ? new ConsumeItems(new ItemStack[]{parser.readValue(ItemStack.class, child)}) :
parser.readValue(ConsumeItems.class, child)).boost();
case "liquidsBoost" -> block.consume(
child.isArray() ? new ConsumeLiquids(parser.readValue(LiquidStack[].class, child)) :
parser.readValue(ConsumeLiquids.class, child)).boost();
default -> throw new IllegalArgumentException("Unknown consumption type: '" + child.name + "' for block '" + block.name + "'.");
}
}
value.remove("consumes");
}
public void readBlockCanInputItems(Block block, JsonValue value){
boolean[] booleans = block.itemFilter;
for(JsonValue child : value){
switch(child.name){
case "add" -> {
for (Item it : parser.readValue(Item[].class, child)) {
if (!booleans[it.id]) {
block.itemFilter[it.id] = true;
}
}
}
case "remove" -> {
for (Item it : parser.readValue(Item[].class, child)) {
if(booleans[it.id]){
block.itemFilter[it.id] = false;
}
}
}
default -> throw new IllegalArgumentException("Unknown consumption type: '" + child.name + "' for block '" + block.name + "'.");
}
}
value.remove("canInputItems");
}
private ObjectMap<ContentType, TypeParser<?>> parsers = ObjectMap.of(
ContentType.block, (TypeParser<Block>)(mod, name, value) -> {
readBundle(ContentType.block, name, value);
@ -547,6 +578,11 @@ public class ContentParser{
value.remove("consumes");
}
if(value.has("canInputItems") && value.get("canInputItems").isObject()){
readBlockCanInputItems(block, value.get("canInputItems"));
value.remove("canInputItems");
}
readFields(block, value, true);
if(block.size > maxBlockSize){

View file

@ -7,6 +7,7 @@ import arc.math.*;
import arc.struct.*;
import arc.util.*;
import arc.util.io.*;
import mindustry.Vars;
import mindustry.annotations.Annotations.*;
import mindustry.content.*;
import mindustry.entities.*;