use vanilla water/lava textures for cobblegen

This commit is contained in:
YuRaNnNzZZ 2023-06-26 09:58:51 +03:00
parent 5b6a651340
commit 23dc91fb55
Signed by: YuRaNnNzZZ
GPG Key ID: 5F71738C85A6006D
7 changed files with 59 additions and 80 deletions

View File

@ -0,0 +1,33 @@
package ru.dbotthepony.mc.otm.registry
import net.minecraft.client.renderer.BiomeColors
import net.minecraft.core.BlockPos
import net.minecraft.world.item.ItemStack
import net.minecraft.world.level.BlockAndTintGetter
import net.minecraft.world.level.block.state.BlockState
import net.minecraftforge.client.event.RegisterColorHandlersEvent
import net.minecraftforge.eventbus.api.IEventBus
object MBlockColors {
private const val DEFAULT_WATER_TINT: Int = 0x3F76E4;
private fun registerBlockColors(event: RegisterColorHandlersEvent.Block) {
event.register({ state: BlockState?, light: BlockAndTintGetter?, pos: BlockPos?, index: Int ->
if (index == 0) {
if (light == null || pos == null) DEFAULT_WATER_TINT
BiomeColors.getAverageWaterColor(light!!, pos!!)
} else -1
}, MBlocks.COBBLESTONE_GENERATOR)
}
private fun registerItemColors(event: RegisterColorHandlersEvent.Item) {
event.register({ stack: ItemStack?, index: Int ->
if (index == 0) DEFAULT_WATER_TINT else -1
}, MBlocks.COBBLESTONE_GENERATOR)
}
internal fun register(bus: IEventBus) {
bus.addListener(this::registerBlockColors)
bus.addListener(this::registerItemColors)
}
}

View File

@ -223,6 +223,7 @@ object MRegistry {
LootModifiers.register(bus) LootModifiers.register(bus)
MItemFunctionTypes.register(bus) MItemFunctionTypes.register(bus)
MLootItemConditions.register(bus) MLootItemConditions.register(bus)
MBlockColors.register(bus)
MRecipes.register(bus) MRecipes.register(bus)

View File

@ -4,9 +4,9 @@
"texture_size": [32, 64], "texture_size": [32, 64],
"textures": { "textures": {
"0": "overdrive_that_matters:block/cobblestone_generator", "0": "overdrive_that_matters:block/cobblestone_generator",
"1": "overdrive_that_matters:block/lava_still", "particle": "overdrive_that_matters:block/cobblestone_generator",
"2": "overdrive_that_matters:block/water_still", "lava": "block/lava_still",
"particle": "overdrive_that_matters:block/cobblestone_generator" "water": "block/water_still"
}, },
"elements": [ "elements": [
{ {
@ -42,19 +42,6 @@
"up": {"uv": [0, 6.25, 7, 7], "rotation": 90, "texture": "#0"} "up": {"uv": [0, 6.25, 7, 7], "rotation": 90, "texture": "#0"}
} }
}, },
{
"name": "water",
"from": [12, 6, 1.1],
"to": [14.9, 14.9, 14.9],
"faces": {
"north": {"uv": [6.5, 7, 7.5, 9], "texture": "#2"},
"east": {"uv": [0, 7, 6.5, 9], "texture": "#2"},
"south": {"uv": [14, 7, 15, 9], "texture": "#2"},
"west": {"uv": [7.5, 7, 14, 9], "texture": "#2"},
"up": {"uv": [7.5, 7, 6.5, 3.75], "texture": "#2"},
"down": {"uv": [8.5, 3.75, 7.5, 7], "texture": "#2"}
}
},
{ {
"from": [15, 6, 1], "from": [15, 6, 1],
"to": [12, 15, 15], "to": [12, 15, 15],
@ -75,20 +62,6 @@
"up": {"uv": [0, 6.25, 7, 7], "rotation": 270, "texture": "#0"} "up": {"uv": [0, 6.25, 7, 7], "rotation": 270, "texture": "#0"}
} }
}, },
{
"name": "lava",
"from": [1.1, 6, 1.1],
"to": [4, 14.9, 14.9],
"faces": {
"north": {"uv": [6.5, 4, 7.5, 6], "texture": "#1"},
"east": {"uv": [0, 4, 6.5, 6], "texture": "#1"},
"south": {"uv": [14, 4, 15, 6], "texture": "#1"},
"west": {"uv": [7.5, 4, 14, 6], "texture": "#1"},
"up": {"uv": [7.5, 4, 6.5, 0.75], "texture": "#1"},
"down": {"uv": [8.5, 0.75, 7.5, 4], "texture": "#1"}
},
"forge_data": { "block_light": 15, "sky_light": 15 }
},
{ {
"from": [4, 6, 1], "from": [4, 6, 1],
"to": [1, 15, 15], "to": [1, 15, 15],
@ -98,6 +71,28 @@
"south": {"uv": [8.5, 4, 7, 6.25], "texture": "#0"}, "south": {"uv": [8.5, 4, 7, 6.25], "texture": "#0"},
"up": {"uv": [0, 6.25, 7, 7], "rotation": 90, "texture": "#0"} "up": {"uv": [0, 6.25, 7, 7], "rotation": 90, "texture": "#0"}
} }
},
{
"name": "lava",
"from": [1.1, 6, 1.1],
"to": [4, 14.9, 14.9],
"faces": {
"north": {"uv": [12, 1, 15, 10], "texture": "#lava"},
"south": {"uv": [1, 1, 4, 10], "texture": "#lava"},
"west": {"uv": [1, 1, 15, 10], "texture": "#lava"},
"up": {"uv": [4, 15, 1, 1], "texture": "#lava"}
}
},
{
"name": "water",
"from": [12, 6, 1.1],
"to": [14.9, 14.9, 14.9],
"faces": {
"north": {"uv": [1, 1, 4, 10], "texture": "#water", "tintindex": 0},
"east": {"uv": [1, 1, 15, 10], "texture": "#water", "tintindex": 0},
"south": {"uv": [12, 1, 15, 10], "texture": "#water", "tintindex": 0},
"up": {"uv": [15, 15, 12, 1], "texture": "#water", "tintindex": 0}
}
} }
], ],
"display": { "display": {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.4 KiB

View File

@ -1,45 +0,0 @@
{
"animation": {
"frametime": 2,
"frames": [
0,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
18,
17,
16,
15,
14,
13,
12,
11,
10,
9,
8,
7,
6,
5,
4,
3,
2,
1
]
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

View File

@ -1,5 +0,0 @@
{
"animation": {
"frametime": 2
}
}