mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-16 10:55:01 -04:00
bump pixlyer, improve fluid classes
This commit is contained in:
parent
cac7d44bb0
commit
7c83342333
@ -0,0 +1,24 @@
|
|||||||
|
/*
|
||||||
|
* 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.registries.fluid
|
||||||
|
|
||||||
|
import com.google.gson.JsonObject
|
||||||
|
import de.bixilon.minosoft.data.registries.ResourceLocation
|
||||||
|
import de.bixilon.minosoft.data.registries.versions.Registries
|
||||||
|
|
||||||
|
class EmptyFluid(
|
||||||
|
resourceLocation: ResourceLocation,
|
||||||
|
registries: Registries,
|
||||||
|
data: JsonObject,
|
||||||
|
) : Fluid(resourceLocation, registries, data)
|
@ -14,18 +14,24 @@ package de.bixilon.minosoft.data.registries.fluid
|
|||||||
|
|
||||||
import com.google.gson.JsonObject
|
import com.google.gson.JsonObject
|
||||||
import de.bixilon.minosoft.data.registries.ResourceLocation
|
import de.bixilon.minosoft.data.registries.ResourceLocation
|
||||||
|
import de.bixilon.minosoft.data.registries.fluid.lava.FlowingLavaFluid
|
||||||
|
import de.bixilon.minosoft.data.registries.fluid.lava.StillLavaFluid
|
||||||
|
import de.bixilon.minosoft.data.registries.fluid.water.FlowingWaterFluid
|
||||||
|
import de.bixilon.minosoft.data.registries.fluid.water.StillWaterFluid
|
||||||
import de.bixilon.minosoft.data.registries.items.Item
|
import de.bixilon.minosoft.data.registries.items.Item
|
||||||
import de.bixilon.minosoft.data.registries.particle.ParticleType
|
import de.bixilon.minosoft.data.registries.particle.ParticleType
|
||||||
import de.bixilon.minosoft.data.registries.registry.RegistryItem
|
import de.bixilon.minosoft.data.registries.registry.RegistryItem
|
||||||
import de.bixilon.minosoft.data.registries.registry.ResourceLocationDeserializer
|
import de.bixilon.minosoft.data.registries.registry.ResourceLocationDeserializer
|
||||||
import de.bixilon.minosoft.data.registries.versions.Registries
|
import de.bixilon.minosoft.data.registries.versions.Registries
|
||||||
|
|
||||||
data class Fluid(
|
open class Fluid(
|
||||||
override val resourceLocation: ResourceLocation,
|
override val resourceLocation: ResourceLocation,
|
||||||
private val bucketItemId: Int?,
|
registries: Registries,
|
||||||
val dripParticle: ParticleType?,
|
data: JsonObject,
|
||||||
val renderTexture: ResourceLocation?,
|
|
||||||
) : RegistryItem {
|
) : RegistryItem {
|
||||||
|
private val bucketItemId = data["bucket"]?.asInt
|
||||||
|
val dripParticle: ParticleType? = data["drip_particle_type"]?.asInt?.let { registries.particleTypeRegistry[it] }
|
||||||
|
val renderTexture: ResourceLocation? = data["render"]?.asJsonObject?.get("texture")?.asString?.let { ResourceLocation(it) }
|
||||||
var bucketItem: Item? = null
|
var bucketItem: Item? = null
|
||||||
private set
|
private set
|
||||||
|
|
||||||
@ -38,14 +44,21 @@ data class Fluid(
|
|||||||
}
|
}
|
||||||
|
|
||||||
companion object : ResourceLocationDeserializer<Fluid> {
|
companion object : ResourceLocationDeserializer<Fluid> {
|
||||||
|
private val CONSTRUCTORS: Map<String, (resourceLocation: ResourceLocation, registries: Registries, data: JsonObject) -> Fluid> = mapOf(
|
||||||
|
"EmptyFluid" to { resourceLocation, registries, data -> EmptyFluid(resourceLocation, registries, data) },
|
||||||
|
"WaterFluid\$Flowing" to { resourceLocation, registries, data -> FlowingWaterFluid(resourceLocation, registries, data) },
|
||||||
|
"WaterFluid\$Still" to { resourceLocation, registries, data -> StillWaterFluid(resourceLocation, registries, data) },
|
||||||
|
"LavaFluid\$Flowing" to { resourceLocation, registries, data -> FlowingLavaFluid(resourceLocation, registries, data) },
|
||||||
|
"LavaFluid\$Still" to { resourceLocation, registries, data -> StillLavaFluid(resourceLocation, registries, data) },
|
||||||
|
)
|
||||||
|
|
||||||
override fun deserialize(registries: Registries?, resourceLocation: ResourceLocation, data: JsonObject): Fluid {
|
override fun deserialize(registries: Registries?, resourceLocation: ResourceLocation, data: JsonObject): Fluid {
|
||||||
check(registries != null) { "Registries is null!" }
|
check(registries != null) { "Registries is null!" }
|
||||||
return Fluid(
|
CONSTRUCTORS[data["class"]?.asString]?.let {
|
||||||
resourceLocation = resourceLocation,
|
return it.invoke(resourceLocation, registries, data)
|
||||||
bucketItemId = data["bucket"]?.asInt,
|
}
|
||||||
dripParticle = data["drip_particle_type"]?.asInt?.let { registries.particleTypeRegistry[it] },
|
|
||||||
renderTexture = data["render"]?.asJsonObject?.get("texture")?.asString?.let { ResourceLocation(it) },
|
return Fluid(resourceLocation, registries, data)
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,24 @@
|
|||||||
|
/*
|
||||||
|
* 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.registries.fluid.lava
|
||||||
|
|
||||||
|
import com.google.gson.JsonObject
|
||||||
|
import de.bixilon.minosoft.data.registries.ResourceLocation
|
||||||
|
import de.bixilon.minosoft.data.registries.versions.Registries
|
||||||
|
|
||||||
|
class FlowingLavaFluid(
|
||||||
|
resourceLocation: ResourceLocation,
|
||||||
|
registries: Registries,
|
||||||
|
data: JsonObject,
|
||||||
|
) : LavaFluid(resourceLocation, registries, data)
|
@ -0,0 +1,25 @@
|
|||||||
|
/*
|
||||||
|
* 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.registries.fluid.lava
|
||||||
|
|
||||||
|
import com.google.gson.JsonObject
|
||||||
|
import de.bixilon.minosoft.data.registries.ResourceLocation
|
||||||
|
import de.bixilon.minosoft.data.registries.fluid.Fluid
|
||||||
|
import de.bixilon.minosoft.data.registries.versions.Registries
|
||||||
|
|
||||||
|
abstract class LavaFluid(
|
||||||
|
resourceLocation: ResourceLocation,
|
||||||
|
registries: Registries,
|
||||||
|
data: JsonObject,
|
||||||
|
) : Fluid(resourceLocation, registries, data)
|
@ -0,0 +1,24 @@
|
|||||||
|
/*
|
||||||
|
* 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.registries.fluid.lava
|
||||||
|
|
||||||
|
import com.google.gson.JsonObject
|
||||||
|
import de.bixilon.minosoft.data.registries.ResourceLocation
|
||||||
|
import de.bixilon.minosoft.data.registries.versions.Registries
|
||||||
|
|
||||||
|
class StillLavaFluid(
|
||||||
|
resourceLocation: ResourceLocation,
|
||||||
|
registries: Registries,
|
||||||
|
data: JsonObject,
|
||||||
|
) : LavaFluid(resourceLocation, registries, data)
|
@ -0,0 +1,24 @@
|
|||||||
|
/*
|
||||||
|
* 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.registries.fluid.water
|
||||||
|
|
||||||
|
import com.google.gson.JsonObject
|
||||||
|
import de.bixilon.minosoft.data.registries.ResourceLocation
|
||||||
|
import de.bixilon.minosoft.data.registries.versions.Registries
|
||||||
|
|
||||||
|
class FlowingWaterFluid(
|
||||||
|
resourceLocation: ResourceLocation,
|
||||||
|
registries: Registries,
|
||||||
|
data: JsonObject,
|
||||||
|
) : WaterFluid(resourceLocation, registries, data)
|
@ -0,0 +1,24 @@
|
|||||||
|
/*
|
||||||
|
* 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.registries.fluid.water
|
||||||
|
|
||||||
|
import com.google.gson.JsonObject
|
||||||
|
import de.bixilon.minosoft.data.registries.ResourceLocation
|
||||||
|
import de.bixilon.minosoft.data.registries.versions.Registries
|
||||||
|
|
||||||
|
class StillWaterFluid(
|
||||||
|
resourceLocation: ResourceLocation,
|
||||||
|
registries: Registries,
|
||||||
|
data: JsonObject,
|
||||||
|
) : WaterFluid(resourceLocation, registries, data)
|
@ -0,0 +1,25 @@
|
|||||||
|
/*
|
||||||
|
* 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.registries.fluid.water
|
||||||
|
|
||||||
|
import com.google.gson.JsonObject
|
||||||
|
import de.bixilon.minosoft.data.registries.ResourceLocation
|
||||||
|
import de.bixilon.minosoft.data.registries.fluid.Fluid
|
||||||
|
import de.bixilon.minosoft.data.registries.versions.Registries
|
||||||
|
|
||||||
|
abstract class WaterFluid(
|
||||||
|
resourceLocation: ResourceLocation,
|
||||||
|
registries: Registries,
|
||||||
|
data: JsonObject,
|
||||||
|
) : Fluid(resourceLocation, registries, data)
|
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user