mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-16 10:55:01 -04:00
data: BlockItem
This commit is contained in:
parent
fca91e85b9
commit
026a2d2751
@ -198,7 +198,7 @@ data class BlockState(
|
||||
propertyJsonValue.asInt
|
||||
}
|
||||
else -> {
|
||||
propertyJsonValue.asString.toLowerCase()
|
||||
propertyJsonValue.asString.toLowerCase()
|
||||
}
|
||||
}
|
||||
try {
|
||||
|
@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2021 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with this program.If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
|
||||
*/
|
||||
|
||||
package de.bixilon.minosoft.data.mappings.items
|
||||
|
||||
import com.google.gson.JsonObject
|
||||
import de.bixilon.minosoft.data.mappings.ResourceLocation
|
||||
import de.bixilon.minosoft.data.mappings.blocks.Block
|
||||
import de.bixilon.minosoft.data.mappings.versions.VersionMapping
|
||||
|
||||
open class BlockItem(
|
||||
resourceLocation: ResourceLocation,
|
||||
data: JsonObject,
|
||||
versionMapping: VersionMapping,
|
||||
) : Item(resourceLocation, data, versionMapping) {
|
||||
val block: Block = versionMapping.blockRegistry.get(data["block"].asInt)
|
||||
}
|
@ -42,6 +42,7 @@ open class Item(
|
||||
override fun deserialize(mappings: VersionMapping?, resourceLocation: ResourceLocation, data: JsonObject): Item {
|
||||
check(mappings != null) { "VersionMapping is null!" }
|
||||
return when (data["class"].asString) {
|
||||
"BlockItem" -> BlockItem(resourceLocation, data, mappings)
|
||||
"ArmorItem" -> ArmorItem(resourceLocation, data, mappings)
|
||||
// "Item" -> Item(resourceLocation, data)
|
||||
// else -> TODO("Can not find item class: ${data["class"].asString}")
|
||||
|
Loading…
x
Reference in New Issue
Block a user