From d8cf65e24c5f4135bd13159235bfd4dd7a663b8b Mon Sep 17 00:00:00 2001 From: Anuken Date: Thu, 14 Oct 2021 21:59:02 -0400 Subject: [PATCH] More permissive json type re-declarations --- core/src/mindustry/mod/ContentParser.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/core/src/mindustry/mod/ContentParser.java b/core/src/mindustry/mod/ContentParser.java index c195bd14be..2134b21fec 100644 --- a/core/src/mindustry/mod/ContentParser.java +++ b/core/src/mindustry/mod/ContentParser.java @@ -236,10 +236,11 @@ public class ContentParser{ Block block; if(locate(ContentType.block, name) != null){ - block = locate(ContentType.block, name); - if(value.has("type")){ - throw new IllegalArgumentException("When defining properties for an existing block, you must not re-declare its type. The original type will be used. Block: " + name); + Log.warn("Warning: '" + name + "' re-declares a type. This will be interpreted as a new block. If you wish to override a vanilla block, omit the 'type' section, as vanilla block `type`s cannot be changed."); + block = make(resolve(value.getString("type", ""), Block.class), mod + "-" + name); + }else{ + block = locate(ContentType.block, name); } }else{ block = make(resolve(value.getString("type", ""), Block.class), mod + "-" + name);