fix more bugs

This commit is contained in:
Bixilon 2021-04-08 16:20:17 +02:00
parent 5fa43d52b1
commit 7deb6659ef
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4
5 changed files with 34 additions and 47 deletions

View File

@ -142,13 +142,13 @@ object PixLyzer {
} else {
File(tempFileOutputPath).renameTo(outputFile)
println("Generated and saved hash file to ${outputFile.absolutePath}")
}
val assetsIndexJson = Util.readJsonFile(assetsIndex.absolutePath + ".json")
assetsIndexJson.addProperty(versionId, hash)
writeJson(assetsIndex.absolutePath, assetsIndexJson)
}
println("Done in ${System.currentTimeMillis() - startTime}ms")
}

View File

@ -206,10 +206,16 @@ object BlockGenerator : Generator(
try {
if (hasColorProperties) {
val tintColor = DEFAULT_BLOCK_COLORS.getColor(state, null, null)
when (blockData["tint"]?.asString) {
"minecraft:foliage_tint", "minecraft:lily_pad_tint", "minecraft:grass_tint" -> {
}
else -> {
if (tintColor != -1 && tintColor != 0) {
stateData.addProperty("tint_color", tintColor)
}
}
}
}
} catch (exception: Exception) {
}
@ -266,9 +272,7 @@ object BlockGenerator : Generator(
}
if (multipart.size() > 0 && !stateData.has("render")) {
val multipartWrapper = JsonArray()
multipartWrapper.add(multipart)
stateData.add("render", multipartWrapper)
stateData.add("render", multipart)
}
if (!block.hasDynamicBounds()) {
@ -476,26 +480,6 @@ object BlockGenerator : Generator(
output.addProperty(name, input)
}
fun getType(input: String): Any {
try {
return Integer.parseInt(input)
} catch (exception: Exception) {
}
try {
when (input) {
"true" -> return true
"false" -> return false
else -> {
}
}
} catch (exception: Exception) {
}
return input
}
private fun addBlockModel(json: JsonElement) {
when (json) {
is JsonObject -> {

View File

@ -126,6 +126,23 @@ object DimensionGenerator : Generator(
private fun getDimensions(): MutableSet<Triple<Identifier, Int?, DimensionType>> {
val types: MutableSet<Triple<Identifier, Int?, DimensionType>> = mutableSetOf()
if (types.isEmpty()) {
val dimensionRegistry = getField(Registry::class.java, "DIMENSION", "DIMENSION_TYPE")
try {
dimensionRegistry?.get(null)?.let {
check(it is Registry<*>)
val registryGetKeyMethod = Registry::class.java.getDeclaredMethod("getId", Object::class.java)
val dimensionTypeGetIdMethod = DimensionType::class.java.getDeclaredMethod("getRawId")
for (entry in it) {
check(entry is DimensionType)
types.add(Triple(registryGetKeyMethod.invoke(it, entry) as Identifier, dimensionTypeGetIdMethod.invoke(entry) as Int, entry))
}
}
} catch (exception: Exception) {
}
}
if (types.isEmpty()) {
for (field in DimensionType::class.java.declaredFields) {
@ -154,20 +171,6 @@ object DimensionGenerator : Generator(
}
}
if (types.isEmpty()) {
val dimensionRegistry = getField(Registry::class.java, "DIMENSION")
dimensionRegistry?.get(null)?.let {
check(it is Registry<*>)
val registryGetKeyMethod = Registry::class.java.getDeclaredMethod("getId", Object::class.java)
val dimensionTypeGetIdMethod = DimensionType::class.java.getDeclaredMethod("getRawId")
for (entry in it) {
check(entry is DimensionType)
types.add(Triple(registryGetKeyMethod.invoke(it, entry) as Identifier, dimensionTypeGetIdMethod.invoke(entry) as Int, entry))
}
}
}
return types
}

View File

@ -171,7 +171,7 @@ object ItemGenerator : Generator(
private val TOOL_ITEM_GETTER = getGetter(ToolMaterial::class.java, "getMiningSpeed", "getMiningSpeedMultiplier")!!
private val IS_FIRE_RESISTANT_FIELD = getField(Item::class.java, "blocks")
private val IS_FIRE_RESISTANT_FIELD = getField(Item::class.java, "fireproof")
private val DIGGER_ITEM_BLOCKS_FIELD = MiningToolItem::class.java.getDeclaredField("effectiveBlocks")
private val DIGGER_ITEM_SPEED_FIELD = MiningToolItem::class.java.getDeclaredField("miningSpeed")

View File

@ -490,7 +490,7 @@
"HoglinEntity": {
"data": {
"IMMUNE_TO_ZOMBIFICATION": "HOGLIN_IMMUNE_TO_ZOMBIFICATION",
"BABY": "HOGLIN_IS_BABY"
"BABY": "AGEABLE_IS_BABY"
}
},
"AbstractPiglinEntity": {