Merge branch '1.19.3' of https://git.dbotthepony.ru/DBot/overdrive_that_matters into 1.19.2
This commit is contained in:
commit
f4c9f9d057
@ -596,6 +596,6 @@ fun addAdvancements(serializer: Consumer<AdvancementHolder>, lang: MatteryLangua
|
|||||||
.addCriterion("damage", NailedEntityTrigger.Instance().criterion())
|
.addCriterion("damage", NailedEntityTrigger.Instance().criterion())
|
||||||
.save(serializer, modLocation("regular/explosive_hammer"))
|
.save(serializer, modLocation("regular/explosive_hammer"))
|
||||||
|
|
||||||
CraftEntry(MItems.ESSENCE_STORAGE.values, "Did not Forgot to Remember",
|
CraftEntry(MItems.ESSENCE_STORAGE.values, "Did not Forget to Remember",
|
||||||
russianName = "Не забыл запомнить").make(serializer, essenceCapsule, translation)
|
russianName = "Не забыл запомнить").make(serializer, essenceCapsule, translation)
|
||||||
}
|
}
|
||||||
|
@ -12,10 +12,15 @@ import net.minecraft.world.level.block.state.BlockState
|
|||||||
import ru.dbotthepony.mc.otm.block.entity.IRedstoneControlled
|
import ru.dbotthepony.mc.otm.block.entity.IRedstoneControlled
|
||||||
import ru.dbotthepony.mc.otm.block.entity.MatteryBlockEntity
|
import ru.dbotthepony.mc.otm.block.entity.MatteryBlockEntity
|
||||||
import ru.dbotthepony.mc.otm.block.entity.SynchronizedRedstoneControl
|
import ru.dbotthepony.mc.otm.block.entity.SynchronizedRedstoneControl
|
||||||
|
import ru.dbotthepony.mc.otm.client.minecraft
|
||||||
import ru.dbotthepony.mc.otm.menu.decorative.HoloSignMenu
|
import ru.dbotthepony.mc.otm.menu.decorative.HoloSignMenu
|
||||||
|
import ru.dbotthepony.mc.otm.network.synchronizer.FloatFieldAccess
|
||||||
import ru.dbotthepony.mc.otm.once
|
import ru.dbotthepony.mc.otm.once
|
||||||
import ru.dbotthepony.mc.otm.registry.MBlockEntities
|
import ru.dbotthepony.mc.otm.registry.MBlockEntities
|
||||||
import ru.dbotthepony.mc.otm.registry.MBlocks
|
import ru.dbotthepony.mc.otm.registry.MBlocks
|
||||||
|
import thedarkcolour.kotlinforforge.forge.vectorutil.v3d.component1
|
||||||
|
import thedarkcolour.kotlinforforge.forge.vectorutil.v3d.component2
|
||||||
|
import thedarkcolour.kotlinforforge.forge.vectorutil.v3d.component3
|
||||||
|
|
||||||
class HoloSignBlockEntity(blockPos: BlockPos, blockState: BlockState) : MatteryBlockEntity(MBlockEntities.HOLO_SIGN, blockPos, blockState), MenuProvider, IRedstoneControlled {
|
class HoloSignBlockEntity(blockPos: BlockPos, blockState: BlockState) : MatteryBlockEntity(MBlockEntities.HOLO_SIGN, blockPos, blockState), MenuProvider, IRedstoneControlled {
|
||||||
override val redstoneControl = SynchronizedRedstoneControl(synchronizer) { _, _ -> setChanged() }
|
override val redstoneControl = SynchronizedRedstoneControl(synchronizer) { _, _ -> setChanged() }
|
||||||
@ -25,9 +30,26 @@ class HoloSignBlockEntity(blockPos: BlockPos, blockState: BlockState) : MatteryB
|
|||||||
access.write(value)
|
access.write(value)
|
||||||
})
|
})
|
||||||
|
|
||||||
var textRed by synchronizer.float(1f).property
|
private fun colorSetter(value: Float, access: FloatFieldAccess, setByRemote: Boolean) {
|
||||||
var textGreen by synchronizer.float(1f).property
|
if (access.readFloat() != value) {
|
||||||
var textBlue by synchronizer.float(85f / 255f).property
|
access.write(value)
|
||||||
|
|
||||||
|
if (setByRemote) {
|
||||||
|
markDirtyClientside()
|
||||||
|
} else {
|
||||||
|
markDirtyFast()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun markDirtyClientside() {
|
||||||
|
val (x, y, z) = blockPos
|
||||||
|
minecraft.levelRenderer.setBlocksDirty(x, y, z, x, y, z)
|
||||||
|
}
|
||||||
|
|
||||||
|
var textRed by synchronizer.float(1f, setter = ::colorSetter).property
|
||||||
|
var textGreen by synchronizer.float(1f, setter = ::colorSetter).property
|
||||||
|
var textBlue by synchronizer.float(85f / 255f, setter = ::colorSetter).property
|
||||||
var textAlpha by synchronizer.float(1f).property
|
var textAlpha by synchronizer.float(1f).property
|
||||||
|
|
||||||
var isLocked = false
|
var isLocked = false
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package ru.dbotthepony.mc.otm.registry
|
package ru.dbotthepony.mc.otm.registry
|
||||||
|
|
||||||
|
import net.minecraft.client.color.block.BlockColor
|
||||||
|
import net.minecraft.client.color.item.ItemColor
|
||||||
import net.minecraft.client.renderer.BiomeColors
|
import net.minecraft.client.renderer.BiomeColors
|
||||||
import net.minecraft.core.BlockPos
|
import net.minecraft.core.BlockPos
|
||||||
import net.minecraft.world.item.ItemStack
|
import net.minecraft.world.item.ItemStack
|
||||||
@ -7,29 +9,59 @@ import net.minecraft.world.level.BlockAndTintGetter
|
|||||||
import net.minecraft.world.level.block.state.BlockState
|
import net.minecraft.world.level.block.state.BlockState
|
||||||
import net.minecraftforge.client.event.RegisterColorHandlersEvent
|
import net.minecraftforge.client.event.RegisterColorHandlersEvent
|
||||||
import net.minecraftforge.eventbus.api.IEventBus
|
import net.minecraftforge.eventbus.api.IEventBus
|
||||||
|
import ru.dbotthepony.mc.otm.block.entity.decorative.HoloSignBlockEntity
|
||||||
|
import ru.dbotthepony.mc.otm.core.math.RGBAColor
|
||||||
|
|
||||||
object MBlockColors {
|
object MBlockColors {
|
||||||
private const val DEFAULT_WATER_TINT: Int = 0x3F76E4
|
private const val DEFAULT_WATER_TINT: Int = 0x3F76E4
|
||||||
|
private const val DEFAULT_HOLO_SIGN_TINT: Int = 0xffe049
|
||||||
|
|
||||||
|
private object CobblestoneGeneratorColor : BlockColor, ItemColor {
|
||||||
|
override fun getColor(state: BlockState, light: BlockAndTintGetter?, pos: BlockPos?, index: Int): Int {
|
||||||
|
return if (index == 0) {
|
||||||
|
if (light == null || pos == null)
|
||||||
|
DEFAULT_WATER_TINT
|
||||||
|
else
|
||||||
|
BiomeColors.getAverageWaterColor(light, pos)
|
||||||
|
} else -1
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getColor(itemStack: ItemStack, index: Int): Int {
|
||||||
|
return if (index == 0) DEFAULT_WATER_TINT else -1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private object HoloSightColor : BlockColor, ItemColor {
|
||||||
|
override fun getColor(state: BlockState, light: BlockAndTintGetter?, pos: BlockPos?, index: Int): Int {
|
||||||
|
if (index != 0)
|
||||||
|
return -1
|
||||||
|
|
||||||
|
if (light == null || pos == null)
|
||||||
|
return DEFAULT_HOLO_SIGN_TINT
|
||||||
|
|
||||||
|
val blockEntity = light.getBlockEntity(pos) as? HoloSignBlockEntity ?: return DEFAULT_HOLO_SIGN_TINT
|
||||||
|
return RGBAColor(blockEntity.textRed, blockEntity.textGreen, blockEntity.textBlue, blockEntity.textAlpha).toRGB()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getColor(itemStack: ItemStack, index: Int): Int {
|
||||||
|
return if (index == 0) DEFAULT_HOLO_SIGN_TINT else -1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun registerBlockColors(event: RegisterColorHandlersEvent.Block) {
|
private fun registerBlockColors(event: RegisterColorHandlersEvent.Block) {
|
||||||
for (it in MBlocks.COBBLESTONE_GENERATOR.values) {
|
for (it in MBlocks.COBBLESTONE_GENERATOR.values) {
|
||||||
event.register({ state: BlockState, light: BlockAndTintGetter?, pos: BlockPos?, index: Int ->
|
event.register(CobblestoneGeneratorColor, it)
|
||||||
if (index == 0) {
|
|
||||||
if (light == null || pos == null)
|
|
||||||
DEFAULT_WATER_TINT
|
|
||||||
else
|
|
||||||
BiomeColors.getAverageWaterColor(light, pos)
|
|
||||||
} else -1
|
|
||||||
}, it)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
event.register(HoloSightColor, MBlocks.HOLO_SIGN)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun registerItemColors(event: RegisterColorHandlersEvent.Item) {
|
private fun registerItemColors(event: RegisterColorHandlersEvent.Item) {
|
||||||
for (it in MBlocks.COBBLESTONE_GENERATOR.values) {
|
for (it in MBlocks.COBBLESTONE_GENERATOR.values) {
|
||||||
event.register({ stack: ItemStack, index: Int ->
|
event.register(CobblestoneGeneratorColor, it)
|
||||||
if (index == 0) DEFAULT_WATER_TINT else -1
|
|
||||||
}, it)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
event.register(HoloSightColor, MBlocks.HOLO_SIGN)
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun register(bus: IEventBus) {
|
internal fun register(bus: IEventBus) {
|
||||||
|
@ -77,12 +77,7 @@
|
|||||||
"from": [14, 14, 9.99],
|
"from": [14, 14, 9.99],
|
||||||
"to": [15, 15, 9.99],
|
"to": [15, 15, 9.99],
|
||||||
"faces": {
|
"faces": {
|
||||||
"north": {"uv": [8.5, 8.5, 9, 9], "texture": "#0", "forge_data": {"block_light": 15}},
|
"north": {"uv": [8.5, 8.5, 9, 9], "texture": "#0", "forge_data": {"block_light": 15}, "tintindex": 0}
|
||||||
"east": {"uv": [0, 0, 0, 16], "texture": "#missing"},
|
|
||||||
"south": {"uv": [0, 0, 16, 16], "texture": "#missing"},
|
|
||||||
"west": {"uv": [0, 0, 0, 16], "texture": "#missing"},
|
|
||||||
"up": {"uv": [0, 0, 16, 0], "texture": "#missing"},
|
|
||||||
"down": {"uv": [0, 0, 16, 0], "texture": "#missing"}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -90,12 +85,7 @@
|
|||||||
"from": [1, 14, 9.99],
|
"from": [1, 14, 9.99],
|
||||||
"to": [2, 15, 9.99],
|
"to": [2, 15, 9.99],
|
||||||
"faces": {
|
"faces": {
|
||||||
"north": {"uv": [15, 8.5, 15.5, 9], "texture": "#0", "forge_data": {"block_light": 15}},
|
"north": {"uv": [15, 8.5, 15.5, 9], "texture": "#0", "forge_data": {"block_light": 15}, "tintindex": 0}
|
||||||
"east": {"uv": [0, 0, 0, 16], "texture": "#missing"},
|
|
||||||
"south": {"uv": [0, 0, 16, 16], "texture": "#missing"},
|
|
||||||
"west": {"uv": [0, 0, 0, 16], "texture": "#missing"},
|
|
||||||
"up": {"uv": [0, 0, 16, 0], "texture": "#missing"},
|
|
||||||
"down": {"uv": [0, 0, 16, 0], "texture": "#missing"}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -103,12 +93,7 @@
|
|||||||
"from": [1, 1, 9.99],
|
"from": [1, 1, 9.99],
|
||||||
"to": [2, 2, 9.99],
|
"to": [2, 2, 9.99],
|
||||||
"faces": {
|
"faces": {
|
||||||
"north": {"uv": [15, 15, 15.5, 15.5], "texture": "#0", "forge_data": {"block_light": 15}},
|
"north": {"uv": [15, 15, 15.5, 15.5], "texture": "#0", "forge_data": {"block_light": 15}, "tintindex": 0}
|
||||||
"east": {"uv": [0, 0, 0, 16], "texture": "#missing"},
|
|
||||||
"south": {"uv": [0, 0, 16, 16], "texture": "#missing"},
|
|
||||||
"west": {"uv": [0, 0, 0, 16], "texture": "#missing"},
|
|
||||||
"up": {"uv": [0, 0, 16, 0], "texture": "#missing"},
|
|
||||||
"down": {"uv": [0, 0, 16, 0], "texture": "#missing"}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -116,12 +101,7 @@
|
|||||||
"from": [14, 1, 9.99],
|
"from": [14, 1, 9.99],
|
||||||
"to": [15, 2, 9.99],
|
"to": [15, 2, 9.99],
|
||||||
"faces": {
|
"faces": {
|
||||||
"north": {"uv": [8.5, 15, 9, 15.5], "texture": "#0", "forge_data": {"block_light": 15}},
|
"north": {"uv": [8.5, 15, 9, 15.5], "texture": "#0", "forge_data": {"block_light": 15}, "tintindex": 0}
|
||||||
"east": {"uv": [0, 0, 0, 16], "texture": "#missing"},
|
|
||||||
"south": {"uv": [0, 0, 16, 16], "texture": "#missing"},
|
|
||||||
"west": {"uv": [0, 0, 0, 16], "texture": "#missing"},
|
|
||||||
"up": {"uv": [0, 0, 16, 0], "texture": "#missing"},
|
|
||||||
"down": {"uv": [0, 0, 16, 0], "texture": "#missing"}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -129,12 +109,7 @@
|
|||||||
"from": [2.01, 6, 9],
|
"from": [2.01, 6, 9],
|
||||||
"to": [2.01, 10, 10],
|
"to": [2.01, 10, 10],
|
||||||
"faces": {
|
"faces": {
|
||||||
"north": {"uv": [0, 0, 0, 4], "texture": "#missing"},
|
"east": {"uv": [1.5, 13, 2, 15], "texture": "#0", "forge_data": {"block_light": 15}, "tintindex": 0}
|
||||||
"east": {"uv": [1.5, 13, 2, 15], "texture": "#0", "forge_data": {"block_light": 15}},
|
|
||||||
"south": {"uv": [0, 0, 0, 4], "texture": "#missing"},
|
|
||||||
"west": {"uv": [0, 0, 1, 4], "texture": "#missing"},
|
|
||||||
"up": {"uv": [0, 0, 0, 1], "texture": "#missing"},
|
|
||||||
"down": {"uv": [0, 0, 0, 1], "texture": "#missing"}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -142,12 +117,7 @@
|
|||||||
"from": [13.99, 6, 9],
|
"from": [13.99, 6, 9],
|
||||||
"to": [13.99, 10, 10],
|
"to": [13.99, 10, 10],
|
||||||
"faces": {
|
"faces": {
|
||||||
"north": {"uv": [0, 0, 0, 4], "texture": "#missing"},
|
"west": {"uv": [1.5, 13, 2, 15], "texture": "#0", "forge_data": {"block_light": 15}, "tintindex": 0}
|
||||||
"east": {"uv": [0, 0, 1, 4], "texture": "#missing"},
|
|
||||||
"south": {"uv": [0, 0, 0, 4], "texture": "#missing"},
|
|
||||||
"west": {"uv": [1.5, 13, 2, 15], "texture": "#0", "forge_data": {"block_light": 15}},
|
|
||||||
"up": {"uv": [0, 0, 0, 1], "texture": "#missing"},
|
|
||||||
"down": {"uv": [0, 0, 0, 1], "texture": "#missing"}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 424 B After Width: | Height: | Size: 1.1 KiB |
Loading…
Reference in New Issue
Block a user