most *compile* errors resolved for 1.20
only damage triggers remain and whatever font funcs in Ext.kt
This commit is contained in:
parent
8a0cfaa90d
commit
16b28a1d2d
@ -1,6 +1,7 @@
|
|||||||
package ru.dbotthepony.mc.otm.android
|
package ru.dbotthepony.mc.otm.android
|
||||||
|
|
||||||
import com.mojang.blaze3d.vertex.PoseStack
|
import com.mojang.blaze3d.vertex.PoseStack
|
||||||
|
import net.minecraft.client.gui.GuiGraphics
|
||||||
import net.minecraft.nbt.CompoundTag
|
import net.minecraft.nbt.CompoundTag
|
||||||
import ru.dbotthepony.mc.otm.capability.MatteryPlayerCapability
|
import ru.dbotthepony.mc.otm.capability.MatteryPlayerCapability
|
||||||
import ru.dbotthepony.mc.otm.core.nbt.set
|
import ru.dbotthepony.mc.otm.core.nbt.set
|
||||||
@ -39,7 +40,7 @@ abstract class AndroidSwitchableFeature(type: AndroidFeatureType<*>, android: Ma
|
|||||||
|
|
||||||
// TODO: PoseStack is stripped from server dist
|
// TODO: PoseStack is stripped from server dist
|
||||||
// but it doesn't seem to cause issues?
|
// but it doesn't seem to cause issues?
|
||||||
abstract fun renderIcon(stack: PoseStack, x: Float, y: Float, width: Float, height: Float)
|
abstract fun renderIcon(graphics: GuiGraphics, x: Float, y: Float, width: Float, height: Float)
|
||||||
|
|
||||||
override fun serializeNBT(): CompoundTag {
|
override fun serializeNBT(): CompoundTag {
|
||||||
return super.serializeNBT().also {
|
return super.serializeNBT().also {
|
||||||
|
@ -4,6 +4,7 @@ import com.mojang.blaze3d.systems.RenderSystem
|
|||||||
import com.mojang.blaze3d.vertex.PoseStack
|
import com.mojang.blaze3d.vertex.PoseStack
|
||||||
import net.minecraft.ChatFormatting
|
import net.minecraft.ChatFormatting
|
||||||
import net.minecraft.client.Camera
|
import net.minecraft.client.Camera
|
||||||
|
import net.minecraft.client.gui.GuiGraphics
|
||||||
import net.minecraft.client.renderer.LevelRenderer
|
import net.minecraft.client.renderer.LevelRenderer
|
||||||
import net.minecraft.core.BlockPos
|
import net.minecraft.core.BlockPos
|
||||||
import net.minecraft.core.Direction
|
import net.minecraft.core.Direction
|
||||||
@ -74,29 +75,29 @@ class EnderTeleporterFeature(capability: MatteryPlayerCapability) : AndroidActiv
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun canSupportPlayer(blockPos: BlockPos): Boolean {
|
private fun canSupportPlayer(blockPos: BlockPos): Boolean {
|
||||||
val state = ply.level.getBlockState(blockPos)
|
val state = ply.level().getBlockState(blockPos)
|
||||||
|
|
||||||
if (state.`is`(BlockTags.CLIMBABLE)) {
|
if (state.`is`(BlockTags.CLIMBABLE)) {
|
||||||
return true // ladders can always support player
|
return true // ladders can always support player
|
||||||
}
|
}
|
||||||
|
|
||||||
val shape = state.getCollisionShape(ply.level, blockPos, CollisionContext.of(ply))
|
val shape = state.getCollisionShape(ply.level(), blockPos, CollisionContext.of(ply))
|
||||||
return Shapes.joinIsNotEmpty(shape, SHAPE_CHECK_SUPPORT_PLAYER, BooleanOp.AND)
|
return Shapes.joinIsNotEmpty(shape, SHAPE_CHECK_SUPPORT_PLAYER, BooleanOp.AND)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun isWall(blockPos: BlockPos): Boolean {
|
private fun isWall(blockPos: BlockPos): Boolean {
|
||||||
val shape = ply.level.getBlockState(blockPos).getCollisionShape(ply.level, blockPos, CollisionContext.of(ply))
|
val shape = ply.level().getBlockState(blockPos).getCollisionShape(ply.level(), blockPos, CollisionContext.of(ply))
|
||||||
return Shapes.joinIsNotEmpty(shape, SHAPE_CHECK_NOT_FENCE, BooleanOp.AND)
|
return Shapes.joinIsNotEmpty(shape, SHAPE_CHECK_NOT_FENCE, BooleanOp.AND)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun isAirGap(blockPos: BlockPos): Boolean {
|
private fun isAirGap(blockPos: BlockPos): Boolean {
|
||||||
val state = ply.level.getBlockState(blockPos)
|
val state = ply.level().getBlockState(blockPos)
|
||||||
|
|
||||||
if (state.isAir) {
|
if (state.isAir) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
val shape = state.getCollisionShape(ply.level, blockPos, CollisionContext.of(ply))
|
val shape = state.getCollisionShape(ply.level(), blockPos, CollisionContext.of(ply))
|
||||||
return shape.isEmpty || !Shapes.joinIsNotEmpty(shape, SHAPE_CHECK_SUPPORT_PLAYER, BooleanOp.AND)
|
return shape.isEmpty || !Shapes.joinIsNotEmpty(shape, SHAPE_CHECK_SUPPORT_PLAYER, BooleanOp.AND)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -143,7 +144,7 @@ class EnderTeleporterFeature(capability: MatteryPlayerCapability) : AndroidActiv
|
|||||||
val headPosition = ply.eyePosition
|
val headPosition = ply.eyePosition
|
||||||
val aimVector = ply.getViewVector(1f)
|
val aimVector = ply.getViewVector(1f)
|
||||||
|
|
||||||
val result = ply.level.clip(ClipContext(
|
val result = ply.level().clip(ClipContext(
|
||||||
headPosition,
|
headPosition,
|
||||||
headPosition + aimVector * (AndroidConfig.EnderTeleporter.MAX_DISTANCE * 2.0),
|
headPosition + aimVector * (AndroidConfig.EnderTeleporter.MAX_DISTANCE * 2.0),
|
||||||
ClipContext.Block.COLLIDER,
|
ClipContext.Block.COLLIDER,
|
||||||
@ -202,14 +203,14 @@ class EnderTeleporterFeature(capability: MatteryPlayerCapability) : AndroidActiv
|
|||||||
val searchDirection: IntProgression
|
val searchDirection: IntProgression
|
||||||
|
|
||||||
if (ply.isShiftKeyDown) {
|
if (ply.isShiftKeyDown) {
|
||||||
searchDirection = -1 downTo ply.level.minBuildHeight - ply.level.maxBuildHeight
|
searchDirection = -1 downTo ply.level().minBuildHeight - ply.level().maxBuildHeight
|
||||||
} else {
|
} else {
|
||||||
searchDirection = (if (ply.level.getBlockState(result.blockPos).`is`(BlockTags.CLIMBABLE)) -1 else 0) .. ply.level.maxBuildHeight - ply.level.minBuildHeight
|
searchDirection = (if (ply.level().getBlockState(result.blockPos).`is`(BlockTags.CLIMBABLE)) -1 else 0) .. ply.level().maxBuildHeight - ply.level().minBuildHeight
|
||||||
}
|
}
|
||||||
|
|
||||||
for (y in searchDirection) {
|
for (y in searchDirection) {
|
||||||
val pos = BlockPos(result.blockPos.x, result.blockPos.y + y + 1, result.blockPos.z)
|
val pos = BlockPos(result.blockPos.x, result.blockPos.y + y + 1, result.blockPos.z)
|
||||||
val state = ply.level.getBlockState(pos)
|
val state = ply.level().getBlockState(pos)
|
||||||
|
|
||||||
if (state.`is`(Blocks.BEDROCK)) {
|
if (state.`is`(Blocks.BEDROCK)) {
|
||||||
// Can't phase through bedrock
|
// Can't phase through bedrock
|
||||||
@ -261,9 +262,9 @@ class EnderTeleporterFeature(capability: MatteryPlayerCapability) : AndroidActiv
|
|||||||
phasedBlocks = 0
|
phasedBlocks = 0
|
||||||
phasedBlocksList.clear()
|
phasedBlocksList.clear()
|
||||||
|
|
||||||
for (y in 0 downTo ply.level.maxBuildHeight - ply.level.minBuildHeight) {
|
for (y in 0 downTo ply.level().maxBuildHeight - ply.level().minBuildHeight) {
|
||||||
val pos = BlockPos(result.blockPos.x, result.blockPos.y + y, result.blockPos.z)
|
val pos = BlockPos(result.blockPos.x, result.blockPos.y + y, result.blockPos.z)
|
||||||
val state = ply.level.getBlockState(pos)
|
val state = ply.level().getBlockState(pos)
|
||||||
|
|
||||||
if (state.`is`(Blocks.BEDROCK)) {
|
if (state.`is`(Blocks.BEDROCK)) {
|
||||||
// Can't phase through bedrock
|
// Can't phase through bedrock
|
||||||
@ -305,7 +306,7 @@ class EnderTeleporterFeature(capability: MatteryPlayerCapability) : AndroidActiv
|
|||||||
val event = ForgeEventFactory.onEnderTeleport(ply, blockPos.x + 0.5, blockPos.y.toDouble(), blockPos.z + 0.5)
|
val event = ForgeEventFactory.onEnderTeleport(ply, blockPos.x + 0.5, blockPos.y.toDouble(), blockPos.z + 0.5)
|
||||||
|
|
||||||
if (event.isCanceled) {
|
if (event.isCanceled) {
|
||||||
(ply as ServerPlayer).connection.send(ClientboundSoundEntityPacket(SoundEvents.ITEM_BREAK.holder, SoundSource.PLAYERS, ply, 0.3f, 0.5f, ply.level.random.nextLong()))
|
(ply as ServerPlayer).connection.send(ClientboundSoundEntityPacket(SoundEvents.ITEM_BREAK.holder, SoundSource.PLAYERS, ply, 0.3f, 0.5f, ply.level().random.nextLong()))
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -313,9 +314,9 @@ class EnderTeleporterFeature(capability: MatteryPlayerCapability) : AndroidActiv
|
|||||||
lastTeleport = ply.server!!.tickCount
|
lastTeleport = ply.server!!.tickCount
|
||||||
android.androidEnergy.extractEnergy(AndroidConfig.EnderTeleporter.ENERGY_COST, false)
|
android.androidEnergy.extractEnergy(AndroidConfig.EnderTeleporter.ENERGY_COST, false)
|
||||||
|
|
||||||
ply.level.playSound(null, ply, SoundEvents.ENDERMAN_TELEPORT, SoundSource.PLAYERS, 0.3f, 0.8f + ply.level.random.nextFloat() * 0.4f)
|
ply.level().playSound(null, ply, SoundEvents.ENDERMAN_TELEPORT, SoundSource.PLAYERS, 0.3f, 0.8f + ply.level().random.nextFloat() * 0.4f)
|
||||||
ply.teleportTo(event.targetX, event.targetY, event.targetZ)
|
ply.teleportTo(event.targetX, event.targetY, event.targetZ)
|
||||||
ply.level.playSound(null, ply, SoundEvents.ENDERMAN_TELEPORT, SoundSource.PLAYERS, 1f, 0.8f + ply.level.random.nextFloat() * 0.4f)
|
ply.level().playSound(null, ply, SoundEvents.ENDERMAN_TELEPORT, SoundSource.PLAYERS, 1f, 0.8f + ply.level().random.nextFloat() * 0.4f)
|
||||||
|
|
||||||
ply.deltaMovement = Vector(0.0, 0.0, 0.0)
|
ply.deltaMovement = Vector(0.0, 0.0, 0.0)
|
||||||
ply.resetFallDistance()
|
ply.resetFallDistance()
|
||||||
@ -355,8 +356,8 @@ class EnderTeleporterFeature(capability: MatteryPlayerCapability) : AndroidActiv
|
|||||||
val builder = source.getBuffer(linesIgnoreZRenderType)
|
val builder = source.getBuffer(linesIgnoreZRenderType)
|
||||||
|
|
||||||
for (blockPos in phasedBlocks) {
|
for (blockPos in phasedBlocks) {
|
||||||
val blockState = ply.level.getBlockState(blockPos)
|
val blockState = ply.level().getBlockState(blockPos)
|
||||||
val shape = blockState.getShape(ply.level, blockPos, collisionContext)
|
val shape = blockState.getShape(ply.level(), blockPos, collisionContext)
|
||||||
|
|
||||||
LevelRenderer.renderShape(
|
LevelRenderer.renderShape(
|
||||||
poseStack,
|
poseStack,
|
||||||
@ -376,12 +377,12 @@ class EnderTeleporterFeature(capability: MatteryPlayerCapability) : AndroidActiv
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun renderIcon(stack: PoseStack, x: Float, y: Float, width: Float, height: Float) {
|
override fun renderIcon(graphics: GuiGraphics, x: Float, y: Float, width: Float, height: Float) {
|
||||||
if (cooldown > 0) {
|
if (cooldown > 0) {
|
||||||
RenderSystem.setShaderColor(1f, 0.4f, 0.4f, 1f)
|
RenderSystem.setShaderColor(1f, 0.4f, 0.4f, 1f)
|
||||||
}
|
}
|
||||||
|
|
||||||
ResearchIcons.ICON_ENDER_TELEPORT.render(stack, x, y, width, height)
|
ResearchIcons.ICON_ENDER_TELEPORT.render(graphics, x, y, width, height)
|
||||||
|
|
||||||
if (cooldown > 0) {
|
if (cooldown > 0) {
|
||||||
RenderSystem.setShaderColor(1f, 1f, 1f, 1f)
|
RenderSystem.setShaderColor(1f, 1f, 1f, 1f)
|
||||||
|
@ -9,20 +9,20 @@ import java.util.*
|
|||||||
|
|
||||||
class ExtendedReachFeature(android: MatteryPlayerCapability) : AndroidFeature(AndroidFeatures.EXTENDED_REACH, android) {
|
class ExtendedReachFeature(android: MatteryPlayerCapability) : AndroidFeature(AndroidFeatures.EXTENDED_REACH, android) {
|
||||||
override fun applyModifiers() {
|
override fun applyModifiers() {
|
||||||
if (!ForgeMod.REACH_DISTANCE.isPresent)
|
if (!ForgeMod.BLOCK_REACH.isPresent)
|
||||||
return
|
return
|
||||||
|
|
||||||
val reach = ply.getAttribute(ForgeMod.REACH_DISTANCE.get()) ?: return
|
val reach = ply.getAttribute(ForgeMod.BLOCK_REACH.get()) ?: return
|
||||||
|
|
||||||
reach.removePermanentModifier(MODIFIER_ID)
|
reach.removePermanentModifier(MODIFIER_ID)
|
||||||
reach.addPermanentModifier(AttributeModifier(MODIFIER_ID, type.displayName.toString(), level + 1.0, AttributeModifier.Operation.ADDITION))
|
reach.addPermanentModifier(AttributeModifier(MODIFIER_ID, type.displayName.toString(), level + 1.0, AttributeModifier.Operation.ADDITION))
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun removeModifiers() {
|
override fun removeModifiers() {
|
||||||
if (!ForgeMod.REACH_DISTANCE.isPresent)
|
if (!ForgeMod.BLOCK_REACH.isPresent)
|
||||||
return
|
return
|
||||||
|
|
||||||
ply.getAttribute(ForgeMod.REACH_DISTANCE.get())?.removePermanentModifier(MODIFIER_ID)
|
ply.getAttribute(ForgeMod.BLOCK_REACH.get())?.removePermanentModifier(MODIFIER_ID)
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@ -2,6 +2,7 @@ package ru.dbotthepony.mc.otm.android.feature
|
|||||||
|
|
||||||
import com.mojang.blaze3d.vertex.PoseStack
|
import com.mojang.blaze3d.vertex.PoseStack
|
||||||
import net.minecraft.ChatFormatting
|
import net.minecraft.ChatFormatting
|
||||||
|
import net.minecraft.client.gui.GuiGraphics
|
||||||
import net.minecraft.client.multiplayer.ClientLevel
|
import net.minecraft.client.multiplayer.ClientLevel
|
||||||
import net.minecraft.network.FriendlyByteBuf
|
import net.minecraft.network.FriendlyByteBuf
|
||||||
import net.minecraft.resources.ResourceLocation
|
import net.minecraft.resources.ResourceLocation
|
||||||
@ -54,7 +55,7 @@ class ItemEntityDataPacket(val itemUUID: Int, val owner: UUID? = null, val age:
|
|||||||
|
|
||||||
override fun play(context: Supplier<NetworkEvent.Context>) {
|
override fun play(context: Supplier<NetworkEvent.Context>) {
|
||||||
context.packetHandled = true
|
context.packetHandled = true
|
||||||
val level = minecraft.player?.level as ClientLevel? ?: return
|
val level = minecraft.player?.level() as ClientLevel? ?: return
|
||||||
val entity = level.getEntity(itemUUID) as ItemEntity? ?: return
|
val entity = level.getEntity(itemUUID) as ItemEntity? ?: return
|
||||||
datatable[entity] = SharedItemEntityData(owner, age, lifespan, hasPickupDelay)
|
datatable[entity] = SharedItemEntityData(owner, age, lifespan, hasPickupDelay)
|
||||||
}
|
}
|
||||||
@ -78,7 +79,7 @@ class ItemMagnetFeature(capability: MatteryPlayerCapability) : AndroidSwitchable
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
val entities = ply.level.getEntitiesInEllipsoid(
|
val entities = ply.level().getEntitiesInEllipsoid(
|
||||||
ply.position,
|
ply.position,
|
||||||
Vector(AndroidConfig.Magnet.RADIUS_HORIZONTAL, AndroidConfig.Magnet.RADIUS_VERTICAL, AndroidConfig.Magnet.RADIUS_HORIZONTAL),
|
Vector(AndroidConfig.Magnet.RADIUS_HORIZONTAL, AndroidConfig.Magnet.RADIUS_VERTICAL, AndroidConfig.Magnet.RADIUS_HORIZONTAL),
|
||||||
if (server) Predicate<Entity> { it is ItemEntity } else clientPredicate
|
if (server) Predicate<Entity> { it is ItemEntity } else clientPredicate
|
||||||
@ -128,8 +129,8 @@ class ItemMagnetFeature(capability: MatteryPlayerCapability) : AndroidSwitchable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun renderIcon(stack: PoseStack, x: Float, y: Float, width: Float, height: Float) {
|
override fun renderIcon(graphics: GuiGraphics, x: Float, y: Float, width: Float, height: Float) {
|
||||||
ResearchIcons.ICON_ITEM_MAGNET.render(stack, x, y, width, height)
|
ResearchIcons.ICON_ITEM_MAGNET.render(graphics, x, y, width, height)
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@ -3,6 +3,7 @@ package ru.dbotthepony.mc.otm.android.feature
|
|||||||
import com.mojang.blaze3d.systems.RenderSystem
|
import com.mojang.blaze3d.systems.RenderSystem
|
||||||
import com.mojang.blaze3d.vertex.PoseStack
|
import com.mojang.blaze3d.vertex.PoseStack
|
||||||
import net.minecraft.ChatFormatting
|
import net.minecraft.ChatFormatting
|
||||||
|
import net.minecraft.client.gui.GuiGraphics
|
||||||
import net.minecraft.network.FriendlyByteBuf
|
import net.minecraft.network.FriendlyByteBuf
|
||||||
import net.minecraft.resources.ResourceLocation
|
import net.minecraft.resources.ResourceLocation
|
||||||
import net.minecraft.server.level.ServerPlayer
|
import net.minecraft.server.level.ServerPlayer
|
||||||
@ -51,7 +52,7 @@ object TriggerJumpBoostPacket : MatteryPacket {
|
|||||||
feature.putOnCooldown()
|
feature.putOnCooldown()
|
||||||
|
|
||||||
context.sender?.let {
|
context.sender?.let {
|
||||||
it.level.playSound(
|
it.level().playSound(
|
||||||
it,
|
it,
|
||||||
it,
|
it,
|
||||||
MSoundEvents.ANDROID_JUMP_BOOST,
|
MSoundEvents.ANDROID_JUMP_BOOST,
|
||||||
@ -89,14 +90,14 @@ class JumpBoostFeature(capability: MatteryPlayerCapability) : AndroidSwitchableF
|
|||||||
}
|
}
|
||||||
|
|
||||||
val old = lastGround
|
val old = lastGround
|
||||||
lastGround = ply.isOnGround
|
lastGround = ply.onGround()
|
||||||
|
|
||||||
if (isActive && cooldown <= 0 && old != lastGround && !lastGround && isJumping && isShifting && ply.xRot <= ClientConfig.JUMP_BOOST_LOOK_ANGLE && android.androidEnergy.extractEnergyExact(AndroidConfig.JumpBoost.ENERGY_COST, true)) {
|
if (isActive && cooldown <= 0 && old != lastGround && !lastGround && isJumping && isShifting && ply.xRot <= ClientConfig.JUMP_BOOST_LOOK_ANGLE && android.androidEnergy.extractEnergyExact(AndroidConfig.JumpBoost.ENERGY_COST, true)) {
|
||||||
ply.deltaMovement += Vector(0.0, AndroidConfig.JumpBoost.POWER * (level + 1) / 20.0, 0.0)
|
ply.deltaMovement += Vector(0.0, AndroidConfig.JumpBoost.POWER * (level + 1) / 20.0, 0.0)
|
||||||
putOnCooldown()
|
putOnCooldown()
|
||||||
MatteryPlayerNetworkChannel.sendToServer(TriggerJumpBoostPacket)
|
MatteryPlayerNetworkChannel.sendToServer(TriggerJumpBoostPacket)
|
||||||
|
|
||||||
ply.level.playSound(
|
ply.level().playSound(
|
||||||
ply,
|
ply,
|
||||||
ply,
|
ply,
|
||||||
MSoundEvents.ANDROID_JUMP_BOOST,
|
MSoundEvents.ANDROID_JUMP_BOOST,
|
||||||
@ -113,12 +114,12 @@ class JumpBoostFeature(capability: MatteryPlayerCapability) : AndroidSwitchableF
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun renderIcon(stack: PoseStack, x: Float, y: Float, width: Float, height: Float) {
|
override fun renderIcon(graphics: GuiGraphics, x: Float, y: Float, width: Float, height: Float) {
|
||||||
if (cooldown > 0) {
|
if (cooldown > 0) {
|
||||||
RenderSystem.setShaderColor(1f, 0.4f, 0.4f, 1f)
|
RenderSystem.setShaderColor(1f, 0.4f, 0.4f, 1f)
|
||||||
}
|
}
|
||||||
|
|
||||||
ResearchIcons.ICON_JUMP_BOOST.render(stack, x, y, width, height)
|
ResearchIcons.ICON_JUMP_BOOST.render(graphics, x, y, width, height)
|
||||||
|
|
||||||
if (cooldown > 0) {
|
if (cooldown > 0) {
|
||||||
RenderSystem.setShaderColor(1f, 1f, 1f, 1f)
|
RenderSystem.setShaderColor(1f, 1f, 1f, 1f)
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package ru.dbotthepony.mc.otm.android.feature
|
package ru.dbotthepony.mc.otm.android.feature
|
||||||
|
|
||||||
import com.mojang.blaze3d.vertex.PoseStack
|
import com.mojang.blaze3d.vertex.PoseStack
|
||||||
|
import net.minecraft.client.gui.GuiGraphics
|
||||||
import net.minecraft.world.effect.MobEffectInstance
|
import net.minecraft.world.effect.MobEffectInstance
|
||||||
import net.minecraft.world.effect.MobEffects
|
import net.minecraft.world.effect.MobEffects
|
||||||
import ru.dbotthepony.mc.otm.config.ServerConfig
|
import ru.dbotthepony.mc.otm.config.ServerConfig
|
||||||
@ -33,7 +34,7 @@ class NightVisionFeature(android: MatteryPlayerCapability) : AndroidSwitchableFe
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun renderIcon(stack: PoseStack, x: Float, y: Float, width: Float, height: Float) {
|
override fun renderIcon(graphics: GuiGraphics, x: Float, y: Float, width: Float, height: Float) {
|
||||||
ResearchIcons.ICON_NIGHT_VISION.render(stack, x, y, width, height)
|
ResearchIcons.ICON_NIGHT_VISION.render(graphics, x, y, width, height)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
package ru.dbotthepony.mc.otm.android.feature
|
package ru.dbotthepony.mc.otm.android.feature
|
||||||
|
|
||||||
import com.mojang.blaze3d.vertex.PoseStack
|
import com.mojang.blaze3d.vertex.PoseStack
|
||||||
|
import net.minecraft.client.gui.GuiGraphics
|
||||||
import ru.dbotthepony.mc.otm.android.AndroidSwitchableFeature
|
import ru.dbotthepony.mc.otm.android.AndroidSwitchableFeature
|
||||||
import ru.dbotthepony.mc.otm.capability.MatteryPlayerCapability
|
import ru.dbotthepony.mc.otm.capability.MatteryPlayerCapability
|
||||||
import ru.dbotthepony.mc.otm.client.render.ResearchIcons
|
import ru.dbotthepony.mc.otm.client.render.ResearchIcons
|
||||||
import ru.dbotthepony.mc.otm.registry.AndroidFeatures
|
import ru.dbotthepony.mc.otm.registry.AndroidFeatures
|
||||||
|
|
||||||
class PhantomAttractorFeature(android: MatteryPlayerCapability) : AndroidSwitchableFeature(AndroidFeatures.PHANTOM_ATTRACTOR, android) {
|
class PhantomAttractorFeature(android: MatteryPlayerCapability) : AndroidSwitchableFeature(AndroidFeatures.PHANTOM_ATTRACTOR, android) {
|
||||||
override fun renderIcon(stack: PoseStack, x: Float, y: Float, width: Float, height: Float) {
|
override fun renderIcon(graphics: GuiGraphics, x: Float, y: Float, width: Float, height: Float) {
|
||||||
ResearchIcons.ICON_PHANTOM_ATTRACTOR.render(stack, x, y, width, height)
|
ResearchIcons.ICON_PHANTOM_ATTRACTOR.render(graphics, x, y, width, height)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ import com.mojang.blaze3d.systems.RenderSystem
|
|||||||
import com.mojang.blaze3d.vertex.PoseStack
|
import com.mojang.blaze3d.vertex.PoseStack
|
||||||
import it.unimi.dsi.fastutil.objects.ReferenceArraySet
|
import it.unimi.dsi.fastutil.objects.ReferenceArraySet
|
||||||
import net.minecraft.ChatFormatting
|
import net.minecraft.ChatFormatting
|
||||||
|
import net.minecraft.client.gui.GuiGraphics
|
||||||
import net.minecraft.network.FriendlyByteBuf
|
import net.minecraft.network.FriendlyByteBuf
|
||||||
import net.minecraft.resources.ResourceLocation
|
import net.minecraft.resources.ResourceLocation
|
||||||
import net.minecraft.server.level.ServerPlayer
|
import net.minecraft.server.level.ServerPlayer
|
||||||
@ -107,7 +108,7 @@ class ShockwaveFeature(capability: MatteryPlayerCapability) : AndroidSwitchableF
|
|||||||
ShockwaveTrigger.trigger(ply as ServerPlayer)
|
ShockwaveTrigger.trigger(ply as ServerPlayer)
|
||||||
MatteryPlayerNetworkChannel.sendTrackingAndSelf(ply, ShockwaveEffectPacket(ply.position))
|
MatteryPlayerNetworkChannel.sendTrackingAndSelf(ply, ShockwaveEffectPacket(ply.position))
|
||||||
|
|
||||||
ply.level.playSound(
|
ply.level().playSound(
|
||||||
null,
|
null,
|
||||||
ply,
|
ply,
|
||||||
MSoundEvents.ANDROID_SHOCKWAVE,
|
MSoundEvents.ANDROID_SHOCKWAVE,
|
||||||
@ -118,13 +119,13 @@ class ShockwaveFeature(capability: MatteryPlayerCapability) : AndroidSwitchableF
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: raycasting
|
// TODO: raycasting
|
||||||
val entities = ply.level.getEntitiesInEllipsoid(
|
val entities = ply.level().getEntitiesInEllipsoid(
|
||||||
ply.position,
|
ply.position,
|
||||||
Vector(AndroidConfig.Shockwave.RADIUS_HORIZONTAL, AndroidConfig.Shockwave.RADIUS_VERTICAL, AndroidConfig.Shockwave.RADIUS_HORIZONTAL),
|
Vector(AndroidConfig.Shockwave.RADIUS_HORIZONTAL, AndroidConfig.Shockwave.RADIUS_VERTICAL, AndroidConfig.Shockwave.RADIUS_HORIZONTAL),
|
||||||
except = ply,
|
except = ply,
|
||||||
) { (it !is LivingEntity || !it.isSpectator && it.isAlive) }
|
) { (it !is LivingEntity || !it.isSpectator && it.isAlive) }
|
||||||
|
|
||||||
val wardens = ply.level.getEntitiesInEllipsoid(
|
val wardens = ply.level().getEntitiesInEllipsoid(
|
||||||
Warden::class.java,
|
Warden::class.java,
|
||||||
ply.position,
|
ply.position,
|
||||||
Vector(AndroidConfig.Shockwave.RADIUS_HORIZONTAL_WARDEN, AndroidConfig.Shockwave.RADIUS_VERTICAL_WARDEN, AndroidConfig.Shockwave.RADIUS_HORIZONTAL_WARDEN),
|
Vector(AndroidConfig.Shockwave.RADIUS_HORIZONTAL_WARDEN, AndroidConfig.Shockwave.RADIUS_VERTICAL_WARDEN, AndroidConfig.Shockwave.RADIUS_HORIZONTAL_WARDEN),
|
||||||
@ -136,7 +137,7 @@ class ShockwaveFeature(capability: MatteryPlayerCapability) : AndroidSwitchableF
|
|||||||
seen.add(entity)
|
seen.add(entity)
|
||||||
val multiplier = (1.0 - distanceMultiplier).pow(0.5)
|
val multiplier = (1.0 - distanceMultiplier).pow(0.5)
|
||||||
|
|
||||||
val source = MatteryDamageSource(ply.level.registryAccess().damageType(MDamageTypes.SHOCKWAVE), ply)
|
val source = MatteryDamageSource(ply.level().registryAccess().damageType(MDamageTypes.SHOCKWAVE), ply)
|
||||||
val damage = multiplier.toFloat() * AndroidConfig.Shockwave.DAMAGE.toFloat() * AndroidConfig.Shockwave.WARDEN_DAMAGE_MULT.toFloat()
|
val damage = multiplier.toFloat() * AndroidConfig.Shockwave.DAMAGE.toFloat() * AndroidConfig.Shockwave.WARDEN_DAMAGE_MULT.toFloat()
|
||||||
entity.hurt(source, damage)
|
entity.hurt(source, damage)
|
||||||
entity.deltaMovement += (entity.position - ply.position).normalize() * (multiplier * 3.0)
|
entity.deltaMovement += (entity.position - ply.position).normalize() * (multiplier * 3.0)
|
||||||
@ -152,7 +153,7 @@ class ShockwaveFeature(capability: MatteryPlayerCapability) : AndroidSwitchableF
|
|||||||
|
|
||||||
// don't hurt items, arrows, etc etc
|
// don't hurt items, arrows, etc etc
|
||||||
if (entity is LivingEntity) {
|
if (entity is LivingEntity) {
|
||||||
val source = MatteryDamageSource(ply.level.registryAccess().damageType(MDamageTypes.SHOCKWAVE), ply)
|
val source = MatteryDamageSource(ply.level().registryAccess().damageType(MDamageTypes.SHOCKWAVE), ply)
|
||||||
val damage = multiplier.toFloat() * AndroidConfig.Shockwave.DAMAGE.toFloat()
|
val damage = multiplier.toFloat() * AndroidConfig.Shockwave.DAMAGE.toFloat()
|
||||||
entity.hurt(source, damage)
|
entity.hurt(source, damage)
|
||||||
entity.deltaMovement += (entity.position - ply.position).normalize() * (multiplier * 3.0)
|
entity.deltaMovement += (entity.position - ply.position).normalize() * (multiplier * 3.0)
|
||||||
@ -172,21 +173,21 @@ class ShockwaveFeature(capability: MatteryPlayerCapability) : AndroidSwitchableF
|
|||||||
for (blockPos in getEllipsoidBlockPositions(AndroidConfig.Shockwave.RADIUS_HORIZONTAL.roundToInt(), AndroidConfig.Shockwave.RADIUS_VERTICAL.roundToInt(), AndroidConfig.Shockwave.RADIUS_HORIZONTAL.roundToInt())) {
|
for (blockPos in getEllipsoidBlockPositions(AndroidConfig.Shockwave.RADIUS_HORIZONTAL.roundToInt(), AndroidConfig.Shockwave.RADIUS_VERTICAL.roundToInt(), AndroidConfig.Shockwave.RADIUS_HORIZONTAL.roundToInt())) {
|
||||||
val newBlockPos = blockPos + rounded
|
val newBlockPos = blockPos + rounded
|
||||||
|
|
||||||
val blockState = ply.level.getBlockState(newBlockPos)
|
val blockState = ply.level().getBlockState(newBlockPos)
|
||||||
|
|
||||||
if (!blockState.isAir && blockState.getExplosionResistance(ply.level, newBlockPos) <= 0f && ply.level.getBlockEntity(newBlockPos) == null && blockState.block.defaultDestroyTime() >= 0f) {
|
if (!blockState.isAir && blockState.getExplosionResistance(ply.level(), newBlockPos) <= 0f && ply.level().getBlockEntity(newBlockPos) == null && blockState.block.defaultDestroyTime() >= 0f) {
|
||||||
// Block.dropResources(blockState, ply.level, newBlockPos)
|
// Block.dropResources(blockState, ply.level(), newBlockPos)
|
||||||
// blockState.block.destroy(ply.level, newBlockPos, blockState)
|
// blockState.block.destroy(ply.level(), newBlockPos, blockState)
|
||||||
// ply.level.setBlock(newBlockPos, blockState.fluidState.createLegacyBlock(), Block.UPDATE_ALL)
|
// ply.level().setBlock(newBlockPos, blockState.fluidState.createLegacyBlock(), Block.UPDATE_ALL)
|
||||||
|
|
||||||
ply.level.destroyBlock(newBlockPos, true)
|
ply.level().destroyBlock(newBlockPos, true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun ticker(isClient: Boolean) {
|
private fun ticker(isClient: Boolean) {
|
||||||
if (!ply.isOnGround || ply.isSpectator) {
|
if (!ply.onGround() || ply.isSpectator) {
|
||||||
airTicks = (airTicks + 1).coerceAtMost(3)
|
airTicks = (airTicks + 1).coerceAtMost(3)
|
||||||
} else {
|
} else {
|
||||||
airTicks = (airTicks - 1).coerceAtLeast(0)
|
airTicks = (airTicks - 1).coerceAtLeast(0)
|
||||||
@ -206,7 +207,7 @@ class ShockwaveFeature(capability: MatteryPlayerCapability) : AndroidSwitchableF
|
|||||||
creativeFlightTicks == 0
|
creativeFlightTicks == 0
|
||||||
) {
|
) {
|
||||||
val old = wasMidair
|
val old = wasMidair
|
||||||
wasMidair = !ply.isOnGround
|
wasMidair = !ply.onGround()
|
||||||
|
|
||||||
if (wasMidair) {
|
if (wasMidair) {
|
||||||
highestSpeed = (-ply.deltaMovement.y).coerceAtLeast(highestSpeed)
|
highestSpeed = (-ply.deltaMovement.y).coerceAtLeast(highestSpeed)
|
||||||
@ -239,12 +240,12 @@ class ShockwaveFeature(capability: MatteryPlayerCapability) : AndroidSwitchableF
|
|||||||
ticker(false)
|
ticker(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun renderIcon(stack: PoseStack, x: Float, y: Float, width: Float, height: Float) {
|
override fun renderIcon(graphics: GuiGraphics, x: Float, y: Float, width: Float, height: Float) {
|
||||||
if (isOnCooldown) {
|
if (isOnCooldown) {
|
||||||
RenderSystem.setShaderColor(1f, 0.4f, 0.4f, 1f)
|
RenderSystem.setShaderColor(1f, 0.4f, 0.4f, 1f)
|
||||||
}
|
}
|
||||||
|
|
||||||
ResearchIcons.ICON_SHOCKWAVE.render(stack, x, y, width, height)
|
ResearchIcons.ICON_SHOCKWAVE.render(graphics, x, y, width, height)
|
||||||
|
|
||||||
if (isOnCooldown) {
|
if (isOnCooldown) {
|
||||||
RenderSystem.setShaderColor(1f, 1f, 1f, 1f)
|
RenderSystem.setShaderColor(1f, 1f, 1f, 1f)
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package ru.dbotthepony.mc.otm.android.feature
|
package ru.dbotthepony.mc.otm.android.feature
|
||||||
|
|
||||||
import com.mojang.blaze3d.vertex.PoseStack
|
import com.mojang.blaze3d.vertex.PoseStack
|
||||||
|
import net.minecraft.client.gui.GuiGraphics
|
||||||
import net.minecraft.world.entity.ai.attributes.AttributeModifier
|
import net.minecraft.world.entity.ai.attributes.AttributeModifier
|
||||||
import net.minecraftforge.common.ForgeMod
|
import net.minecraftforge.common.ForgeMod
|
||||||
import ru.dbotthepony.mc.otm.android.AndroidSwitchableFeature
|
import ru.dbotthepony.mc.otm.android.AndroidSwitchableFeature
|
||||||
@ -53,8 +54,8 @@ class StepAssistFeature(android: MatteryPlayerCapability) : AndroidSwitchableFea
|
|||||||
sharedTick()
|
sharedTick()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun renderIcon(stack: PoseStack, x: Float, y: Float, width: Float, height: Float) {
|
override fun renderIcon(graphics: GuiGraphics, x: Float, y: Float, width: Float, height: Float) {
|
||||||
ResearchIcons.ICON_STEP_ASSIST.render(stack, x, y, width, height)
|
ResearchIcons.ICON_STEP_ASSIST.render(graphics, x, y, width, height)
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@ -5,11 +5,13 @@ import net.minecraft.world.level.BlockGetter
|
|||||||
import net.minecraft.world.level.Level
|
import net.minecraft.world.level.Level
|
||||||
import net.minecraft.world.level.block.Block
|
import net.minecraft.world.level.block.Block
|
||||||
import net.minecraft.world.level.block.EntityBlock
|
import net.minecraft.world.level.block.EntityBlock
|
||||||
|
import net.minecraft.world.level.block.SoundType
|
||||||
import net.minecraft.world.level.block.entity.BlockEntity
|
import net.minecraft.world.level.block.entity.BlockEntity
|
||||||
import net.minecraft.world.level.block.entity.BlockEntityTicker
|
import net.minecraft.world.level.block.entity.BlockEntityTicker
|
||||||
import net.minecraft.world.level.block.entity.BlockEntityType
|
import net.minecraft.world.level.block.entity.BlockEntityType
|
||||||
import net.minecraft.world.level.block.state.BlockState
|
import net.minecraft.world.level.block.state.BlockState
|
||||||
import net.minecraft.world.level.material.Material
|
import net.minecraft.world.level.material.MapColor
|
||||||
|
import net.minecraft.world.level.material.PushReaction
|
||||||
import net.minecraft.world.phys.shapes.CollisionContext
|
import net.minecraft.world.phys.shapes.CollisionContext
|
||||||
import net.minecraft.world.phys.shapes.VoxelShape
|
import net.minecraft.world.phys.shapes.VoxelShape
|
||||||
import ru.dbotthepony.mc.otm.block.entity.blackhole.BlackHoleBlockEntity
|
import ru.dbotthepony.mc.otm.block.entity.blackhole.BlackHoleBlockEntity
|
||||||
@ -17,7 +19,7 @@ import ru.dbotthepony.mc.otm.registry.MBlockEntities
|
|||||||
import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
||||||
|
|
||||||
class BlackHoleBlock :
|
class BlackHoleBlock :
|
||||||
Block(Properties.of(Material.STONE).strength(-1f, 7200000.0f)), EntityBlock {
|
Block(Properties.of().mapColor(MapColor.COLOR_BLACK).noCollission().pushReaction(PushReaction.BLOCK).sound(SoundType.STONE).strength(-1f, 7200000.0f)), EntityBlock {
|
||||||
override fun getShape(
|
override fun getShape(
|
||||||
p_60555_: BlockState,
|
p_60555_: BlockState,
|
||||||
p_60556_: BlockGetter,
|
p_60556_: BlockGetter,
|
||||||
|
@ -8,12 +8,12 @@ import net.minecraft.core.Direction
|
|||||||
import net.minecraft.world.level.BlockGetter
|
import net.minecraft.world.level.BlockGetter
|
||||||
import net.minecraft.world.level.block.Block
|
import net.minecraft.world.level.block.Block
|
||||||
import net.minecraft.world.level.block.EntityBlock
|
import net.minecraft.world.level.block.EntityBlock
|
||||||
|
import net.minecraft.world.level.block.SoundType
|
||||||
import net.minecraft.world.level.block.entity.BlockEntity
|
import net.minecraft.world.level.block.entity.BlockEntity
|
||||||
import net.minecraft.world.level.block.state.BlockState
|
import net.minecraft.world.level.block.state.BlockState
|
||||||
import net.minecraft.world.level.block.state.StateDefinition
|
import net.minecraft.world.level.block.state.StateDefinition
|
||||||
import net.minecraft.world.level.block.state.properties.BooleanProperty
|
import net.minecraft.world.level.block.state.properties.BooleanProperty
|
||||||
import net.minecraft.world.level.material.Material
|
import net.minecraft.world.level.material.MapColor
|
||||||
import net.minecraft.world.level.material.MaterialColor
|
|
||||||
import net.minecraft.world.phys.shapes.BooleanOp
|
import net.minecraft.world.phys.shapes.BooleanOp
|
||||||
import net.minecraft.world.phys.shapes.CollisionContext
|
import net.minecraft.world.phys.shapes.CollisionContext
|
||||||
import net.minecraft.world.phys.shapes.Shapes
|
import net.minecraft.world.phys.shapes.Shapes
|
||||||
@ -70,7 +70,7 @@ abstract class CableBlock(properties: Properties) : Block(properties) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class MatterCableBlock : CableBlock(
|
class MatterCableBlock : CableBlock(
|
||||||
Properties.of(Material.STONE, MaterialColor.METAL).requiresCorrectToolForDrops().strength(1.0f, 6.0f)),
|
Properties.of().mapColor(MapColor.METAL).requiresCorrectToolForDrops().sound(SoundType.METAL).strength(1.0f, 6.0f)),
|
||||||
EntityBlock {
|
EntityBlock {
|
||||||
private val CORE_SHAPE: VoxelShape = Shapes.box(
|
private val CORE_SHAPE: VoxelShape = Shapes.box(
|
||||||
0.5 - 0.15,
|
0.5 - 0.15,
|
||||||
@ -188,7 +188,7 @@ class MatterCableBlock : CableBlock(
|
|||||||
}
|
}
|
||||||
|
|
||||||
class StorageCableBlock : CableBlock(
|
class StorageCableBlock : CableBlock(
|
||||||
Properties.of(Material.STONE, MaterialColor.METAL).requiresCorrectToolForDrops().strength(1.0f, 6.0f)),
|
Properties.of().mapColor(MapColor.METAL).requiresCorrectToolForDrops().sound(SoundType.METAL).strength(1.0f, 6.0f)),
|
||||||
EntityBlock {
|
EntityBlock {
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@ -4,16 +4,16 @@ import net.minecraft.core.BlockPos
|
|||||||
import net.minecraft.world.level.Level
|
import net.minecraft.world.level.Level
|
||||||
import net.minecraft.world.level.block.Block
|
import net.minecraft.world.level.block.Block
|
||||||
import net.minecraft.world.level.block.EntityBlock
|
import net.minecraft.world.level.block.EntityBlock
|
||||||
|
import net.minecraft.world.level.block.SoundType
|
||||||
import net.minecraft.world.level.block.entity.BlockEntity
|
import net.minecraft.world.level.block.entity.BlockEntity
|
||||||
import net.minecraft.world.level.block.entity.BlockEntityTicker
|
import net.minecraft.world.level.block.entity.BlockEntityTicker
|
||||||
import net.minecraft.world.level.block.entity.BlockEntityType
|
import net.minecraft.world.level.block.entity.BlockEntityType
|
||||||
import net.minecraft.world.level.block.state.BlockState
|
import net.minecraft.world.level.block.state.BlockState
|
||||||
import net.minecraft.world.level.material.Material
|
|
||||||
import ru.dbotthepony.mc.otm.block.entity.blackhole.BlockEntityExplosionDebugger
|
import ru.dbotthepony.mc.otm.block.entity.blackhole.BlockEntityExplosionDebugger
|
||||||
import ru.dbotthepony.mc.otm.block.entity.blackhole.BlockEntitySphereDebugger
|
import ru.dbotthepony.mc.otm.block.entity.blackhole.BlockEntitySphereDebugger
|
||||||
import ru.dbotthepony.mc.otm.registry.MBlockEntities
|
import ru.dbotthepony.mc.otm.registry.MBlockEntities
|
||||||
|
|
||||||
class BlockExplosionDebugger : Block(Properties.of(Material.STONE)), EntityBlock {
|
class BlockExplosionDebugger : Block(Properties.of().sound(SoundType.STONE)), EntityBlock {
|
||||||
override fun newBlockEntity(p_153215_: BlockPos, p_153216_: BlockState): BlockEntity {
|
override fun newBlockEntity(p_153215_: BlockPos, p_153216_: BlockState): BlockEntity {
|
||||||
return BlockEntityExplosionDebugger(p_153215_, p_153216_)
|
return BlockEntityExplosionDebugger(p_153215_, p_153216_)
|
||||||
}
|
}
|
||||||
@ -31,7 +31,7 @@ class BlockExplosionDebugger : Block(Properties.of(Material.STONE)), EntityBlock
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class BlockSphereDebugger : Block(Properties.of(Material.STONE)), EntityBlock {
|
class BlockSphereDebugger : Block(Properties.of()), EntityBlock {
|
||||||
override fun newBlockEntity(p_153215_: BlockPos, p_153216_: BlockState): BlockEntity {
|
override fun newBlockEntity(p_153215_: BlockPos, p_153216_: BlockState): BlockEntity {
|
||||||
return BlockEntitySphereDebugger(p_153215_, p_153216_)
|
return BlockEntitySphereDebugger(p_153215_, p_153216_)
|
||||||
}
|
}
|
||||||
|
@ -19,8 +19,7 @@ import net.minecraft.world.level.block.Block
|
|||||||
import net.minecraft.world.level.block.EntityBlock
|
import net.minecraft.world.level.block.EntityBlock
|
||||||
import net.minecraft.world.level.block.state.BlockState
|
import net.minecraft.world.level.block.state.BlockState
|
||||||
import net.minecraft.world.level.block.state.properties.Property
|
import net.minecraft.world.level.block.state.properties.Property
|
||||||
import net.minecraft.world.level.material.Material
|
import net.minecraft.world.level.material.MapColor
|
||||||
import net.minecraft.world.level.material.MaterialColor
|
|
||||||
import net.minecraft.world.phys.BlockHitResult
|
import net.minecraft.world.phys.BlockHitResult
|
||||||
import net.minecraft.world.phys.shapes.VoxelShape
|
import net.minecraft.world.phys.shapes.VoxelShape
|
||||||
import ru.dbotthepony.mc.otm.SERVER_IS_LIVE
|
import ru.dbotthepony.mc.otm.SERVER_IS_LIVE
|
||||||
@ -225,7 +224,7 @@ abstract class MatteryBlock @JvmOverloads constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
val DEFAULT_PROPERTIES: Properties = Properties.of(Material.STONE, MaterialColor.METAL).requiresCorrectToolForDrops().destroyTime(1.5f).explosionResistance(25.0f)
|
val DEFAULT_PROPERTIES: Properties = Properties.of().mapColor(MapColor.METAL).requiresCorrectToolForDrops().destroyTime(1.5f).explosionResistance(25.0f)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,12 +8,12 @@ import net.minecraft.world.level.BlockGetter
|
|||||||
import net.minecraft.world.level.Level
|
import net.minecraft.world.level.Level
|
||||||
import net.minecraft.world.level.block.Block
|
import net.minecraft.world.level.block.Block
|
||||||
import net.minecraft.world.level.block.EntityBlock
|
import net.minecraft.world.level.block.EntityBlock
|
||||||
|
import net.minecraft.world.level.block.SoundType
|
||||||
import net.minecraft.world.level.block.entity.BlockEntity
|
import net.minecraft.world.level.block.entity.BlockEntity
|
||||||
import net.minecraft.world.level.block.state.BlockState
|
import net.minecraft.world.level.block.state.BlockState
|
||||||
import net.minecraft.world.level.block.state.StateDefinition
|
import net.minecraft.world.level.block.state.StateDefinition
|
||||||
import net.minecraft.world.level.block.state.properties.BooleanProperty
|
import net.minecraft.world.level.block.state.properties.BooleanProperty
|
||||||
import net.minecraft.world.level.material.Material
|
import net.minecraft.world.level.material.MapColor
|
||||||
import net.minecraft.world.level.material.MaterialColor
|
|
||||||
import net.minecraft.world.phys.shapes.CollisionContext
|
import net.minecraft.world.phys.shapes.CollisionContext
|
||||||
import net.minecraft.world.phys.shapes.Shapes
|
import net.minecraft.world.phys.shapes.Shapes
|
||||||
import net.minecraft.world.phys.shapes.VoxelShape
|
import net.minecraft.world.phys.shapes.VoxelShape
|
||||||
@ -23,7 +23,7 @@ import ru.dbotthepony.mc.otm.core.get
|
|||||||
import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
||||||
|
|
||||||
class CargoCrateBlock(val color: DyeColor?) : RotatableMatteryBlock(
|
class CargoCrateBlock(val color: DyeColor?) : RotatableMatteryBlock(
|
||||||
Properties.of(Material.STONE, color?.materialColor ?: MaterialColor.COLOR_BLUE).requiresCorrectToolForDrops().strength(1.5f, 30.0f)
|
Properties.of().mapColor(color?.mapColor ?: MapColor.COLOR_BLUE).requiresCorrectToolForDrops().sound(SoundType.METAL).strength(1.5f, 30.0f)
|
||||||
), EntityBlock {
|
), EntityBlock {
|
||||||
override fun newBlockEntity(blockPos: BlockPos, blockState: BlockState): BlockEntity {
|
override fun newBlockEntity(blockPos: BlockPos, blockState: BlockState): BlockEntity {
|
||||||
return CargoCrateBlockEntity(blockPos, blockState)
|
return CargoCrateBlockEntity(blockPos, blockState)
|
||||||
|
@ -7,8 +7,9 @@ import net.minecraft.world.item.DyeColor
|
|||||||
import net.minecraft.world.item.ItemStack
|
import net.minecraft.world.item.ItemStack
|
||||||
import net.minecraft.world.item.TooltipFlag
|
import net.minecraft.world.item.TooltipFlag
|
||||||
import net.minecraft.world.level.BlockGetter
|
import net.minecraft.world.level.BlockGetter
|
||||||
|
import net.minecraft.world.level.block.SoundType
|
||||||
import net.minecraft.world.level.block.state.BlockState
|
import net.minecraft.world.level.block.state.BlockState
|
||||||
import net.minecraft.world.level.material.Material
|
import net.minecraft.world.level.material.MapColor
|
||||||
import net.minecraft.world.phys.shapes.CollisionContext
|
import net.minecraft.world.phys.shapes.CollisionContext
|
||||||
import net.minecraft.world.phys.shapes.VoxelShape
|
import net.minecraft.world.phys.shapes.VoxelShape
|
||||||
import ru.dbotthepony.mc.otm.block.RotatableMatteryBlock
|
import ru.dbotthepony.mc.otm.block.RotatableMatteryBlock
|
||||||
@ -17,7 +18,7 @@ import ru.dbotthepony.mc.otm.core.get
|
|||||||
import ru.dbotthepony.mc.otm.core.math.BlockRotationFreedom
|
import ru.dbotthepony.mc.otm.core.math.BlockRotationFreedom
|
||||||
import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
||||||
|
|
||||||
class EngineBlock : RotatableMatteryBlock(Properties.of(Material.METAL, DyeColor.ORANGE).explosionResistance(14f).destroyTime(2.5f).requiresCorrectToolForDrops()) {
|
class EngineBlock : RotatableMatteryBlock(Properties.of().mapColor(MapColor.COLOR_ORANGE).sound(SoundType.METAL).explosionResistance(14f).destroyTime(2.5f).requiresCorrectToolForDrops()) {
|
||||||
override fun appendHoverText(
|
override fun appendHoverText(
|
||||||
p_49816_: ItemStack,
|
p_49816_: ItemStack,
|
||||||
p_49817_: BlockGetter?,
|
p_49817_: BlockGetter?,
|
||||||
|
@ -9,14 +9,11 @@ import net.minecraft.world.item.TooltipFlag
|
|||||||
import net.minecraft.world.item.context.BlockPlaceContext
|
import net.minecraft.world.item.context.BlockPlaceContext
|
||||||
import net.minecraft.world.level.BlockGetter
|
import net.minecraft.world.level.BlockGetter
|
||||||
import net.minecraft.world.level.Level
|
import net.minecraft.world.level.Level
|
||||||
import net.minecraft.world.level.block.Block
|
import net.minecraft.world.level.block.*
|
||||||
import net.minecraft.world.level.block.Blocks
|
|
||||||
import net.minecraft.world.level.block.RenderShape
|
|
||||||
import net.minecraft.world.level.block.Rotation
|
|
||||||
import net.minecraft.world.level.block.state.BlockState
|
import net.minecraft.world.level.block.state.BlockState
|
||||||
import net.minecraft.world.level.block.state.StateDefinition
|
import net.minecraft.world.level.block.state.StateDefinition
|
||||||
import net.minecraft.world.level.block.state.properties.BlockStateProperties
|
import net.minecraft.world.level.block.state.properties.BlockStateProperties
|
||||||
import net.minecraft.world.level.material.Material
|
import net.minecraft.world.level.material.MapColor
|
||||||
import net.minecraft.world.phys.shapes.CollisionContext
|
import net.minecraft.world.phys.shapes.CollisionContext
|
||||||
import net.minecraft.world.phys.shapes.Shapes
|
import net.minecraft.world.phys.shapes.Shapes
|
||||||
import net.minecraft.world.phys.shapes.VoxelShape
|
import net.minecraft.world.phys.shapes.VoxelShape
|
||||||
@ -32,7 +29,7 @@ import ru.dbotthepony.mc.otm.registry.MBlocks
|
|||||||
|
|
||||||
private val FACING_FULL = BlockRotationFreedom.TWO.property
|
private val FACING_FULL = BlockRotationFreedom.TWO.property
|
||||||
|
|
||||||
class LaboratoryLampLight : Block(Properties.of(Material.AIR).strength(-1.0F, 3600000.8F).noLootTable().noOcclusion().lightLevel { 15 }) {
|
class LaboratoryLampLight : Block(Properties.of().strength(-1.0F, 3600000.8F).noCollission().noLootTable().replaceable().lightLevel { 15 }) {
|
||||||
override fun createBlockStateDefinition(builder: StateDefinition.Builder<Block, BlockState>) {
|
override fun createBlockStateDefinition(builder: StateDefinition.Builder<Block, BlockState>) {
|
||||||
super.createBlockStateDefinition(builder)
|
super.createBlockStateDefinition(builder)
|
||||||
builder.add(FACING_FULL)
|
builder.add(FACING_FULL)
|
||||||
@ -106,7 +103,7 @@ class LaboratoryLampLight : Block(Properties.of(Material.AIR).strength(-1.0F, 36
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class LaboratoryLamp(val invertRedstone: Boolean) : Block(Properties.of(Material.METAL).explosionResistance(12f).destroyTime(2f).requiresCorrectToolForDrops()) {
|
class LaboratoryLamp(val invertRedstone: Boolean) : Block(Properties.of().mapColor(MapColor.METAL).sound(SoundType.METAL).explosionResistance(12f).destroyTime(2f).requiresCorrectToolForDrops()) {
|
||||||
init {
|
init {
|
||||||
registerDefaultState(stateDefinition.any().setValue(BlockStateProperties.LIT, !invertRedstone))
|
registerDefaultState(stateDefinition.any().setValue(BlockStateProperties.LIT, !invertRedstone))
|
||||||
}
|
}
|
||||||
|
@ -14,15 +14,15 @@ import net.minecraft.world.level.Level
|
|||||||
import net.minecraft.world.level.LevelAccessor
|
import net.minecraft.world.level.LevelAccessor
|
||||||
import net.minecraft.world.level.block.BasePressurePlateBlock
|
import net.minecraft.world.level.block.BasePressurePlateBlock
|
||||||
import net.minecraft.world.level.block.Block
|
import net.minecraft.world.level.block.Block
|
||||||
|
import net.minecraft.world.level.block.SoundType
|
||||||
import net.minecraft.world.level.block.state.BlockState
|
import net.minecraft.world.level.block.state.BlockState
|
||||||
import net.minecraft.world.level.block.state.StateDefinition
|
import net.minecraft.world.level.block.state.StateDefinition
|
||||||
import net.minecraft.world.level.block.state.properties.BlockSetType
|
import net.minecraft.world.level.block.state.properties.BlockSetType
|
||||||
import net.minecraft.world.level.block.state.properties.BlockStateProperties
|
import net.minecraft.world.level.block.state.properties.BlockStateProperties
|
||||||
import net.minecraft.world.level.material.Material
|
|
||||||
import ru.dbotthepony.mc.otm.core.TranslatableComponent
|
import ru.dbotthepony.mc.otm.core.TranslatableComponent
|
||||||
import ru.dbotthepony.mc.otm.core.get
|
import ru.dbotthepony.mc.otm.core.get
|
||||||
|
|
||||||
class TritaniumPressurePlate(color: DyeColor?) : BasePressurePlateBlock(Properties.of(Material.METAL, color ?: DyeColor.LIGHT_BLUE).explosionResistance(80f).noOcclusion().destroyTime(3f).requiresCorrectToolForDrops(), BlockSetType.IRON) {
|
class TritaniumPressurePlate(color: DyeColor?) : BasePressurePlateBlock(Properties.of().mapColor(color ?: DyeColor.LIGHT_BLUE).sound(SoundType.METAL).explosionResistance(80f).noOcclusion().destroyTime(3f).requiresCorrectToolForDrops(), BlockSetType.IRON) {
|
||||||
override fun appendHoverText(
|
override fun appendHoverText(
|
||||||
p_49816_: ItemStack,
|
p_49816_: ItemStack,
|
||||||
p_49817_: BlockGetter?,
|
p_49817_: BlockGetter?,
|
||||||
|
@ -21,6 +21,7 @@ import net.minecraft.world.level.block.Block
|
|||||||
import net.minecraft.world.level.block.state.BlockState
|
import net.minecraft.world.level.block.state.BlockState
|
||||||
import net.minecraft.world.level.gameevent.GameEvent
|
import net.minecraft.world.level.gameevent.GameEvent
|
||||||
import net.minecraft.world.level.storage.loot.LootContext
|
import net.minecraft.world.level.storage.loot.LootContext
|
||||||
|
import net.minecraft.world.level.storage.loot.LootParams
|
||||||
import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets
|
import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets
|
||||||
import net.minecraft.world.level.storage.loot.parameters.LootContextParams
|
import net.minecraft.world.level.storage.loot.parameters.LootContextParams
|
||||||
import net.minecraft.world.phys.Vec3
|
import net.minecraft.world.phys.Vec3
|
||||||
@ -104,7 +105,7 @@ class CargoCrateBlockEntity(
|
|||||||
val lootTableSeed = lootTableSeed ?: 0L
|
val lootTableSeed = lootTableSeed ?: 0L
|
||||||
val server = level?.server ?: return
|
val server = level?.server ?: return
|
||||||
|
|
||||||
val loot = server.lootTables.get(lootTable)
|
val loot = server.lootData.getLootTable(lootTable)
|
||||||
|
|
||||||
if (ply is ServerPlayer) {
|
if (ply is ServerPlayer) {
|
||||||
CriteriaTriggers.GENERATE_LOOT.trigger(ply, lootTable)
|
CriteriaTriggers.GENERATE_LOOT.trigger(ply, lootTable)
|
||||||
@ -113,16 +114,15 @@ class CargoCrateBlockEntity(
|
|||||||
this.lootTable = null
|
this.lootTable = null
|
||||||
this.lootTableSeed = null
|
this.lootTableSeed = null
|
||||||
|
|
||||||
val context = LootContext.Builder(level as ServerLevel)
|
val params = LootParams.Builder(level as ServerLevel)
|
||||||
.withParameter(LootContextParams.ORIGIN, Vec3.atCenterOf(this.worldPosition))
|
.withParameter(LootContextParams.ORIGIN, Vec3.atCenterOf(this.worldPosition))
|
||||||
.withOptionalRandomSeed(lootTableSeed)
|
|
||||||
|
|
||||||
if (ply != null) {
|
if (ply != null) {
|
||||||
context.withLuck(ply.luck).withParameter(LootContextParams.THIS_ENTITY, ply)
|
params.withLuck(ply.luck).withParameter(LootContextParams.THIS_ENTITY, ply)
|
||||||
}
|
}
|
||||||
|
|
||||||
Containers.dropContents(level as ServerLevel, blockPos, container)
|
Containers.dropContents(level as ServerLevel, blockPos, container)
|
||||||
loot.fill(container, context.create(LootContextParamSets.CHEST))
|
loot.fill(container, params.create(LootContextParamSets.CHEST), lootTableSeed)
|
||||||
}
|
}
|
||||||
|
|
||||||
override val defaultDisplayName: Component
|
override val defaultDisplayName: Component
|
||||||
|
@ -13,6 +13,7 @@ import net.minecraft.world.entity.player.Inventory
|
|||||||
import net.minecraft.world.entity.player.Player
|
import net.minecraft.world.entity.player.Player
|
||||||
import net.minecraft.world.inventory.AbstractContainerMenu
|
import net.minecraft.world.inventory.AbstractContainerMenu
|
||||||
import net.minecraft.world.inventory.CraftingContainer
|
import net.minecraft.world.inventory.CraftingContainer
|
||||||
|
import net.minecraft.world.inventory.TransientCraftingContainer
|
||||||
import net.minecraft.world.item.ItemStack
|
import net.minecraft.world.item.ItemStack
|
||||||
import net.minecraft.world.item.crafting.CraftingRecipe
|
import net.minecraft.world.item.crafting.CraftingRecipe
|
||||||
import net.minecraft.world.item.crafting.RecipeType
|
import net.minecraft.world.item.crafting.RecipeType
|
||||||
@ -266,7 +267,7 @@ class ItemMonitorBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private val craftingGridDummy = CraftingContainer(craftingMenu, 3, 3)
|
private val craftingGridDummy = TransientCraftingContainer(craftingMenu, 3, 3)
|
||||||
|
|
||||||
override val storageType: StorageStackType<ItemStackWrapper>
|
override val storageType: StorageStackType<ItemStackWrapper>
|
||||||
get() = ITEM_STORAGE
|
get() = ITEM_STORAGE
|
||||||
|
@ -35,7 +35,7 @@ class PlatePressBlockEntity(
|
|||||||
|
|
||||||
if (whole > 0) {
|
if (whole > 0) {
|
||||||
experience -= whole
|
experience -= whole
|
||||||
ExperienceOrb.award(player.level as ServerLevel, player.position(), whole)
|
ExperienceOrb.award(player.level() as ServerLevel, player.position(), whole)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,12 +5,12 @@ import net.minecraft.core.Direction
|
|||||||
import net.minecraft.world.level.BlockGetter
|
import net.minecraft.world.level.BlockGetter
|
||||||
import net.minecraft.world.level.Level
|
import net.minecraft.world.level.Level
|
||||||
import net.minecraft.world.level.block.EntityBlock
|
import net.minecraft.world.level.block.EntityBlock
|
||||||
|
import net.minecraft.world.level.block.SoundType
|
||||||
import net.minecraft.world.level.block.entity.BlockEntity
|
import net.minecraft.world.level.block.entity.BlockEntity
|
||||||
import net.minecraft.world.level.block.entity.BlockEntityTicker
|
import net.minecraft.world.level.block.entity.BlockEntityTicker
|
||||||
import net.minecraft.world.level.block.entity.BlockEntityType
|
import net.minecraft.world.level.block.entity.BlockEntityType
|
||||||
import net.minecraft.world.level.block.state.BlockState
|
import net.minecraft.world.level.block.state.BlockState
|
||||||
import net.minecraft.world.level.material.Material
|
import net.minecraft.world.level.material.MapColor
|
||||||
import net.minecraft.world.level.material.MaterialColor
|
|
||||||
import net.minecraft.world.phys.shapes.CollisionContext
|
import net.minecraft.world.phys.shapes.CollisionContext
|
||||||
import net.minecraft.world.phys.shapes.VoxelShape
|
import net.minecraft.world.phys.shapes.VoxelShape
|
||||||
import ru.dbotthepony.mc.otm.block.RotatableMatteryBlock
|
import ru.dbotthepony.mc.otm.block.RotatableMatteryBlock
|
||||||
@ -21,7 +21,7 @@ import ru.dbotthepony.mc.otm.core.math.facingOne
|
|||||||
import ru.dbotthepony.mc.otm.registry.MBlockEntities
|
import ru.dbotthepony.mc.otm.registry.MBlockEntities
|
||||||
import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
||||||
|
|
||||||
class EnergyServoBlock : RotatableMatteryBlock(Properties.of(Material.METAL, MaterialColor.COLOR_BLUE).explosionResistance(12f).destroyTime(2f).requiresCorrectToolForDrops()), EntityBlock {
|
class EnergyServoBlock : RotatableMatteryBlock(Properties.of().mapColor(MapColor.COLOR_BLUE).sound(SoundType.METAL).explosionResistance(12f).destroyTime(2f).requiresCorrectToolForDrops()), EntityBlock {
|
||||||
override fun newBlockEntity(p_153215_: BlockPos, p_153216_: BlockState): BlockEntity {
|
override fun newBlockEntity(p_153215_: BlockPos, p_153216_: BlockState): BlockEntity {
|
||||||
return EnergyServoBlockEntity(p_153215_, p_153216_)
|
return EnergyServoBlockEntity(p_153215_, p_153216_)
|
||||||
}
|
}
|
||||||
|
@ -11,14 +11,14 @@ import net.minecraft.world.level.Level
|
|||||||
import net.minecraft.world.level.block.Block
|
import net.minecraft.world.level.block.Block
|
||||||
import net.minecraft.world.level.block.Blocks
|
import net.minecraft.world.level.block.Blocks
|
||||||
import net.minecraft.world.level.block.EntityBlock
|
import net.minecraft.world.level.block.EntityBlock
|
||||||
|
import net.minecraft.world.level.block.SoundType
|
||||||
import net.minecraft.world.level.block.entity.BlockEntity
|
import net.minecraft.world.level.block.entity.BlockEntity
|
||||||
import net.minecraft.world.level.block.entity.BlockEntityTicker
|
import net.minecraft.world.level.block.entity.BlockEntityTicker
|
||||||
import net.minecraft.world.level.block.entity.BlockEntityType
|
import net.minecraft.world.level.block.entity.BlockEntityType
|
||||||
import net.minecraft.world.level.block.state.BlockBehaviour
|
import net.minecraft.world.level.block.state.BlockBehaviour
|
||||||
import net.minecraft.world.level.block.state.BlockState
|
import net.minecraft.world.level.block.state.BlockState
|
||||||
import net.minecraft.world.level.block.state.StateDefinition
|
import net.minecraft.world.level.block.state.StateDefinition
|
||||||
import net.minecraft.world.level.material.Material
|
import net.minecraft.world.level.material.MapColor
|
||||||
import net.minecraft.world.level.material.MaterialColor
|
|
||||||
import net.minecraft.world.level.material.PushReaction
|
import net.minecraft.world.level.material.PushReaction
|
||||||
import net.minecraft.world.phys.shapes.CollisionContext
|
import net.minecraft.world.phys.shapes.CollisionContext
|
||||||
import net.minecraft.world.phys.shapes.VoxelShape
|
import net.minecraft.world.phys.shapes.VoxelShape
|
||||||
@ -36,7 +36,7 @@ import ru.dbotthepony.mc.otm.registry.MBlocks
|
|||||||
import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
||||||
import kotlin.math.PI
|
import kotlin.math.PI
|
||||||
|
|
||||||
private val props = BlockBehaviour.Properties.of(Material.STONE, MaterialColor.COLOR_BLUE).requiresCorrectToolForDrops().strength(3f, 600.0f)
|
private val props = BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_BLUE).sound(SoundType.METAL).pushReaction(PushReaction.BLOCK).requiresCorrectToolForDrops().strength(3f, 600.0f)
|
||||||
|
|
||||||
class BlockGravitationStabilizer : RotatableMatteryBlock(props), EntityBlock {
|
class BlockGravitationStabilizer : RotatableMatteryBlock(props), EntityBlock {
|
||||||
override fun newBlockEntity(p_153215_: BlockPos, p_153216_: BlockState): BlockEntity {
|
override fun newBlockEntity(p_153215_: BlockPos, p_153216_: BlockState): BlockEntity {
|
||||||
@ -111,10 +111,6 @@ class BlockGravitationStabilizer : RotatableMatteryBlock(props), EntityBlock {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getPistonPushReaction(p_60584_: BlockState): PushReaction {
|
|
||||||
return PushReaction.BLOCK
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun neighborChanged(
|
override fun neighborChanged(
|
||||||
state: BlockState,
|
state: BlockState,
|
||||||
level: Level,
|
level: Level,
|
||||||
@ -174,10 +170,6 @@ class BlockGravitationStabilizerLens : RotatableMatteryBlock(props) {
|
|||||||
builder.add(WorkerState.SEMI_WORKER_STATE)
|
builder.add(WorkerState.SEMI_WORKER_STATE)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getPistonPushReaction(p_60584_: BlockState): PushReaction {
|
|
||||||
return PushReaction.BLOCK
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun neighborChanged(
|
override fun neighborChanged(
|
||||||
state: BlockState,
|
state: BlockState,
|
||||||
level: Level,
|
level: Level,
|
||||||
|
@ -15,12 +15,12 @@ import net.minecraft.world.level.Level
|
|||||||
import net.minecraft.world.level.NaturalSpawner
|
import net.minecraft.world.level.NaturalSpawner
|
||||||
import net.minecraft.world.level.block.Block
|
import net.minecraft.world.level.block.Block
|
||||||
import net.minecraft.world.level.block.Blocks
|
import net.minecraft.world.level.block.Blocks
|
||||||
|
import net.minecraft.world.level.block.SoundType
|
||||||
import net.minecraft.world.level.block.state.BlockState
|
import net.minecraft.world.level.block.state.BlockState
|
||||||
import net.minecraft.world.level.block.state.StateDefinition
|
import net.minecraft.world.level.block.state.StateDefinition
|
||||||
import net.minecraft.world.level.block.state.properties.BlockStateProperties
|
import net.minecraft.world.level.block.state.properties.BlockStateProperties
|
||||||
import net.minecraft.world.level.block.state.properties.DoubleBlockHalf
|
import net.minecraft.world.level.block.state.properties.DoubleBlockHalf
|
||||||
import net.minecraft.world.level.material.Material
|
import net.minecraft.world.level.material.MapColor
|
||||||
import net.minecraft.world.level.material.MaterialColor
|
|
||||||
import net.minecraft.world.phys.AABB
|
import net.minecraft.world.phys.AABB
|
||||||
import net.minecraft.world.phys.shapes.CollisionContext
|
import net.minecraft.world.phys.shapes.CollisionContext
|
||||||
import net.minecraft.world.phys.shapes.VoxelShape
|
import net.minecraft.world.phys.shapes.VoxelShape
|
||||||
@ -37,7 +37,7 @@ import ru.dbotthepony.mc.otm.once
|
|||||||
import ru.dbotthepony.mc.otm.registry.MBlocks
|
import ru.dbotthepony.mc.otm.registry.MBlocks
|
||||||
import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
||||||
|
|
||||||
class PhantomAttractorBlock : RotatableMatteryBlock(Properties.of(Material.METAL, MaterialColor.COLOR_BLUE).destroyTime(3f).explosionResistance(12f).randomTicks()) {
|
class PhantomAttractorBlock : RotatableMatteryBlock(Properties.of().mapColor(MapColor.COLOR_BLUE).sound(SoundType.METAL).destroyTime(3f).explosionResistance(12f).randomTicks()) {
|
||||||
@Suppress("OVERRIDE_DEPRECATION")
|
@Suppress("OVERRIDE_DEPRECATION")
|
||||||
override fun randomTick(
|
override fun randomTick(
|
||||||
blockState: BlockState,
|
blockState: BlockState,
|
||||||
|
@ -99,7 +99,7 @@ class MatteryPlayerCapability(val ply: Player) : ICapabilityProvider, INBTSerial
|
|||||||
override fun hasResult() = false
|
override fun hasResult() = false
|
||||||
|
|
||||||
val player get() = capability.ply
|
val player get() = capability.ply
|
||||||
val level: Level get() = capability.ply.level
|
val level: Level get() = capability.ply.level()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -110,7 +110,7 @@ class MatteryPlayerCapability(val ply: Player) : ICapabilityProvider, INBTSerial
|
|||||||
override fun hasResult() = false
|
override fun hasResult() = false
|
||||||
|
|
||||||
val player get() = capability.ply
|
val player get() = capability.ply
|
||||||
val level: Level get() = capability.ply.level
|
val level: Level get() = capability.ply.level()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -123,7 +123,7 @@ class MatteryPlayerCapability(val ply: Player) : ICapabilityProvider, INBTSerial
|
|||||||
override fun setResult(value: Result) {}
|
override fun setResult(value: Result) {}
|
||||||
|
|
||||||
val player get() = capability.ply
|
val player get() = capability.ply
|
||||||
val level: Level get() = capability.ply.level
|
val level: Level get() = capability.ply.level()
|
||||||
}
|
}
|
||||||
|
|
||||||
private inner class PlayerMatteryContainer(size: Int) : MatteryContainer(size) {
|
private inner class PlayerMatteryContainer(size: Int) : MatteryContainer(size) {
|
||||||
@ -418,7 +418,7 @@ class MatteryPlayerCapability(val ply: Player) : ICapabilityProvider, INBTSerial
|
|||||||
becomeAndroid()
|
becomeAndroid()
|
||||||
|
|
||||||
if (!ply.abilities.invulnerable)
|
if (!ply.abilities.invulnerable)
|
||||||
ply.hurt(MatteryDamageSource(ply.level.registryAccess().damageType(MDamageTypes.BECOME_ANDROID)), ply.maxHealth * 2)
|
ply.hurt(MatteryDamageSource(ply.level().registryAccess().damageType(MDamageTypes.BECOME_ANDROID)), ply.maxHealth * 2)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -478,7 +478,7 @@ class MatteryPlayerCapability(val ply: Player) : ICapabilityProvider, INBTSerial
|
|||||||
becomeHumane()
|
becomeHumane()
|
||||||
|
|
||||||
if (!ply.abilities.invulnerable)
|
if (!ply.abilities.invulnerable)
|
||||||
ply.hurt(MatteryDamageSource(ply.level.registryAccess().damageType(MDamageTypes.BECOME_HUMANE)), ply.maxHealth * 2)
|
ply.hurt(MatteryDamageSource(ply.level().registryAccess().damageType(MDamageTypes.BECOME_HUMANE)), ply.maxHealth * 2)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -539,7 +539,7 @@ class MatteryPlayerCapability(val ply: Player) : ICapabilityProvider, INBTSerial
|
|||||||
if (featureMap.containsKey(feature.type)) return false
|
if (featureMap.containsKey(feature.type)) return false
|
||||||
featureMap[feature.type] = feature
|
featureMap[feature.type] = feature
|
||||||
|
|
||||||
if (!ply.level.isClientSide) {
|
if (!ply.level().isClientSide) {
|
||||||
queuedTicks.add(feature::applyModifiers)
|
queuedTicks.add(feature::applyModifiers)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -567,7 +567,7 @@ class MatteryPlayerCapability(val ply: Player) : ICapabilityProvider, INBTSerial
|
|||||||
|
|
||||||
featureMap[feature] = factory
|
featureMap[feature] = factory
|
||||||
|
|
||||||
if (!ply.level.isClientSide && isAndroid) {
|
if (!ply.level().isClientSide && isAndroid) {
|
||||||
queuedTicks.add(factory::applyModifiers)
|
queuedTicks.add(factory::applyModifiers)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -592,7 +592,7 @@ class MatteryPlayerCapability(val ply: Player) : ICapabilityProvider, INBTSerial
|
|||||||
val removed = featureMap.remove(feature)
|
val removed = featureMap.remove(feature)
|
||||||
|
|
||||||
if (removed != null) {
|
if (removed != null) {
|
||||||
if (!ply.level.isClientSide && isAndroid) {
|
if (!ply.level().isClientSide && isAndroid) {
|
||||||
queuedTicks.add(removed::removeModifiers)
|
queuedTicks.add(removed::removeModifiers)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -732,7 +732,7 @@ class MatteryPlayerCapability(val ply: Player) : ICapabilityProvider, INBTSerial
|
|||||||
instance.deserializeNBT(featureTag)
|
instance.deserializeNBT(featureTag)
|
||||||
addFeature(instance)
|
addFeature(instance)
|
||||||
|
|
||||||
if (!ply.level.isClientSide) {
|
if (!ply.level().isClientSide) {
|
||||||
queuedTicks.add(instance::applyModifiers)
|
queuedTicks.add(instance::applyModifiers)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -786,7 +786,7 @@ class MatteryPlayerCapability(val ply: Player) : ICapabilityProvider, INBTSerial
|
|||||||
if (hasExoPack) {
|
if (hasExoPack) {
|
||||||
for ((i, stack) in exoPackContainer.withIndex()) {
|
for ((i, stack) in exoPackContainer.withIndex()) {
|
||||||
if (!stack.isEmpty) {
|
if (!stack.isEmpty) {
|
||||||
stack.inventoryTick(ply.level, ply, i + 41, false)
|
stack.inventoryTick(ply.level(), ply, i + 41, false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -852,8 +852,8 @@ class MatteryPlayerCapability(val ply: Player) : ICapabilityProvider, INBTSerial
|
|||||||
ply.isSwimming = false
|
ply.isSwimming = false
|
||||||
|
|
||||||
if (ply is ServerPlayer) {
|
if (ply is ServerPlayer) {
|
||||||
if (ply.level.dimension().location() != lastDimension) {
|
if (ply.level().dimension().location() != lastDimension) {
|
||||||
lastDimension = ply.level.dimension().location()
|
lastDimension = ply.level().dimension().location()
|
||||||
wasInLiquid = false
|
wasInLiquid = false
|
||||||
lastOutsideLiquid = ply.position
|
lastOutsideLiquid = ply.position
|
||||||
}
|
}
|
||||||
@ -889,7 +889,7 @@ class MatteryPlayerCapability(val ply: Player) : ICapabilityProvider, INBTSerial
|
|||||||
androidEnergy.receiveEnergy(AndroidConfig.ANDROID_ENERGY_PER_HUNGER_POINT, false)
|
androidEnergy.receiveEnergy(AndroidConfig.ANDROID_ENERGY_PER_HUNGER_POINT, false)
|
||||||
stats.foodLevel = stats.foodLevel - 1
|
stats.foodLevel = stats.foodLevel - 1
|
||||||
}
|
}
|
||||||
} else if (ply.level.server?.worldData?.difficulty != Difficulty.PEACEFUL) {
|
} else if (ply.level().server?.worldData?.difficulty != Difficulty.PEACEFUL) {
|
||||||
stats.foodLevel = stats.foodLevel.coerceAtMost(18)
|
stats.foodLevel = stats.foodLevel.coerceAtMost(18)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1160,13 +1160,13 @@ class MatteryPlayerCapability(val ply: Player) : ICapabilityProvider, INBTSerial
|
|||||||
val ent = event.player
|
val ent = event.player
|
||||||
|
|
||||||
if (event.phase == TickEvent.Phase.START) {
|
if (event.phase == TickEvent.Phase.START) {
|
||||||
if (!ent.level.isClientSide) {
|
if (!ent.level().isClientSide) {
|
||||||
ent.getCapability(MatteryCapability.MATTERY_PLAYER).ifPresentK {
|
ent.getCapability(MatteryCapability.MATTERY_PLAYER).ifPresentK {
|
||||||
it.preTick()
|
it.preTick()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (ent.level.isClientSide) {
|
if (ent.level().isClientSide) {
|
||||||
ent.getCapability(MatteryCapability.MATTERY_PLAYER).ifPresentK {
|
ent.getCapability(MatteryCapability.MATTERY_PLAYER).ifPresentK {
|
||||||
it.tickClient()
|
it.tickClient()
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,7 @@ object AndroidAbilityKeyMapping : KeyMapping("key.otm.android_ability", KeyConfl
|
|||||||
|
|
||||||
RGBAColor.WHITE.setSystemColor()
|
RGBAColor.WHITE.setSystemColor()
|
||||||
|
|
||||||
feature.renderIcon(event.poseStack, x, y, iconSize, iconSize)
|
feature.renderIcon(event.guiGraphics, x, y, iconSize, iconSize)
|
||||||
|
|
||||||
if (feature.isOnCooldown) {
|
if (feature.isOnCooldown) {
|
||||||
RGBAColor.WHITE.setSystemColor()
|
RGBAColor.WHITE.setSystemColor()
|
||||||
@ -71,13 +71,13 @@ object AndroidAbilityKeyMapping : KeyMapping("key.otm.android_ability", KeyConfl
|
|||||||
RenderSystem.setShaderColor(1f, 1f, 1f, 0.5f)
|
RenderSystem.setShaderColor(1f, 1f, 1f, 0.5f)
|
||||||
|
|
||||||
val nodrawpixels = (iconSize * (1 - cooldownPct)).roundToInt().toFloat()
|
val nodrawpixels = (iconSize * (1 - cooldownPct)).roundToInt().toFloat()
|
||||||
drawRect(event.poseStack, x, y + nodrawpixels, iconSize, iconSize - nodrawpixels)
|
drawRect(event.guiGraphics, x, y + nodrawpixels, iconSize, iconSize - nodrawpixels)
|
||||||
|
|
||||||
RenderSystem.setShaderColor(1f, 1f, 1f, 1f)
|
RenderSystem.setShaderColor(1f, 1f, 1f, 1f)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Widgets18.COOLDOWN.render(event.poseStack, x, y + iconSize, iconSize, iconSize)
|
Widgets18.COOLDOWN.render(event.guiGraphics, x, y + iconSize, iconSize, iconSize)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -157,7 +157,7 @@ object AndroidMenuKeyMapping : KeyMapping("key.otm.android_menu", KeyConflictCon
|
|||||||
val size = minecraft.window.guiScaledHeight.coerceAtMost(minecraft.window.guiScaledWidth).toFloat() * 0.35f
|
val size = minecraft.window.guiScaledHeight.coerceAtMost(minecraft.window.guiScaledWidth).toFloat() * 0.35f
|
||||||
|
|
||||||
drawArc(
|
drawArc(
|
||||||
event.poseStack,
|
event.guiGraphics,
|
||||||
minecraft.window.guiScaledWidth / 2f,
|
minecraft.window.guiScaledWidth / 2f,
|
||||||
minecraft.window.guiScaledHeight / 2f,
|
minecraft.window.guiScaledHeight / 2f,
|
||||||
size,
|
size,
|
||||||
@ -227,7 +227,7 @@ object AndroidMenuKeyMapping : KeyMapping("key.otm.android_menu", KeyConflictCon
|
|||||||
RenderSystem.setShaderColor(85 / 255f, 197 / 255f, 255 / 255f, 0.3f * lastSelectProgressGlobal)
|
RenderSystem.setShaderColor(85 / 255f, 197 / 255f, 255 / 255f, 0.3f * lastSelectProgressGlobal)
|
||||||
|
|
||||||
drawArc(
|
drawArc(
|
||||||
event.poseStack,
|
event.guiGraphics,
|
||||||
minecraft.window.guiScaledWidth / 2f,
|
minecraft.window.guiScaledWidth / 2f,
|
||||||
minecraft.window.guiScaledHeight / 2f,
|
minecraft.window.guiScaledHeight / 2f,
|
||||||
ru.dbotthepony.mc.otm.core.math.linearInterpolation(lastSelectProgressGlobal, size, size * 1.2f),
|
ru.dbotthepony.mc.otm.core.math.linearInterpolation(lastSelectProgressGlobal, size, size * 1.2f),
|
||||||
@ -242,8 +242,9 @@ object AndroidMenuKeyMapping : KeyMapping("key.otm.android_menu", KeyConflictCon
|
|||||||
|
|
||||||
val iconSize = size * 0.25f
|
val iconSize = size * 0.25f
|
||||||
|
|
||||||
event.poseStack.pushPose()
|
val poseStack = event.guiGraphics.pose()
|
||||||
event.poseStack.translate(minecraft.window.guiScaledWidth.toDouble() / 2f, minecraft.window.guiScaledHeight.toDouble() / 2f, 0.0)
|
poseStack.pushPose()
|
||||||
|
poseStack.translate(minecraft.window.guiScaledWidth.toDouble() / 2f, minecraft.window.guiScaledHeight.toDouble() / 2f, 0.0)
|
||||||
|
|
||||||
for ((index, feature) in features.withIndex()) {
|
for ((index, feature) in features.withIndex()) {
|
||||||
var sin = sin((index + 0.5) * degreePerSlice).toFloat()
|
var sin = sin((index + 0.5) * degreePerSlice).toFloat()
|
||||||
@ -255,20 +256,20 @@ object AndroidMenuKeyMapping : KeyMapping("key.otm.android_menu", KeyConflictCon
|
|||||||
}
|
}
|
||||||
|
|
||||||
val shift = size * 0.6f
|
val shift = size * 0.6f
|
||||||
feature.renderIcon(event.poseStack, -iconSize / 2f + shift * cos, -shift * sin - iconSize / 2f, iconSize, iconSize)
|
feature.renderIcon(event.guiGraphics, -iconSize / 2f + shift * cos, -shift * sin - iconSize / 2f, iconSize, iconSize)
|
||||||
minecraft.font.drawAligned(event.poseStack, feature.type.displayName, TextAlign.CENTER_CENTER, shift * cos + 1f, -shift * sin - iconSize / 1.5f + 1f, 0)
|
event.guiGraphics.drawAligned(minecraft.font, feature.type.displayName, TextAlign.CENTER_CENTER, shift * cos + 1f, -shift * sin - iconSize / 1.5f + 1f, 0)
|
||||||
minecraft.font.drawAligned(event.poseStack, feature.type.displayName, TextAlign.CENTER_CENTER, shift * cos, -shift * sin - iconSize / 1.5f, if (feature.isActive) RGBAColor.DARK_GREEN else RGBAColor.DARK_RED)
|
event.guiGraphics.drawAligned(minecraft.font, feature.type.displayName, TextAlign.CENTER_CENTER, shift * cos, -shift * sin - iconSize / 1.5f, if (feature.isActive) RGBAColor.DARK_GREEN else RGBAColor.DARK_RED)
|
||||||
|
|
||||||
if (feature.isOnCooldown && feature.cooldownPercent > 0.0f) {
|
if (feature.isOnCooldown && feature.cooldownPercent > 0.0f) {
|
||||||
RenderSystem.setShaderColor(1f, 1f, 1f, 0.5f)
|
RenderSystem.setShaderColor(1f, 1f, 1f, 0.5f)
|
||||||
drawArc(event.poseStack, shift * cos, -shift * sin, iconSize / 2f, 0f, PI / 2.0, PI / 2.0 + PI * 2.0 * feature.cooldownPercent.toDouble())
|
drawArc(event.guiGraphics, shift * cos, -shift * sin, iconSize / 2f, 0f, PI / 2.0, PI / 2.0 + PI * 2.0 * feature.cooldownPercent.toDouble())
|
||||||
RenderSystem.setShaderColor(1f, 1f, 1f, 1f)
|
RenderSystem.setShaderColor(1f, 1f, 1f, 1f)
|
||||||
|
|
||||||
minecraft.font.drawAligned(event.poseStack, formatTickDuration(feature.cooldown), TextAlign.CENTER_CENTER, shift * cos, -shift * sin + iconSize / 1.5f, RGBAColor.WHITE)
|
event.guiGraphics.drawAligned(minecraft.font, formatTickDuration(feature.cooldown), TextAlign.CENTER_CENTER, shift * cos, -shift * sin + iconSize / 1.5f, RGBAColor.WHITE)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
event.poseStack.popPose()
|
poseStack.popPose()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun renderRegular(event: RenderGuiEvent.Post) {
|
private fun renderRegular(event: RenderGuiEvent.Post) {
|
||||||
@ -295,13 +296,13 @@ object AndroidMenuKeyMapping : KeyMapping("key.otm.android_menu", KeyConflictCon
|
|||||||
var x = minecraft.window.guiScaledWidth * 0.5f - (features.size.toFloat() * COOLDOWN_ICON_SIZE / 2f + (features.size - 1).toFloat() * (COOLDOWN_ICON_MARGIN / 2f))
|
var x = minecraft.window.guiScaledWidth * 0.5f - (features.size.toFloat() * COOLDOWN_ICON_SIZE / 2f + (features.size - 1).toFloat() * (COOLDOWN_ICON_MARGIN / 2f))
|
||||||
|
|
||||||
for (feature in features) {
|
for (feature in features) {
|
||||||
feature.renderIcon(event.poseStack, x, y, COOLDOWN_ICON_SIZE, COOLDOWN_ICON_SIZE)
|
feature.renderIcon(event.guiGraphics, x, y, COOLDOWN_ICON_SIZE, COOLDOWN_ICON_SIZE)
|
||||||
|
|
||||||
RenderSystem.setShaderColor(1f, 1f, 1f, 0.5f)
|
RenderSystem.setShaderColor(1f, 1f, 1f, 0.5f)
|
||||||
drawArc(event.poseStack, x, y, COOLDOWN_ICON_SIZE / 2f, 0f, PI / 2.0, PI / 2.0 + PI * 2.0 * feature.cooldownPercent, alignAtCenter = false)
|
drawArc(event.guiGraphics, x, y, COOLDOWN_ICON_SIZE / 2f, 0f, PI / 2.0, PI / 2.0 + PI * 2.0 * feature.cooldownPercent, alignAtCenter = false)
|
||||||
RenderSystem.setShaderColor(1f, 1f, 1f, 1f)
|
RenderSystem.setShaderColor(1f, 1f, 1f, 1f)
|
||||||
|
|
||||||
font.drawAligned(event.poseStack, formatTickDuration(feature.cooldown), TextAlign.TOP_CENTER, x + COOLDOWN_ICON_SIZE / 2f, y + COOLDOWN_ICON_SIZE + 1f, RGBAColor.WHITE)
|
event.guiGraphics.drawAligned(font, formatTickDuration(feature.cooldown), TextAlign.TOP_CENTER, x + COOLDOWN_ICON_SIZE / 2f, y + COOLDOWN_ICON_SIZE + 1f, RGBAColor.WHITE)
|
||||||
|
|
||||||
x += COOLDOWN_ICON_SIZE + COOLDOWN_ICON_MARGIN
|
x += COOLDOWN_ICON_SIZE + COOLDOWN_ICON_MARGIN
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@ fun onMovementInputUpdate(event: MovementInputUpdateEvent) {
|
|||||||
cap.lastJumpTicks = 14
|
cap.lastJumpTicks = 14
|
||||||
} else {
|
} else {
|
||||||
if (ply.isInWater) {
|
if (ply.isInWater) {
|
||||||
if (ply.isOnGround) {
|
if (ply.onGround()) {
|
||||||
cap.lastJumpTicks = 14
|
cap.lastJumpTicks = 14
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -132,7 +132,7 @@ object MatteryGUI {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
val stack = event.poseStack
|
val stack = event.guiGraphics.pose()
|
||||||
val window = event.window
|
val window = event.window
|
||||||
|
|
||||||
stack.pushPose()
|
stack.pushPose()
|
||||||
@ -156,7 +156,7 @@ object MatteryGUI {
|
|||||||
pushScissorRect(0, (scissorBase + scissorHeight * (1f - progress)).toInt(), window.width, (scissorHeight * progress * 2f).toInt())
|
pushScissorRect(0, (scissorBase + scissorHeight * (1f - progress)).toInt(), window.width, (scissorHeight * progress * 2f).toInt())
|
||||||
|
|
||||||
setDrawColor(RGBAColor(1f, 1f, 1f, 0.4f))
|
setDrawColor(RGBAColor(1f, 1f, 1f, 0.4f))
|
||||||
drawRect(stack, 0f, y - 12f, window.guiScaledWidth.toFloat(), 24f + (deathLog.size - 2f).coerceAtLeast(0f) * minecraft.font.lineHeight * modifyScale * 0.175f)
|
drawRect(event.guiGraphics, 0f, y - 12f, window.guiScaledWidth.toFloat(), 24f + (deathLog.size - 2f).coerceAtLeast(0f) * minecraft.font.lineHeight * modifyScale * 0.175f)
|
||||||
|
|
||||||
val text = TranslatableComponent("otm.iteration", iteration)
|
val text = TranslatableComponent("otm.iteration", iteration)
|
||||||
|
|
||||||
@ -240,22 +240,17 @@ object MatteryGUI {
|
|||||||
val leftPadding = ceil(level * 80f - 0.5f)
|
val leftPadding = ceil(level * 80f - 0.5f)
|
||||||
|
|
||||||
if (ply.hasEffect(MobEffects.HUNGER)) {
|
if (ply.hasEffect(MobEffects.HUNGER)) {
|
||||||
CHARGE_HUNGER_BG.render(event.poseStack, left.toFloat(), top.toFloat())
|
CHARGE_HUNGER_BG.render(event.guiGraphics, left.toFloat(), top.toFloat())
|
||||||
CHARGE_HUNGER.renderPartial(event.poseStack, left.toFloat() - leftPadding + 80f, top.toFloat(), width = leftPadding)
|
CHARGE_HUNGER.renderPartial(event.guiGraphics, left.toFloat() - leftPadding + 80f, top.toFloat(), width = leftPadding)
|
||||||
} else {
|
} else {
|
||||||
CHARGE_BG.render(event.poseStack, left.toFloat(), top.toFloat())
|
CHARGE_BG.render(event.guiGraphics, left.toFloat(), top.toFloat())
|
||||||
CHARGE.renderPartial(event.poseStack, left.toFloat() - leftPadding + 80f, top.toFloat(), width = leftPadding)
|
CHARGE.renderPartial(event.guiGraphics, left.toFloat() - leftPadding + 80f, top.toFloat(), width = leftPadding)
|
||||||
}
|
}
|
||||||
|
|
||||||
val formattedPower = mattery.androidEnergy.batteryLevel.formatPower()
|
val formattedPower = mattery.androidEnergy.batteryLevel.formatPower()
|
||||||
|
|
||||||
event.poseStack.pushPose()
|
event.guiGraphics.drawScaledAligned(minecraft.font, formattedPower, 0.5f, TextAlign.CENTER_LEFT, (left + 83f) * 2f, (top + 5.5f) * 2f, RGBAColor.BLACK.toInt())
|
||||||
event.poseStack.scale(0.5f, 0.5f, 0.5f)
|
event.guiGraphics.drawScaledAligned(minecraft.font, formattedPower, 0.5f, TextAlign.CENTER_LEFT, (left + 82f) * 2f, (top + 4.5f) * 2f, RGBAColor.YELLOW.toInt())
|
||||||
|
|
||||||
minecraft.font.drawAligned(event.poseStack, formattedPower, TextAlign.CENTER_LEFT, (left + 83f) * 2f, (top + 5.5f) * 2f, RGBAColor.BLACK.toInt())
|
|
||||||
minecraft.font.drawAligned(event.poseStack, formattedPower, TextAlign.CENTER_LEFT, (left + 82f) * 2f, (top + 4.5f) * 2f, RGBAColor.YELLOW.toInt())
|
|
||||||
|
|
||||||
event.poseStack.popPose()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -312,31 +307,26 @@ object MatteryGUI {
|
|||||||
val top: Int = height - gui.leftHeight
|
val top: Int = height - gui.leftHeight
|
||||||
gui.leftHeight += 10
|
gui.leftHeight += 10
|
||||||
|
|
||||||
HEALTH_BG.render(event.poseStack, left.toFloat(), top.toFloat())
|
HEALTH_BG.render(event.guiGraphics, left.toFloat(), top.toFloat())
|
||||||
|
|
||||||
if (mattery.hasFeature(AndroidFeatures.NANOBOTS_ARMOR)) {
|
if (mattery.hasFeature(AndroidFeatures.NANOBOTS_ARMOR)) {
|
||||||
val featArmor = mattery.getFeature(AndroidFeatures.NANOBOTS_ARMOR) as NanobotsArmorFeature
|
val featArmor = mattery.getFeature(AndroidFeatures.NANOBOTS_ARMOR) as NanobotsArmorFeature
|
||||||
val levelArmor: Float = (featArmor.layers.toFloat() / (featArmor.strength + 1).toFloat()).coerceIn(0.0f .. 1.0f)
|
val levelArmor: Float = (featArmor.layers.toFloat() / (featArmor.strength + 1).toFloat()).coerceIn(0.0f .. 1.0f)
|
||||||
|
|
||||||
HEALTH_BG_NANOBOTS.renderPartial(event.poseStack, left.toFloat(), top.toFloat(), width = ceil(levelArmor * 81f))
|
HEALTH_BG_NANOBOTS.renderPartial(event.guiGraphics, left.toFloat(), top.toFloat(), width = ceil(levelArmor * 81f))
|
||||||
}
|
}
|
||||||
|
|
||||||
getSpriteForPlayer(ply).renderPartial(event.poseStack, left.toFloat(), top.toFloat(), width = ceil(level * 80f - 0.5f))
|
getSpriteForPlayer(ply).renderPartial(event.guiGraphics, left.toFloat(), top.toFloat(), width = ceil(level * 80f - 0.5f))
|
||||||
if (levelAbsorb > 0) {
|
if (levelAbsorb > 0) {
|
||||||
HEALTH_ABSORB.renderPartial(event.poseStack, left.toFloat(), top.toFloat(), width = ceil(levelAbsorb * 80f - 0.5f))
|
HEALTH_ABSORB.renderPartial(event.guiGraphics, left.toFloat(), top.toFloat(), width = ceil(levelAbsorb * 80f - 0.5f))
|
||||||
}
|
}
|
||||||
|
|
||||||
var formattedHealth = "%d/%d".format(ply.health.toInt(), ply.maxHealth.toInt())
|
var formattedHealth = "%d/%d".format(ply.health.toInt(), ply.maxHealth.toInt())
|
||||||
if (ply.absorptionAmount > 0)
|
if (ply.absorptionAmount > 0)
|
||||||
formattedHealth = "%d+%d/%d".format(ply.health.toInt(), ply.absorptionAmount.toInt(), ply.maxHealth.toInt())
|
formattedHealth = "%d+%d/%d".format(ply.health.toInt(), ply.absorptionAmount.toInt(), ply.maxHealth.toInt())
|
||||||
|
|
||||||
event.poseStack.pushPose()
|
event.guiGraphics.drawScaledAligned(minecraft.font, formattedHealth, 0.5f, TextAlign.CENTER_RIGHT, (left - 1f) * 2f, (top + 5.5f) * 2f, RGBAColor.BLACK.toInt())
|
||||||
event.poseStack.scale(0.5f, 0.5f, 0.5f)
|
event.guiGraphics.drawScaledAligned(minecraft.font, formattedHealth, 0.5f, TextAlign.CENTER_RIGHT, (left - 2f) * 2f, (top + 4.5f) * 2f, getHealthColorForPlayer(ply))
|
||||||
|
|
||||||
minecraft.font.drawAligned(event.poseStack, formattedHealth, TextAlign.CENTER_RIGHT, (left - 1f) * 2f, (top + 5.5f) * 2f, RGBAColor.BLACK.toInt())
|
|
||||||
minecraft.font.drawAligned(event.poseStack, formattedHealth, TextAlign.CENTER_RIGHT, (left - 2f) * 2f, (top + 4.5f) * 2f, getHealthColorForPlayer(ply))
|
|
||||||
|
|
||||||
event.poseStack.popPose()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ import com.mojang.blaze3d.vertex.DefaultVertexFormat
|
|||||||
import com.mojang.blaze3d.vertex.PoseStack
|
import com.mojang.blaze3d.vertex.PoseStack
|
||||||
import com.mojang.blaze3d.vertex.VertexConsumer
|
import com.mojang.blaze3d.vertex.VertexConsumer
|
||||||
import com.mojang.blaze3d.vertex.VertexFormat
|
import com.mojang.blaze3d.vertex.VertexFormat
|
||||||
|
import net.minecraft.client.gui.GuiGraphics
|
||||||
import net.minecraft.client.renderer.GameRenderer
|
import net.minecraft.client.renderer.GameRenderer
|
||||||
import net.minecraft.client.renderer.RenderStateShard
|
import net.minecraft.client.renderer.RenderStateShard
|
||||||
import net.minecraft.client.renderer.RenderType
|
import net.minecraft.client.renderer.RenderType
|
||||||
@ -52,12 +53,12 @@ sealed class AbstractMatterySprite {
|
|||||||
* See [ru.dbotthepony.mc.otm.client.render.clearDepth]
|
* See [ru.dbotthepony.mc.otm.client.render.clearDepth]
|
||||||
*/
|
*/
|
||||||
fun clearDepth(
|
fun clearDepth(
|
||||||
stack: PoseStack,
|
graphics: GuiGraphics,
|
||||||
x: Float = 0f,
|
x: Float = 0f,
|
||||||
y: Float = 0f,
|
y: Float = 0f,
|
||||||
width: Float = this.width,
|
width: Float = this.width,
|
||||||
height: Float = this.height,
|
height: Float = this.height,
|
||||||
) = ru.dbotthepony.mc.otm.client.render.clearDepth(stack, x, y, width, height)
|
) = ru.dbotthepony.mc.otm.client.render.clearDepth(graphics, x, y, width, height)
|
||||||
|
|
||||||
@JvmOverloads
|
@JvmOverloads
|
||||||
fun render(
|
fun render(
|
||||||
@ -75,6 +76,18 @@ sealed class AbstractMatterySprite {
|
|||||||
renderRaw(stack, x, y, width, height, winding)
|
renderRaw(stack, x, y, width, height, winding)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JvmOverloads
|
||||||
|
fun render(
|
||||||
|
graphics: GuiGraphics,
|
||||||
|
x: Float = 0f,
|
||||||
|
y: Float = 0f,
|
||||||
|
width: Float = this.width,
|
||||||
|
height: Float = this.height,
|
||||||
|
winding: UVWindingOrder = this.winding
|
||||||
|
) {
|
||||||
|
render(graphics.pose(), x, y, width, height, winding)
|
||||||
|
}
|
||||||
|
|
||||||
@JvmOverloads
|
@JvmOverloads
|
||||||
fun render(
|
fun render(
|
||||||
stack: PoseStack,
|
stack: PoseStack,
|
||||||
@ -101,6 +114,16 @@ sealed class AbstractMatterySprite {
|
|||||||
renderRawPartial(stack, x, y, width, height, winding)
|
renderRawPartial(stack, x, y, width, height, winding)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JvmOverloads
|
||||||
|
fun renderPartial(
|
||||||
|
graphics: GuiGraphics,
|
||||||
|
x: Float = 0f,
|
||||||
|
y: Float = 0f,
|
||||||
|
width: Float = this.width,
|
||||||
|
height: Float = this.height,
|
||||||
|
winding: UVWindingOrder = this.winding
|
||||||
|
) = renderPartial(graphics.pose(), x, y, width, height, winding)
|
||||||
|
|
||||||
@JvmOverloads
|
@JvmOverloads
|
||||||
fun renderPartial(
|
fun renderPartial(
|
||||||
stack: PoseStack,
|
stack: PoseStack,
|
||||||
@ -111,6 +134,16 @@ sealed class AbstractMatterySprite {
|
|||||||
winding: UVWindingOrder = this.winding
|
winding: UVWindingOrder = this.winding
|
||||||
) = renderPartial(stack, x.toFloat(), y.toFloat(), width.toFloat(), height.toFloat(), winding)
|
) = renderPartial(stack, x.toFloat(), y.toFloat(), width.toFloat(), height.toFloat(), winding)
|
||||||
|
|
||||||
|
@JvmOverloads
|
||||||
|
fun renderPartial(
|
||||||
|
graphics: GuiGraphics,
|
||||||
|
x: Double,
|
||||||
|
y: Double = 0.0,
|
||||||
|
width: Double = this.width.toDouble(),
|
||||||
|
height: Double = this.height.toDouble(),
|
||||||
|
winding: UVWindingOrder = this.winding
|
||||||
|
) = renderPartial(graphics.pose(), x, y, width, height, winding)
|
||||||
|
|
||||||
@JvmOverloads
|
@JvmOverloads
|
||||||
fun renderWidth(
|
fun renderWidth(
|
||||||
stack: PoseStack,
|
stack: PoseStack,
|
||||||
@ -118,9 +151,16 @@ sealed class AbstractMatterySprite {
|
|||||||
y: Float = 0f,
|
y: Float = 0f,
|
||||||
width: Float = this.width,
|
width: Float = this.width,
|
||||||
winding: UVWindingOrder = this.winding
|
winding: UVWindingOrder = this.winding
|
||||||
) {
|
) = render(stack, x, y, width = width, winding = winding)
|
||||||
render(stack, x, y, width = width, winding = winding)
|
|
||||||
}
|
@JvmOverloads
|
||||||
|
fun renderWidth(
|
||||||
|
graphics: GuiGraphics,
|
||||||
|
x: Float = 0f,
|
||||||
|
y: Float = 0f,
|
||||||
|
width: Float = this.width,
|
||||||
|
winding: UVWindingOrder = this.winding
|
||||||
|
) = renderWidth(graphics.pose(), x, y, width, winding)
|
||||||
|
|
||||||
@JvmOverloads
|
@JvmOverloads
|
||||||
fun renderWidth(
|
fun renderWidth(
|
||||||
@ -131,6 +171,15 @@ sealed class AbstractMatterySprite {
|
|||||||
winding: UVWindingOrder = this.winding
|
winding: UVWindingOrder = this.winding
|
||||||
) = renderWidth(stack, x.toFloat(), y.toFloat(), width.toFloat(), winding)
|
) = renderWidth(stack, x.toFloat(), y.toFloat(), width.toFloat(), winding)
|
||||||
|
|
||||||
|
@JvmOverloads
|
||||||
|
fun renderWidth(
|
||||||
|
graphics: GuiGraphics,
|
||||||
|
x: Double,
|
||||||
|
y: Double = 0.0,
|
||||||
|
width: Double = this.width.toDouble(),
|
||||||
|
winding: UVWindingOrder = this.winding
|
||||||
|
) = renderWidth(graphics.pose(), x, y, width, winding)
|
||||||
|
|
||||||
@JvmOverloads
|
@JvmOverloads
|
||||||
fun renderHeight(
|
fun renderHeight(
|
||||||
stack: PoseStack,
|
stack: PoseStack,
|
||||||
@ -138,9 +187,16 @@ sealed class AbstractMatterySprite {
|
|||||||
y: Float = 0f,
|
y: Float = 0f,
|
||||||
height: Float = this.height,
|
height: Float = this.height,
|
||||||
winding: UVWindingOrder = this.winding
|
winding: UVWindingOrder = this.winding
|
||||||
) {
|
) = render(stack, x, y, height = height, winding = winding)
|
||||||
render(stack, x, y, height = height, winding = winding)
|
|
||||||
}
|
@JvmOverloads
|
||||||
|
fun renderHeight(
|
||||||
|
graphics: GuiGraphics,
|
||||||
|
x: Float = 0f,
|
||||||
|
y: Float = 0f,
|
||||||
|
height: Float = this.height,
|
||||||
|
winding: UVWindingOrder = this.winding
|
||||||
|
) = renderHeight(graphics.pose(), x, y, height, winding)
|
||||||
|
|
||||||
@JvmOverloads
|
@JvmOverloads
|
||||||
fun renderHeight(
|
fun renderHeight(
|
||||||
@ -151,6 +207,14 @@ sealed class AbstractMatterySprite {
|
|||||||
winding: UVWindingOrder = this.winding
|
winding: UVWindingOrder = this.winding
|
||||||
) = renderHeight(stack, x.toFloat(), y.toFloat(), height.toFloat(), winding)
|
) = renderHeight(stack, x.toFloat(), y.toFloat(), height.toFloat(), winding)
|
||||||
|
|
||||||
|
@JvmOverloads
|
||||||
|
fun renderHeight(
|
||||||
|
graphics: GuiGraphics,
|
||||||
|
x: Double,
|
||||||
|
y: Double = 0.0,
|
||||||
|
height: Double = this.height.toDouble(),
|
||||||
|
winding: UVWindingOrder = this.winding
|
||||||
|
) = renderHeight(graphics.pose(), x, y, height, winding)
|
||||||
|
|
||||||
@JvmOverloads
|
@JvmOverloads
|
||||||
fun renderRaw(
|
fun renderRaw(
|
||||||
@ -183,6 +247,16 @@ sealed class AbstractMatterySprite {
|
|||||||
winding: UVWindingOrder = this.winding
|
winding: UVWindingOrder = this.winding
|
||||||
) = renderRaw(stack, x.toFloat(), y.toFloat(), width.toFloat(), height.toFloat(), winding)
|
) = renderRaw(stack, x.toFloat(), y.toFloat(), width.toFloat(), height.toFloat(), winding)
|
||||||
|
|
||||||
|
@JvmOverloads
|
||||||
|
fun renderRaw(
|
||||||
|
graphics: GuiGraphics,
|
||||||
|
x: Double,
|
||||||
|
y: Double = 0.0,
|
||||||
|
width: Double = this.width.toDouble(),
|
||||||
|
height: Double = this.height.toDouble(),
|
||||||
|
winding: UVWindingOrder = this.winding
|
||||||
|
) = renderRaw(graphics.pose(), x, y, width, height, winding)
|
||||||
|
|
||||||
@JvmOverloads
|
@JvmOverloads
|
||||||
fun renderRawPartial(
|
fun renderRawPartial(
|
||||||
stack: PoseStack,
|
stack: PoseStack,
|
||||||
|
@ -4,10 +4,7 @@ import com.mojang.blaze3d.pipeline.MainTarget
|
|||||||
import com.mojang.blaze3d.platform.GlConst
|
import com.mojang.blaze3d.platform.GlConst
|
||||||
import com.mojang.blaze3d.platform.GlStateManager
|
import com.mojang.blaze3d.platform.GlStateManager
|
||||||
import com.mojang.blaze3d.systems.RenderSystem
|
import com.mojang.blaze3d.systems.RenderSystem
|
||||||
import com.mojang.blaze3d.vertex.BufferBuilder
|
import com.mojang.blaze3d.vertex.*
|
||||||
import com.mojang.blaze3d.vertex.BufferUploader
|
|
||||||
import com.mojang.blaze3d.vertex.DefaultVertexFormat
|
|
||||||
import com.mojang.blaze3d.vertex.VertexFormat
|
|
||||||
import net.minecraft.client.Minecraft
|
import net.minecraft.client.Minecraft
|
||||||
import net.minecraft.client.renderer.FogRenderer
|
import net.minecraft.client.renderer.FogRenderer
|
||||||
import net.minecraft.client.renderer.GameRenderer
|
import net.minecraft.client.renderer.GameRenderer
|
||||||
@ -151,7 +148,7 @@ object GlitchRenderer {
|
|||||||
|
|
||||||
val glitchBuffer = glitchBuffer
|
val glitchBuffer = glitchBuffer
|
||||||
val projection = RenderSystem.getProjectionMatrix()
|
val projection = RenderSystem.getProjectionMatrix()
|
||||||
RenderSystem.setProjectionMatrix(Matrix4f())
|
RenderSystem.setProjectionMatrix(Matrix4f(), VertexSorting.ORTHOGRAPHIC_Z)
|
||||||
|
|
||||||
RenderSystem.getModelViewStack().also {
|
RenderSystem.getModelViewStack().also {
|
||||||
it.pushPose()
|
it.pushPose()
|
||||||
@ -247,7 +244,7 @@ object GlitchRenderer {
|
|||||||
RenderSystem.setShaderTexture(0, glitchBuffer.colorTextureId)
|
RenderSystem.setShaderTexture(0, glitchBuffer.colorTextureId)
|
||||||
draw(0.0, 0.0)
|
draw(0.0, 0.0)
|
||||||
|
|
||||||
RenderSystem.setProjectionMatrix(projection)
|
RenderSystem.setProjectionMatrix(projection, VertexSorting.DISTANCE_TO_ORIGIN)
|
||||||
RenderSystem.getModelViewStack().popPose()
|
RenderSystem.getModelViewStack().popPose()
|
||||||
RenderSystem.applyModelViewMatrix()
|
RenderSystem.applyModelViewMatrix()
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ package ru.dbotthepony.mc.otm.client.render
|
|||||||
import com.mojang.blaze3d.platform.GlStateManager
|
import com.mojang.blaze3d.platform.GlStateManager
|
||||||
import com.mojang.blaze3d.systems.RenderSystem
|
import com.mojang.blaze3d.systems.RenderSystem
|
||||||
import com.mojang.blaze3d.vertex.*
|
import com.mojang.blaze3d.vertex.*
|
||||||
|
import net.minecraft.client.gui.GuiGraphics
|
||||||
import net.minecraft.client.renderer.GameRenderer
|
import net.minecraft.client.renderer.GameRenderer
|
||||||
import net.minecraft.client.renderer.RenderStateShard
|
import net.minecraft.client.renderer.RenderStateShard
|
||||||
import net.minecraft.client.renderer.RenderStateShard.LineStateShard
|
import net.minecraft.client.renderer.RenderStateShard.LineStateShard
|
||||||
@ -88,6 +89,15 @@ fun drawTexturedRect(
|
|||||||
uv: IUVCoords
|
uv: IUVCoords
|
||||||
) = drawTexturedRect(stack.last().pose(), x, y, width, height, uv.u0, uv.v0, uv.u1, uv.v1)
|
) = drawTexturedRect(stack.last().pose(), x, y, width, height, uv.u0, uv.v0, uv.u1, uv.v1)
|
||||||
|
|
||||||
|
fun drawTexturedRect(
|
||||||
|
graphics: GuiGraphics,
|
||||||
|
x: Float,
|
||||||
|
y: Float,
|
||||||
|
width: Float,
|
||||||
|
height: Float,
|
||||||
|
uv: IUVCoords
|
||||||
|
) = drawTexturedRect(graphics.pose(), x, y, width, height, uv)
|
||||||
|
|
||||||
fun drawTexturedRect(
|
fun drawTexturedRect(
|
||||||
stack: PoseStack,
|
stack: PoseStack,
|
||||||
x: Float,
|
x: Float,
|
||||||
@ -100,6 +110,18 @@ fun drawTexturedRect(
|
|||||||
v1: Float
|
v1: Float
|
||||||
) = drawTexturedRect(stack.last().pose(), x, y, width, height, u0, v0, u1, v1)
|
) = drawTexturedRect(stack.last().pose(), x, y, width, height, u0, v0, u1, v1)
|
||||||
|
|
||||||
|
fun drawTexturedRect(
|
||||||
|
graphics: GuiGraphics,
|
||||||
|
x: Float,
|
||||||
|
y: Float,
|
||||||
|
width: Float,
|
||||||
|
height: Float,
|
||||||
|
u0: Float,
|
||||||
|
v0: Float,
|
||||||
|
u1: Float,
|
||||||
|
v1: Float
|
||||||
|
) = drawTexturedRect(graphics.pose(), x, y, width, height, u0, v0, u1, v1)
|
||||||
|
|
||||||
fun drawTexturedRect(
|
fun drawTexturedRect(
|
||||||
x: Float,
|
x: Float,
|
||||||
y: Float,
|
y: Float,
|
||||||
@ -342,6 +364,15 @@ fun drawRect(
|
|||||||
color: RGBAColor = drawColor
|
color: RGBAColor = drawColor
|
||||||
) = drawRect(pose.last().pose(), x, y, width, height, color = color)
|
) = drawRect(pose.last().pose(), x, y, width, height, color = color)
|
||||||
|
|
||||||
|
fun drawRect(
|
||||||
|
graphics: GuiGraphics,
|
||||||
|
x: Float,
|
||||||
|
y: Float,
|
||||||
|
width: Float,
|
||||||
|
height: Float,
|
||||||
|
color: RGBAColor = drawColor
|
||||||
|
) = drawRect(graphics.pose(), x, y, width, height, color = color)
|
||||||
|
|
||||||
fun drawRect(
|
fun drawRect(
|
||||||
x: Float,
|
x: Float,
|
||||||
y: Float,
|
y: Float,
|
||||||
@ -420,6 +451,16 @@ fun drawLine(
|
|||||||
color: RGBAColor = drawColor
|
color: RGBAColor = drawColor
|
||||||
) = drawLine(pose.last().pose(), startX, startY, endX, endY, width, color = color)
|
) = drawLine(pose.last().pose(), startX, startY, endX, endY, width, color = color)
|
||||||
|
|
||||||
|
fun drawLine(
|
||||||
|
graphics: GuiGraphics,
|
||||||
|
startX: Float,
|
||||||
|
startY: Float,
|
||||||
|
endX: Float,
|
||||||
|
endY: Float,
|
||||||
|
width: Float,
|
||||||
|
color: RGBAColor = drawColor
|
||||||
|
) = drawLine(graphics.pose(), startX, startY, endX, endY, width, color = color)
|
||||||
|
|
||||||
fun drawLine(
|
fun drawLine(
|
||||||
startX: Float,
|
startX: Float,
|
||||||
startY: Float,
|
startY: Float,
|
||||||
@ -527,6 +568,15 @@ fun TextureAtlasSprite.render(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun TextureAtlasSprite.render(
|
||||||
|
graphics: GuiGraphics,
|
||||||
|
x: Float = 0f,
|
||||||
|
y: Float = 0f,
|
||||||
|
width: Float,
|
||||||
|
height: Float,
|
||||||
|
winding: UVWindingOrder = UVWindingOrder.NORMAL
|
||||||
|
) = render(graphics.pose(), x, y, width, height, winding)
|
||||||
|
|
||||||
fun determineTooltipPosition(x: Float, y: Float, width: Float, height: Float): Pair<Float, Float> {
|
fun determineTooltipPosition(x: Float, y: Float, width: Float, height: Float): Pair<Float, Float> {
|
||||||
val windowWidth = minecraft.window.guiScaledWidth.toFloat()
|
val windowWidth = minecraft.window.guiScaledWidth.toFloat()
|
||||||
val windowHeight = minecraft.window.guiScaledHeight.toFloat()
|
val windowHeight = minecraft.window.guiScaledHeight.toFloat()
|
||||||
@ -584,6 +634,9 @@ fun clearDepth(stack: PoseStack, x: Float, y: Float, width: Float, height: Float
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JvmOverloads
|
||||||
|
fun clearDepth(graphics: GuiGraphics, x: Float, y: Float, width: Float, height: Float, depth: Float = -500f) = ru.dbotthepony.mc.otm.client.render.clearDepth(graphics.pose(), x, y, width, height, depth)
|
||||||
|
|
||||||
fun drawArc(
|
fun drawArc(
|
||||||
stack: PoseStack,
|
stack: PoseStack,
|
||||||
x: Float,
|
x: Float,
|
||||||
@ -596,6 +649,17 @@ fun drawArc(
|
|||||||
alignAtCenter: Boolean = true
|
alignAtCenter: Boolean = true
|
||||||
) = drawArc(stack.last().pose(), x, y, outerRadius, innerRadius, startDegree, endDegree, steps, alignAtCenter)
|
) = drawArc(stack.last().pose(), x, y, outerRadius, innerRadius, startDegree, endDegree, steps, alignAtCenter)
|
||||||
|
|
||||||
|
fun drawArc(
|
||||||
|
graphics: GuiGraphics,
|
||||||
|
x: Float,
|
||||||
|
y: Float,
|
||||||
|
outerRadius: Float,
|
||||||
|
innerRadius: Float = 0f,
|
||||||
|
startDegree: Double = 0.0,
|
||||||
|
endDegree: Double = PI * 2.0,
|
||||||
|
steps: Int = (outerRadius * (endDegree - startDegree) * 4.0).roundToInt().coerceAtLeast(12),
|
||||||
|
alignAtCenter: Boolean = true
|
||||||
|
) = drawArc(graphics.pose(), x, y, outerRadius, innerRadius, startDegree, endDegree, steps, alignAtCenter)
|
||||||
|
|
||||||
fun uploadArc(
|
fun uploadArc(
|
||||||
matrix: Matrix4f,
|
matrix: Matrix4f,
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package ru.dbotthepony.mc.otm.client.render
|
package ru.dbotthepony.mc.otm.client.render
|
||||||
|
|
||||||
import com.mojang.blaze3d.vertex.PoseStack
|
import com.mojang.blaze3d.vertex.PoseStack
|
||||||
|
import net.minecraft.client.gui.GuiGraphics
|
||||||
import net.minecraft.resources.ResourceLocation
|
import net.minecraft.resources.ResourceLocation
|
||||||
import ru.dbotthepony.mc.otm.client.screen.panels.DockProperty
|
import ru.dbotthepony.mc.otm.client.screen.panels.DockProperty
|
||||||
|
|
||||||
@ -43,6 +44,15 @@ data class StretchingRectangleElement(
|
|||||||
bottomRight.render(stack, x + width - bottomRight.width, y + height - bottomLeft.height)
|
bottomRight.render(stack, x + width - bottomRight.width, y + height - bottomLeft.height)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JvmOverloads
|
||||||
|
fun render(
|
||||||
|
graphics: GuiGraphics,
|
||||||
|
x: Float = 0f,
|
||||||
|
y: Float = 0f,
|
||||||
|
width: Float,
|
||||||
|
height: Float,
|
||||||
|
) = render(graphics.pose(), x, y, width, height)
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
fun square(
|
fun square(
|
||||||
texture: ResourceLocation,
|
texture: ResourceLocation,
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package ru.dbotthepony.mc.otm.client.screen
|
package ru.dbotthepony.mc.otm.client.screen
|
||||||
|
|
||||||
import com.mojang.blaze3d.vertex.PoseStack
|
import com.mojang.blaze3d.vertex.PoseStack
|
||||||
|
import net.minecraft.client.gui.GuiGraphics
|
||||||
import net.minecraft.client.gui.screens.inventory.InventoryScreen
|
import net.minecraft.client.gui.screens.inventory.InventoryScreen
|
||||||
import ru.dbotthepony.mc.otm.client.mousePos
|
import ru.dbotthepony.mc.otm.client.mousePos
|
||||||
import ru.dbotthepony.mc.otm.client.moveMousePosScaled
|
import ru.dbotthepony.mc.otm.client.moveMousePosScaled
|
||||||
@ -139,8 +140,8 @@ class ExoPackInventoryScreen(menu: ExoPackInventoryMenu) : MatteryScreen<ExoPack
|
|||||||
width = craftingCanvas.width - resultPanel.width - craftingSlotsCanvas.width,
|
width = craftingCanvas.width - resultPanel.width - craftingSlotsCanvas.width,
|
||||||
height = topLine.height
|
height = topLine.height
|
||||||
) {
|
) {
|
||||||
override fun innerRender(stack: PoseStack, mouseX: Float, mouseY: Float, partialTick: Float) {
|
override fun innerRender(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) {
|
||||||
CRAFT_ARROW.render(stack, x = width / 2f - CRAFT_ARROW.width / 2f, y = height / 2f - CRAFT_ARROW.height / 2f)
|
CRAFT_ARROW.render(graphics, x = width / 2f - CRAFT_ARROW.width / 2f, y = height / 2f - CRAFT_ARROW.height / 2f)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectFunction
|
|||||||
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap
|
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap
|
||||||
import net.minecraft.ChatFormatting
|
import net.minecraft.ChatFormatting
|
||||||
import net.minecraft.client.gui.Font
|
import net.minecraft.client.gui.Font
|
||||||
|
import net.minecraft.client.gui.GuiGraphics
|
||||||
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen
|
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen
|
||||||
import net.minecraft.client.renderer.entity.ItemRenderer
|
import net.minecraft.client.renderer.entity.ItemRenderer
|
||||||
import net.minecraft.network.chat.Component
|
import net.minecraft.network.chat.Component
|
||||||
@ -55,9 +56,6 @@ abstract class MatteryScreen<T : MatteryMenu>(menu: T, inventory: Inventory, tit
|
|||||||
var mainFrame: FramePanel<MatteryScreen<*>>? = null
|
var mainFrame: FramePanel<MatteryScreen<*>>? = null
|
||||||
private var madeMainFrame = false
|
private var madeMainFrame = false
|
||||||
|
|
||||||
var itemRenderer: ItemRenderer
|
|
||||||
get() = itemRenderer
|
|
||||||
set(itemRenderer) { super.itemRenderer = itemRenderer }
|
|
||||||
var font: Font
|
var font: Font
|
||||||
get() = font
|
get() = font
|
||||||
set(font) { super.font = font }
|
set(font) { super.font = font }
|
||||||
@ -68,14 +66,13 @@ abstract class MatteryScreen<T : MatteryMenu>(menu: T, inventory: Inventory, tit
|
|||||||
val quickCraftingType get() = quickCraftingType
|
val quickCraftingType get() = quickCraftingType
|
||||||
val isQuickCrafting get() = isQuickCrafting
|
val isQuickCrafting get() = isQuickCrafting
|
||||||
|
|
||||||
fun renderItemStack(poseStack: PoseStack, itemstack: ItemStack, countOverride: String? = null) {
|
fun renderItemStack(graphics: GuiGraphics, itemstack: ItemStack, countOverride: String? = null) {
|
||||||
if (!itemstack.isEmpty) {
|
if (!itemstack.isEmpty) {
|
||||||
RenderSystem.enableDepthTest()
|
RenderSystem.enableDepthTest()
|
||||||
|
|
||||||
val (x, y) = poseStack.translation()
|
val (x, y) = graphics.pose().translation()
|
||||||
|
|
||||||
itemRenderer.renderAndDecorateItem(
|
graphics.renderItem(
|
||||||
poseStack,
|
|
||||||
requireNotNull(ru.dbotthepony.mc.otm.client.minecraft.player) { "yo, dude, what the fuck" },
|
requireNotNull(ru.dbotthepony.mc.otm.client.minecraft.player) { "yo, dude, what the fuck" },
|
||||||
itemstack,
|
itemstack,
|
||||||
1,
|
1,
|
||||||
@ -84,8 +81,7 @@ abstract class MatteryScreen<T : MatteryMenu>(menu: T, inventory: Inventory, tit
|
|||||||
)
|
)
|
||||||
|
|
||||||
RenderSystem.depthFunc(GL11.GL_ALWAYS)
|
RenderSystem.depthFunc(GL11.GL_ALWAYS)
|
||||||
itemRenderer.renderGuiItemDecorations(
|
graphics.renderItemDecorations(
|
||||||
poseStack,
|
|
||||||
font,
|
font,
|
||||||
itemstack,
|
itemstack,
|
||||||
1,
|
1,
|
||||||
@ -465,7 +461,7 @@ abstract class MatteryScreen<T : MatteryMenu>(menu: T, inventory: Inventory, tit
|
|||||||
return super.keyPressed(key, scancode, mods)
|
return super.keyPressed(key, scancode, mods)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun renderBg(p_97787_: PoseStack, p_97788_: Float, p_97789_: Int, p_97790_: Int) {}
|
override fun renderBg(p_283065_: GuiGraphics, p_97788_: Float, p_97789_: Int, p_97790_: Int) {}
|
||||||
|
|
||||||
var returnSlot: Slot? = null
|
var returnSlot: Slot? = null
|
||||||
|
|
||||||
@ -498,12 +494,12 @@ abstract class MatteryScreen<T : MatteryMenu>(menu: T, inventory: Inventory, tit
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun render(poseStack: PoseStack, mouseX: Int, mouseY: Int, partialTick: Float) {
|
override fun render(graphics: GuiGraphics, mouseX: Int, mouseY: Int, partialTick: Float) {
|
||||||
val mouseXf = mouseX.toFloat()
|
val mouseXf = mouseX.toFloat()
|
||||||
val mouseYf = mouseY.toFloat()
|
val mouseYf = mouseY.toFloat()
|
||||||
|
|
||||||
// dark background
|
// dark background
|
||||||
this.renderBackground(poseStack)
|
this.renderBackground(graphics)
|
||||||
|
|
||||||
hoveredSlot = null
|
hoveredSlot = null
|
||||||
var hovered = false
|
var hovered = false
|
||||||
@ -524,21 +520,21 @@ abstract class MatteryScreen<T : MatteryMenu>(menu: T, inventory: Inventory, tit
|
|||||||
val panel = panels[i]
|
val panel = panels[i]
|
||||||
RenderSystem.depthFunc(GL11.GL_ALWAYS)
|
RenderSystem.depthFunc(GL11.GL_ALWAYS)
|
||||||
RenderSystem.setShaderColor(1f, 1f, 1f, 1f)
|
RenderSystem.setShaderColor(1f, 1f, 1f, 1f)
|
||||||
panel.render(poseStack, mouseXf, mouseYf, partialTick)
|
panel.render(graphics, mouseXf, mouseYf, partialTick)
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderSystem.depthFunc(GL11.GL_LESS)
|
RenderSystem.depthFunc(GL11.GL_LESS)
|
||||||
MinecraftForge.EVENT_BUS.post(Background(this, poseStack, mouseX, mouseY))
|
MinecraftForge.EVENT_BUS.post(Background(this, graphics, mouseX, mouseY))
|
||||||
RenderSystem.disableDepthTest()
|
RenderSystem.disableDepthTest()
|
||||||
|
|
||||||
// Screen.super.render
|
// Screen.super.render
|
||||||
for (widget in renderables) {
|
for (widget in renderables) {
|
||||||
widget.render(poseStack, mouseX, mouseY, partialTick)
|
widget.render(graphics, mouseX, mouseY, partialTick)
|
||||||
}
|
}
|
||||||
// /Screen.super.render
|
// /Screen.super.render
|
||||||
|
|
||||||
RenderSystem.disableDepthTest()
|
RenderSystem.disableDepthTest()
|
||||||
MinecraftForge.EVENT_BUS.post(Foreground(this, poseStack, mouseX, mouseY))
|
MinecraftForge.EVENT_BUS.post(Foreground(this, graphics, mouseX, mouseY))
|
||||||
|
|
||||||
var itemstack = if (draggingItem.isEmpty) menu.carried else draggingItem
|
var itemstack = if (draggingItem.isEmpty) menu.carried else draggingItem
|
||||||
|
|
||||||
@ -556,19 +552,19 @@ abstract class MatteryScreen<T : MatteryMenu>(menu: T, inventory: Inventory, tit
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Suppress("NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS")
|
@Suppress("NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS")
|
||||||
renderFloatingItem(poseStack, itemstack, mouseX - 8, mouseY - i2, overrideCount)
|
renderFloatingItem(graphics, itemstack, mouseX - 8, mouseY - i2, overrideCount)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (menu.carried.isEmpty) {
|
if (menu.carried.isEmpty) {
|
||||||
val hoveredSlot = hoveredSlot
|
val hoveredSlot = hoveredSlot
|
||||||
|
|
||||||
if (hoveredSlot != null && hoveredSlot.hasItem()) {
|
if (hoveredSlot != null && hoveredSlot.hasItem()) {
|
||||||
this.renderTooltip(poseStack, hoveredSlot.item, mouseX, mouseY)
|
this.renderTooltip(graphics, mouseX, mouseY)
|
||||||
} else {
|
} else {
|
||||||
for (panel in panels) {
|
for (panel in panels) {
|
||||||
RenderSystem.disableDepthTest()
|
RenderSystem.disableDepthTest()
|
||||||
|
|
||||||
if (panel.renderTooltips(poseStack, mouseXf, mouseYf, partialTick)) {
|
if (panel.renderTooltips(graphics, mouseXf, mouseYf, partialTick)) {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -788,7 +788,7 @@ open class EditablePanel<out S : Screen> @JvmOverloads constructor(
|
|||||||
|
|
||||||
if (currentScissorRect == null || currentScissorRect.crossScaled(absoluteX, absoluteY, width, height)) {
|
if (currentScissorRect == null || currentScissorRect.crossScaled(absoluteX, absoluteY, width, height)) {
|
||||||
// do not render if we are getting cut off by screen scissor
|
// do not render if we are getting cut off by screen scissor
|
||||||
clearDepth(poseStack, absoluteX, absoluteY, width, height)
|
clearDepth(graphics, absoluteX, absoluteY, width, height)
|
||||||
poseStack.pushPose()
|
poseStack.pushPose()
|
||||||
poseStack.translate(absoluteX.toDouble(), absoluteY.toDouble(), 10.0)
|
poseStack.translate(absoluteX.toDouble(), absoluteY.toDouble(), 10.0)
|
||||||
RenderSystem.setShaderColor(1f, 1f, 1f, if (isFlashFrameRecursive) 0.5f else 1f)
|
RenderSystem.setShaderColor(1f, 1f, 1f, if (isFlashFrameRecursive) 0.5f else 1f)
|
||||||
@ -1708,7 +1708,7 @@ open class EditablePanel<out S : Screen> @JvmOverloads constructor(
|
|||||||
/**
|
/**
|
||||||
* See [ru.dbotthepony.mc.otm.client.render.clearDepth]
|
* See [ru.dbotthepony.mc.otm.client.render.clearDepth]
|
||||||
*/
|
*/
|
||||||
fun clearDepth(stack: PoseStack, x: Float = 0f, y: Float = 0f, width: Float = this.width, height: Float = this.height) = ru.dbotthepony.mc.otm.client.render.clearDepth(stack, x, y, width, height)
|
fun clearDepth(graphics: GuiGraphics, x: Float = 0f, y: Float = 0f, width: Float = this.width, height: Float = this.height) = ru.dbotthepony.mc.otm.client.render.clearDepth(graphics, x, y, width, height)
|
||||||
|
|
||||||
fun queryUser(title: Component, text: Component, onConfirm: Runnable, onCancel: Runnable? = null): QueryUserPanel<S> {
|
fun queryUser(title: Component, text: Component, onConfirm: Runnable, onCancel: Runnable? = null): QueryUserPanel<S> {
|
||||||
return QueryUserPanel(screen, title, listOf(text), onConfirm, onCancel).also { blockingWindow = it }
|
return QueryUserPanel(screen, title, listOf(text), onConfirm, onCancel).also { blockingWindow = it }
|
||||||
|
@ -4,6 +4,7 @@ import com.mojang.blaze3d.systems.RenderSystem
|
|||||||
import com.mojang.blaze3d.vertex.PoseStack
|
import com.mojang.blaze3d.vertex.PoseStack
|
||||||
import it.unimi.dsi.fastutil.objects.Object2ObjectArrayMap
|
import it.unimi.dsi.fastutil.objects.Object2ObjectArrayMap
|
||||||
import it.unimi.dsi.fastutil.objects.Object2ObjectFunction
|
import it.unimi.dsi.fastutil.objects.Object2ObjectFunction
|
||||||
|
import net.minecraft.client.gui.GuiGraphics
|
||||||
import net.minecraft.client.gui.screens.Screen
|
import net.minecraft.client.gui.screens.Screen
|
||||||
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen
|
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen
|
||||||
import net.minecraft.world.effect.MobEffect
|
import net.minecraft.world.effect.MobEffect
|
||||||
@ -109,29 +110,29 @@ open class EffectListPanel<out S : Screen> @JvmOverloads constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun innerRender(stack: PoseStack, mouseX: Float, mouseY: Float, partialTick: Float) {
|
override fun innerRender(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) {
|
||||||
clearDepth(stack)
|
clearDepth(graphics)
|
||||||
SQUARE_THIN.render(stack, width = width, height = height)
|
SQUARE_THIN.render(graphics, width = width, height = height)
|
||||||
|
|
||||||
RenderSystem.setShaderColor(1f, 1f, 1f, 0.5f)
|
RenderSystem.setShaderColor(1f, 1f, 1f, 0.5f)
|
||||||
minecraft.mobEffectTextures.get(effect.effect).render(stack, x = 3f, y = 3f, width = width - 6f, height = height - 6f)
|
minecraft.mobEffectTextures.get(effect.effect).render(graphics, x = 3f, y = 3f, width = width - 6f, height = height - 6f)
|
||||||
|
|
||||||
RenderSystem.setShaderColor(1f, 1f, 1f, 1f)
|
RenderSystem.setShaderColor(1f, 1f, 1f, 1f)
|
||||||
font.drawScaledAligned(stack, formatTickDuration(effect.duration), 0.75f, TextAlign.CENTER_CENTER, width / 2f - 1f, height / 2f, RGBAColor.WHITE)
|
graphics.drawScaledAligned(font, formatTickDuration(effect.duration), 0.75f, TextAlign.CENTER_CENTER, width / 2f - 1f, height / 2f, RGBAColor.WHITE)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun innerRenderTooltips(stack: PoseStack, mouseX: Float, mouseY: Float, partialTick: Float): Boolean {
|
override fun innerRenderTooltips(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float): Boolean {
|
||||||
if (isHovered) {
|
if (isHovered) {
|
||||||
val (x, y) = determineTooltipPosition(mouseX + 4f, mouseY - 12f, BAR.width, BAR.height)
|
val (x, y) = determineTooltipPosition(mouseX + 4f, mouseY - 12f, BAR.width, BAR.height)
|
||||||
|
|
||||||
BAR.clearDepth(stack, x, y)
|
BAR.clearDepth(graphics, x, y)
|
||||||
BAR.render(stack, x, y)
|
BAR.render(graphics, x, y)
|
||||||
|
|
||||||
val renderWidth = 18f
|
val renderWidth = 18f
|
||||||
val renderHeight = 18f
|
val renderHeight = 18f
|
||||||
|
|
||||||
minecraft.mobEffectTextures.get(effect.effect).render(
|
minecraft.mobEffectTextures.get(effect.effect).render(
|
||||||
stack,
|
graphics.pose(),
|
||||||
x = x + 8f,
|
x = x + 8f,
|
||||||
y = y + BAR.height / 2f - renderHeight / 2f,
|
y = y + BAR.height / 2f - renderHeight / 2f,
|
||||||
width = renderWidth,
|
width = renderWidth,
|
||||||
@ -145,8 +146,8 @@ open class EffectListPanel<out S : Screen> @JvmOverloads constructor(
|
|||||||
name.append(" ${effect.amplifier + 1}")
|
name.append(" ${effect.amplifier + 1}")
|
||||||
}
|
}
|
||||||
|
|
||||||
font.drawAligned(stack, name, TextAlign.TOP_LEFT, x + renderWidth + 12f, y + 7f, RGBAColor.WHITE)
|
graphics.drawAligned(font, name, TextAlign.TOP_LEFT, x + renderWidth + 12f, y + 7f, RGBAColor.WHITE)
|
||||||
font.drawAligned(stack, formatTickDuration(effect.duration, true), TextAlign.TOP_LEFT, x + renderWidth + 12f, y + 7f + font.lineHeight + 2f, 8355711)
|
graphics.drawAligned(font, formatTickDuration(effect.duration, true), TextAlign.TOP_LEFT, x + renderWidth + 12f, y + 7f + font.lineHeight + 2f, 8355711)
|
||||||
}
|
}
|
||||||
|
|
||||||
return isHovered
|
return isHovered
|
||||||
|
@ -125,7 +125,7 @@ class EntityRendererPanel<out S : Screen> @JvmOverloads constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun innerRender(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) {
|
override fun innerRender(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) {
|
||||||
ExoPackInventoryScreen.ENTITY_RECTANGLE.render(graphics.pose())
|
ExoPackInventoryScreen.ENTITY_RECTANGLE.render(graphics)
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@ -59,37 +59,37 @@ open class FramePanel<out S : Screen>(
|
|||||||
if (isActive) {
|
if (isActive) {
|
||||||
width = TAB_WIDTH_ACTIVE
|
width = TAB_WIDTH_ACTIVE
|
||||||
height = TAB_HEIGHT_ACTIVE
|
height = TAB_HEIGHT_ACTIVE
|
||||||
RECTANGLE.middle.render(stack, 2f, 2f, width - 4, height - 2)
|
RECTANGLE.middle.render(graphics, 2f, 2f, width - 4, height - 2)
|
||||||
} else {
|
} else {
|
||||||
width = TAB_WIDTH
|
width = TAB_WIDTH
|
||||||
height = TAB_HEIGHT
|
height = TAB_HEIGHT
|
||||||
TAB_BACKGROUND.render(stack, 2f, 2f, width - 4, height - 2)
|
TAB_BACKGROUND.render(graphics, 2f, 2f, width - 4, height - 2)
|
||||||
}
|
}
|
||||||
|
|
||||||
RECTANGLE.top.renderWidth(stack, 3f, 0f, width - 6)
|
RECTANGLE.top.renderWidth(graphics, 3f, 0f, width - 6)
|
||||||
RECTANGLE.left.renderHeight(stack, 0f, 3f, (height - if (isActive) if (initial) 2 else 4 else 3))
|
RECTANGLE.left.renderHeight(graphics, 0f, 3f, (height - if (isActive) if (initial) 2 else 4 else 3))
|
||||||
|
|
||||||
RECTANGLE.right.renderHeight(stack, width - RECTANGLE.right.width, 3f, (height - if (isActive) 4 else 3))
|
RECTANGLE.right.renderHeight(graphics, width - RECTANGLE.right.width, 3f, (height - if (isActive) 4 else 3))
|
||||||
|
|
||||||
RECTANGLE.topLeft.render(stack, 0f, 0f)
|
RECTANGLE.topLeft.render(graphics, 0f, 0f)
|
||||||
RECTANGLE.topRight.render(stack, width - RECTANGLE.topRight.width, 0f)
|
RECTANGLE.topRight.render(graphics, width - RECTANGLE.topRight.width, 0f)
|
||||||
|
|
||||||
if (isActive) {
|
if (isActive) {
|
||||||
if (!initial) {
|
if (!initial) {
|
||||||
TAB_LEFT_CONNECTION.render(stack, 0f, height - TAB_LEFT_CONNECTION.height - 1)
|
TAB_LEFT_CONNECTION.render(graphics, 0f, height - TAB_LEFT_CONNECTION.height - 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
TAB_RIGHT_CONNECTION.render(
|
TAB_RIGHT_CONNECTION.render(
|
||||||
stack,
|
graphics,
|
||||||
width - TAB_RIGHT_CONNECTION.width,
|
width - TAB_RIGHT_CONNECTION.width,
|
||||||
height - TAB_LEFT_CONNECTION.height - 1
|
height - TAB_LEFT_CONNECTION.height - 1
|
||||||
)
|
)
|
||||||
|
|
||||||
val skinActive = activeIcon ?: return
|
val skinActive = activeIcon ?: return
|
||||||
skinActive.render(stack, TAB_WIDTH_ACTIVE / 2f - skinActive.width / 2f, TAB_HEIGHT_ACTIVE / 2f - skinActive.height / 2f)
|
skinActive.render(graphics, TAB_WIDTH_ACTIVE / 2f - skinActive.width / 2f, TAB_HEIGHT_ACTIVE / 2f - skinActive.height / 2f)
|
||||||
} else {
|
} else {
|
||||||
val skinInactive = inactiveIcon ?: return
|
val skinInactive = inactiveIcon ?: return
|
||||||
skinInactive.render(stack, width / 2f - skinInactive.width / 2f, TAB_HEIGHT_ACTIVE / 2f - skinInactive.height / 2f)
|
skinInactive.render(graphics, width / 2f - skinInactive.width / 2f, TAB_HEIGHT_ACTIVE / 2f - skinInactive.height / 2f)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -197,12 +197,12 @@ open class FramePanel<out S : Screen>(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun innerRender(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) {
|
override fun innerRender(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) {
|
||||||
RECTANGLE.render(graphics.pose(), width = width, height = height)
|
RECTANGLE.render(graphics, width = width, height = height)
|
||||||
|
|
||||||
// title
|
// title
|
||||||
val title = title ?: return
|
val title = title ?: return
|
||||||
RenderSystem.depthFunc(GL30.GL_ALWAYS)
|
RenderSystem.depthFunc(GL30.GL_ALWAYS)
|
||||||
font.drawAligned(graphics.pose(), title, TextAlign.TOP_LEFT, 8f, 5f, 4210752)
|
graphics.drawAligned(font, title, TextAlign.TOP_LEFT, 8f, 5f, 4210752)
|
||||||
RenderSystem.depthFunc(GL30.GL_ALWAYS)
|
RenderSystem.depthFunc(GL30.GL_ALWAYS)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,19 +32,19 @@ open class Label<out S : Screen> @JvmOverloads constructor(
|
|||||||
var align = TextAlign.TOP_LEFT
|
var align = TextAlign.TOP_LEFT
|
||||||
|
|
||||||
override fun innerRender(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) {
|
override fun innerRender(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) {
|
||||||
clearDepth(graphics.pose())
|
clearDepth(graphics)
|
||||||
|
|
||||||
if (shadow) {
|
if (shadow) {
|
||||||
when (align) {
|
when (align) {
|
||||||
TextAlign.TOP_LEFT -> font.drawAligned(graphics.pose(), text, align, shadowX, shadowY, shadowColor.toInt())
|
TextAlign.TOP_LEFT -> graphics.drawAligned(font, text, align, shadowX, shadowY, shadowColor.toInt())
|
||||||
TextAlign.TOP_CENTER -> font.drawAligned(graphics.pose(), text, align, shadowX + width / 2f, shadowY, shadowColor.toInt())
|
TextAlign.TOP_CENTER -> graphics.drawAligned(font, text, align, shadowX + width / 2f, shadowY, shadowColor.toInt())
|
||||||
TextAlign.TOP_RIGHT -> font.drawAligned(graphics.pose(), text, align, shadowX + width, shadowY, shadowColor.toInt())
|
TextAlign.TOP_RIGHT -> graphics.drawAligned(font, text, align, shadowX + width, shadowY, shadowColor.toInt())
|
||||||
TextAlign.CENTER_LEFT -> font.drawAligned(graphics.pose(), text, align, shadowX, height / 2f + shadowY, shadowColor.toInt())
|
TextAlign.CENTER_LEFT -> graphics.drawAligned(font, text, align, shadowX, height / 2f + shadowY, shadowColor.toInt())
|
||||||
TextAlign.CENTER_CENTER -> font.drawAligned(graphics.pose(), text, align, shadowX + width / 2f, height / 2f + shadowY, shadowColor.toInt())
|
TextAlign.CENTER_CENTER -> graphics.drawAligned(font, text, align, shadowX + width / 2f, height / 2f + shadowY, shadowColor.toInt())
|
||||||
TextAlign.CENTER_RIGHT -> font.drawAligned(graphics.pose(), text, align, shadowX + width, height / 2f + shadowY, shadowColor.toInt())
|
TextAlign.CENTER_RIGHT -> graphics.drawAligned(font, text, align, shadowX + width, height / 2f + shadowY, shadowColor.toInt())
|
||||||
TextAlign.BOTTOM_LEFT -> font.drawAligned(graphics.pose(), text, align, shadowX, height + shadowY, shadowColor.toInt())
|
TextAlign.BOTTOM_LEFT -> graphics.drawAligned(font, text, align, shadowX, height + shadowY, shadowColor.toInt())
|
||||||
TextAlign.BOTTOM_CENTER -> font.drawAligned(graphics.pose(), text, align, shadowX + width / 2f, height + shadowY, shadowColor.toInt())
|
TextAlign.BOTTOM_CENTER -> graphics.drawAligned(font, text, align, shadowX + width / 2f, height + shadowY, shadowColor.toInt())
|
||||||
TextAlign.BOTTOM_RIGHT -> font.drawAligned(graphics.pose(), text, align, shadowX + width, height + shadowY, shadowColor.toInt())
|
TextAlign.BOTTOM_RIGHT -> graphics.drawAligned(font, text, align, shadowX + width, height + shadowY, shadowColor.toInt())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@ package ru.dbotthepony.mc.otm.client.screen.panels
|
|||||||
|
|
||||||
import com.mojang.blaze3d.systems.RenderSystem
|
import com.mojang.blaze3d.systems.RenderSystem
|
||||||
import com.mojang.blaze3d.vertex.PoseStack
|
import com.mojang.blaze3d.vertex.PoseStack
|
||||||
|
import net.minecraft.client.gui.GuiGraphics
|
||||||
import net.minecraft.client.gui.components.AbstractWidget
|
import net.minecraft.client.gui.components.AbstractWidget
|
||||||
import net.minecraft.client.gui.screens.Screen
|
import net.minecraft.client.gui.screens.Screen
|
||||||
import org.lwjgl.opengl.GL11
|
import org.lwjgl.opengl.GL11
|
||||||
@ -89,9 +90,9 @@ abstract class Widget2Panel<out S : Screen, T : AbstractWidget>(
|
|||||||
return instance
|
return instance
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun innerRender(stack: PoseStack, mouseX: Float, mouseY: Float, partialTick: Float) {
|
override fun innerRender(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) {
|
||||||
RenderSystem.depthFunc(GL11.GL_ALWAYS)
|
RenderSystem.depthFunc(GL11.GL_ALWAYS)
|
||||||
getOrCreateWidget().render(stack, mouseX.toInt(), mouseY.toInt(), partialTick)
|
getOrCreateWidget().render(graphics, mouseX.toInt(), mouseY.toInt(), partialTick)
|
||||||
RenderSystem.depthFunc(GL11.GL_ALWAYS)
|
RenderSystem.depthFunc(GL11.GL_ALWAYS)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@ package ru.dbotthepony.mc.otm.client.screen.panels.button
|
|||||||
|
|
||||||
import com.mojang.blaze3d.vertex.PoseStack
|
import com.mojang.blaze3d.vertex.PoseStack
|
||||||
import net.minecraft.ChatFormatting
|
import net.minecraft.ChatFormatting
|
||||||
|
import net.minecraft.client.gui.GuiGraphics
|
||||||
import net.minecraft.client.gui.screens.Screen
|
import net.minecraft.client.gui.screens.Screen
|
||||||
import net.minecraft.network.chat.Component
|
import net.minecraft.network.chat.Component
|
||||||
import ru.dbotthepony.mc.otm.client.minecraft
|
import ru.dbotthepony.mc.otm.client.minecraft
|
||||||
@ -32,7 +33,7 @@ abstract class BooleanRectangleButtonPanel<out S : Screen>(
|
|||||||
onChange?.invoke(newValue)
|
onChange?.invoke(newValue)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun innerRenderTooltips(stack: PoseStack, mouseX: Float, mouseY: Float, partialTick: Float): Boolean {
|
override fun innerRenderTooltips(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float): Boolean {
|
||||||
if (isHovered) {
|
if (isHovered) {
|
||||||
val tooltipActive = tooltipActive
|
val tooltipActive = tooltipActive
|
||||||
val tooltipInactive = tooltipInactive
|
val tooltipInactive = tooltipInactive
|
||||||
@ -62,11 +63,11 @@ abstract class BooleanRectangleButtonPanel<out S : Screen>(
|
|||||||
tooltips.add(tooltipInactive.copy().withStyle(if (!prop.get()) ChatFormatting.WHITE else ChatFormatting.GRAY))
|
tooltips.add(tooltipInactive.copy().withStyle(if (!prop.get()) ChatFormatting.WHITE else ChatFormatting.GRAY))
|
||||||
}
|
}
|
||||||
|
|
||||||
screen.renderComponentTooltip(stack, tooltips, mouseX.toInt(), mouseY.toInt(), font)
|
graphics.renderComponentTooltip(font, tooltips, mouseX.toInt(), mouseY.toInt())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return super.innerRenderTooltips(stack, mouseX, mouseY, partialTick)
|
return super.innerRenderTooltips(graphics, mouseX, mouseY, partialTick)
|
||||||
}
|
}
|
||||||
|
|
||||||
override var isDisabled: Boolean
|
override var isDisabled: Boolean
|
||||||
@ -79,13 +80,13 @@ abstract class BooleanRectangleButtonPanel<out S : Screen>(
|
|||||||
}
|
}
|
||||||
set(value) { super.isDisabled = value }
|
set(value) { super.isDisabled = value }
|
||||||
|
|
||||||
override fun innerRender(stack: PoseStack, mouseX: Float, mouseY: Float, partialTick: Float) {
|
override fun innerRender(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) {
|
||||||
super.innerRender(stack, mouseX, mouseY, partialTick)
|
super.innerRender(graphics, mouseX, mouseY, partialTick)
|
||||||
|
|
||||||
if (prop.value) {
|
if (prop.value) {
|
||||||
skinElementActive?.render(stack, width = width, height = height)
|
skinElementActive?.render(graphics, width = width, height = height)
|
||||||
} else {
|
} else {
|
||||||
skinElementInactive?.render(stack, width = width, height = height)
|
skinElementInactive?.render(graphics, width = width, height = height)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package ru.dbotthepony.mc.otm.client.screen.panels.button
|
package ru.dbotthepony.mc.otm.client.screen.panels.button
|
||||||
|
|
||||||
import com.mojang.blaze3d.vertex.PoseStack
|
import com.mojang.blaze3d.vertex.PoseStack
|
||||||
|
import net.minecraft.client.gui.GuiGraphics
|
||||||
import net.minecraft.client.gui.screens.Screen
|
import net.minecraft.client.gui.screens.Screen
|
||||||
import net.minecraft.network.chat.Component
|
import net.minecraft.network.chat.Component
|
||||||
import ru.dbotthepony.mc.otm.client.playGuiClickSound
|
import ru.dbotthepony.mc.otm.client.playGuiClickSound
|
||||||
@ -40,21 +41,21 @@ open class ButtonPanel<out S : Screen>(
|
|||||||
onPress?.accept(mouseButton)
|
onPress?.accept(mouseButton)
|
||||||
}
|
}
|
||||||
|
|
||||||
protected fun renderStretchableBackground(stack: PoseStack, mouseX: Float, mouseY: Float, partialTick: Float) {
|
protected fun renderStretchableBackground(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) {
|
||||||
if (isDisabled) {
|
if (isDisabled) {
|
||||||
Widgets18.BUTTON_DISABLED_STRETCHABLE.render(stack, width = width, height = height)
|
Widgets18.BUTTON_DISABLED_STRETCHABLE.render(graphics, width = width, height = height)
|
||||||
} else if (isPressed) {
|
} else if (isPressed) {
|
||||||
Widgets18.BUTTON_PRESSED_STRETCHABLE.render(stack, width = width, height = height)
|
Widgets18.BUTTON_PRESSED_STRETCHABLE.render(graphics, width = width, height = height)
|
||||||
} else if (isHovered) {
|
} else if (isHovered) {
|
||||||
Widgets18.BUTTON_HOVERED_STRETCHABLE.render(stack, width = width, height = height)
|
Widgets18.BUTTON_HOVERED_STRETCHABLE.render(graphics, width = width, height = height)
|
||||||
} else {
|
} else {
|
||||||
Widgets18.BUTTON_IDLE_STRETCHABLE.render(stack, width = width, height = height)
|
Widgets18.BUTTON_IDLE_STRETCHABLE.render(graphics, width = width, height = height)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun innerRender(stack: PoseStack, mouseX: Float, mouseY: Float, partialTick: Float) {
|
override fun innerRender(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) {
|
||||||
renderStretchableBackground(stack, mouseX, mouseY, partialTick)
|
renderStretchableBackground(graphics, mouseX, mouseY, partialTick)
|
||||||
font.drawAligned(stack, label, TextAlign.CENTER_CENTER, width / 2f, height / 2f, textColor.toInt())
|
graphics.drawAligned(font, label, TextAlign.CENTER_CENTER, width / 2f, height / 2f, textColor.toInt())
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun sizeToContents() {
|
override fun sizeToContents() {
|
||||||
|
@ -3,6 +3,7 @@ package ru.dbotthepony.mc.otm.client.screen.panels.button
|
|||||||
import com.mojang.blaze3d.platform.InputConstants
|
import com.mojang.blaze3d.platform.InputConstants
|
||||||
import com.mojang.blaze3d.vertex.PoseStack
|
import com.mojang.blaze3d.vertex.PoseStack
|
||||||
import it.unimi.dsi.fastutil.booleans.BooleanConsumer
|
import it.unimi.dsi.fastutil.booleans.BooleanConsumer
|
||||||
|
import net.minecraft.client.gui.GuiGraphics
|
||||||
import net.minecraft.client.gui.screens.Screen
|
import net.minecraft.client.gui.screens.Screen
|
||||||
import ru.dbotthepony.mc.otm.client.playGuiClickSound
|
import ru.dbotthepony.mc.otm.client.playGuiClickSound
|
||||||
import ru.dbotthepony.mc.otm.client.render.AbstractMatterySprite
|
import ru.dbotthepony.mc.otm.client.render.AbstractMatterySprite
|
||||||
@ -30,38 +31,38 @@ open class CheckBoxPanel<out S : Screen> @JvmOverloads constructor(
|
|||||||
open val DISABLED_UNCHECKED: AbstractMatterySprite = Companion.DISABLED_UNCHECKED
|
open val DISABLED_UNCHECKED: AbstractMatterySprite = Companion.DISABLED_UNCHECKED
|
||||||
open val DISABLED_CHECKED: AbstractMatterySprite = Companion.DISABLED_CHECKED
|
open val DISABLED_CHECKED: AbstractMatterySprite = Companion.DISABLED_CHECKED
|
||||||
|
|
||||||
protected fun renderCheckboxBackground(stack: PoseStack, mouseX: Float, mouseY: Float, partialTick: Float) {
|
protected fun renderCheckboxBackground(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) {
|
||||||
if (isDisabled) {
|
if (isDisabled) {
|
||||||
if (isChecked) {
|
if (isChecked) {
|
||||||
DISABLED_CHECKED.render(stack, width = width, height = height)
|
DISABLED_CHECKED.render(graphics, width = width, height = height)
|
||||||
} else {
|
} else {
|
||||||
DISABLED_UNCHECKED.render(stack, width = width, height = height)
|
DISABLED_UNCHECKED.render(graphics, width = width, height = height)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (isPressed) {
|
if (isPressed) {
|
||||||
if (isChecked) {
|
if (isChecked) {
|
||||||
PRESSED_CHECKED.render(stack, width = width, height = height)
|
PRESSED_CHECKED.render(graphics, width = width, height = height)
|
||||||
} else {
|
} else {
|
||||||
PRESSED_UNCHECKED.render(stack, width = width, height = height)
|
PRESSED_UNCHECKED.render(graphics, width = width, height = height)
|
||||||
}
|
}
|
||||||
} else if (isHovered) {
|
} else if (isHovered) {
|
||||||
if (isChecked) {
|
if (isChecked) {
|
||||||
HOVERED_CHECKED.render(stack, width = width, height = height)
|
HOVERED_CHECKED.render(graphics, width = width, height = height)
|
||||||
} else {
|
} else {
|
||||||
HOVERED_UNCHECKED.render(stack, width = width, height = height)
|
HOVERED_UNCHECKED.render(graphics, width = width, height = height)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (isChecked) {
|
if (isChecked) {
|
||||||
IDLE_CHECKED.render(stack, width = width, height = height)
|
IDLE_CHECKED.render(graphics, width = width, height = height)
|
||||||
} else {
|
} else {
|
||||||
IDLE_UNCHECKED.render(stack, width = width, height = height)
|
IDLE_UNCHECKED.render(graphics, width = width, height = height)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun innerRender(stack: PoseStack, mouseX: Float, mouseY: Float, partialTick: Float) {
|
override fun innerRender(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) {
|
||||||
renderCheckboxBackground(stack, mouseX, mouseY, partialTick)
|
renderCheckboxBackground(graphics, mouseX, mouseY, partialTick)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onClick(mouseButton: Int) {
|
override fun onClick(mouseButton: Int) {
|
||||||
|
@ -3,6 +3,7 @@ package ru.dbotthepony.mc.otm.client.screen.panels.button
|
|||||||
import com.mojang.blaze3d.platform.InputConstants
|
import com.mojang.blaze3d.platform.InputConstants
|
||||||
import com.mojang.blaze3d.vertex.PoseStack
|
import com.mojang.blaze3d.vertex.PoseStack
|
||||||
import net.minecraft.ChatFormatting
|
import net.minecraft.ChatFormatting
|
||||||
|
import net.minecraft.client.gui.GuiGraphics
|
||||||
import net.minecraft.client.gui.screens.Screen
|
import net.minecraft.client.gui.screens.Screen
|
||||||
import net.minecraft.network.chat.Component
|
import net.minecraft.network.chat.Component
|
||||||
import ru.dbotthepony.mc.otm.client.minecraft
|
import ru.dbotthepony.mc.otm.client.minecraft
|
||||||
@ -74,11 +75,11 @@ abstract class EnumRectangleButtonPanel<out S : Screen, T : Enum<T>>(
|
|||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun innerRender(stack: PoseStack, mouseX: Float, mouseY: Float, partialTick: Float) {
|
override fun innerRender(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) {
|
||||||
check(!isBuilding) { "Still building this button!" }
|
check(!isBuilding) { "Still building this button!" }
|
||||||
super.innerRender(stack, mouseX, mouseY, partialTick)
|
super.innerRender(graphics, mouseX, mouseY, partialTick)
|
||||||
val entry = enumMapping[prop.get()] ?: return
|
val entry = enumMapping[prop.get()] ?: return
|
||||||
entry.skinElement?.render(stack, 0f, 0f, width, height, entry.winding)
|
entry.skinElement?.render(graphics, 0f, 0f, width, height, entry.winding)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun mouseClickedInner(x: Double, y: Double, button: Int): Boolean {
|
override fun mouseClickedInner(x: Double, y: Double, button: Int): Boolean {
|
||||||
@ -148,13 +149,13 @@ abstract class EnumRectangleButtonPanel<out S : Screen, T : Enum<T>>(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun innerRenderTooltips(stack: PoseStack, mouseX: Float, mouseY: Float, partialTick: Float): Boolean {
|
override fun innerRenderTooltips(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float): Boolean {
|
||||||
if (!isHovered && !isGrabbingMouseInput()) {
|
if (!isHovered && !isGrabbingMouseInput()) {
|
||||||
return super.innerRenderTooltips(stack, mouseX, mouseY, partialTick)
|
return super.innerRenderTooltips(graphics, mouseX, mouseY, partialTick)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tooltip == null && tooltipList == null && enumMapping.entries.none { predicate.test(it.key) && it.value.tooltip != null }) {
|
if (tooltip == null && tooltipList == null && enumMapping.entries.none { predicate.test(it.key) && it.value.tooltip != null }) {
|
||||||
return super.innerRenderTooltips(stack, mouseX, mouseY, partialTick)
|
return super.innerRenderTooltips(graphics, mouseX, mouseY, partialTick)
|
||||||
}
|
}
|
||||||
|
|
||||||
val listing = ArrayList<Component>()
|
val listing = ArrayList<Component>()
|
||||||
@ -175,7 +176,7 @@ abstract class EnumRectangleButtonPanel<out S : Screen, T : Enum<T>>(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
screen.renderComponentTooltip(stack, listing, mouseX.toInt(), mouseY.toInt(), font)
|
graphics.renderComponentTooltip(font, listing, mouseX.toInt(), mouseY.toInt())
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package ru.dbotthepony.mc.otm.client.screen.panels.button
|
package ru.dbotthepony.mc.otm.client.screen.panels.button
|
||||||
|
|
||||||
import com.mojang.blaze3d.vertex.PoseStack
|
import com.mojang.blaze3d.vertex.PoseStack
|
||||||
|
import net.minecraft.client.gui.GuiGraphics
|
||||||
import net.minecraft.client.gui.screens.Screen
|
import net.minecraft.client.gui.screens.Screen
|
||||||
import ru.dbotthepony.mc.otm.client.render.AbstractMatterySprite
|
import ru.dbotthepony.mc.otm.client.render.AbstractMatterySprite
|
||||||
import ru.dbotthepony.mc.otm.client.render.UVWindingOrder
|
import ru.dbotthepony.mc.otm.client.render.UVWindingOrder
|
||||||
@ -23,13 +24,13 @@ open class LargeRectangleButtonPanel<out S : Screen>(
|
|||||||
final override val PRESSED = Widgets18.BUTTON_PRESSED
|
final override val PRESSED = Widgets18.BUTTON_PRESSED
|
||||||
final override val DISABLED = Widgets18.BUTTON_DISABLED
|
final override val DISABLED = Widgets18.BUTTON_DISABLED
|
||||||
|
|
||||||
override fun innerRender(stack: PoseStack, mouseX: Float, mouseY: Float, partialTick: Float) {
|
override fun innerRender(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) {
|
||||||
super.innerRender(stack, mouseX, mouseY, partialTick)
|
super.innerRender(graphics, mouseX, mouseY, partialTick)
|
||||||
|
|
||||||
if (skinElementWinding != null) {
|
if (skinElementWinding != null) {
|
||||||
skinElement?.render(stack, width = width, height = height, winding = skinElementWinding)
|
skinElement?.render(graphics, width = width, height = height, winding = skinElementWinding)
|
||||||
} else {
|
} else {
|
||||||
skinElement?.render(stack, width = width, height = height)
|
skinElement?.render(graphics, width = width, height = height)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package ru.dbotthepony.mc.otm.client.screen.panels.button
|
package ru.dbotthepony.mc.otm.client.screen.panels.button
|
||||||
|
|
||||||
import com.mojang.blaze3d.vertex.PoseStack
|
import com.mojang.blaze3d.vertex.PoseStack
|
||||||
|
import net.minecraft.client.gui.GuiGraphics
|
||||||
import net.minecraft.client.gui.screens.Screen
|
import net.minecraft.client.gui.screens.Screen
|
||||||
import ru.dbotthepony.mc.otm.client.playGuiClickSound
|
import ru.dbotthepony.mc.otm.client.playGuiClickSound
|
||||||
import ru.dbotthepony.mc.otm.client.render.AbstractMatterySprite
|
import ru.dbotthepony.mc.otm.client.render.AbstractMatterySprite
|
||||||
@ -27,19 +28,19 @@ abstract class RectangleButtonPanel<out S : Screen>(
|
|||||||
onPress?.accept(mouseButton)
|
onPress?.accept(mouseButton)
|
||||||
}
|
}
|
||||||
|
|
||||||
protected fun renderSquareButton(stack: PoseStack, mouseX: Float, mouseY: Float, partialTick: Float) {
|
protected fun renderSquareButton(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) {
|
||||||
if (isDisabled) {
|
if (isDisabled) {
|
||||||
DISABLED.render(stack, 0f, 0f, width, height)
|
DISABLED.render(graphics, 0f, 0f, width, height)
|
||||||
} else if (isPressed) {
|
} else if (isPressed) {
|
||||||
PRESSED.render(stack, 0f, 0f, width, height)
|
PRESSED.render(graphics, 0f, 0f, width, height)
|
||||||
} else if (isHovered) {
|
} else if (isHovered) {
|
||||||
HOVERED.render(stack, 0f, 0f, width, height)
|
HOVERED.render(graphics, 0f, 0f, width, height)
|
||||||
} else {
|
} else {
|
||||||
IDLE.render(stack, 0f, 0f, width, height)
|
IDLE.render(graphics, 0f, 0f, width, height)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun innerRender(stack: PoseStack, mouseX: Float, mouseY: Float, partialTick: Float) {
|
override fun innerRender(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) {
|
||||||
renderSquareButton(stack, mouseX, mouseY, partialTick)
|
renderSquareButton(graphics, mouseX, mouseY, partialTick)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package ru.dbotthepony.mc.otm.client.screen.panels.button
|
package ru.dbotthepony.mc.otm.client.screen.panels.button
|
||||||
|
|
||||||
import com.mojang.blaze3d.vertex.PoseStack
|
import com.mojang.blaze3d.vertex.PoseStack
|
||||||
|
import net.minecraft.client.gui.GuiGraphics
|
||||||
import net.minecraft.client.gui.screens.Screen
|
import net.minecraft.client.gui.screens.Screen
|
||||||
import ru.dbotthepony.mc.otm.client.render.MatterySprite
|
import ru.dbotthepony.mc.otm.client.render.MatterySprite
|
||||||
import ru.dbotthepony.mc.otm.client.render.UVWindingOrder
|
import ru.dbotthepony.mc.otm.client.render.UVWindingOrder
|
||||||
@ -23,13 +24,13 @@ open class SmallRectangleButtonPanel<out S : Screen>(
|
|||||||
final override val PRESSED = Widgets8.BUTTON_PRESSED
|
final override val PRESSED = Widgets8.BUTTON_PRESSED
|
||||||
final override val DISABLED = Widgets8.BUTTON_DISABLED
|
final override val DISABLED = Widgets8.BUTTON_DISABLED
|
||||||
|
|
||||||
override fun innerRender(stack: PoseStack, mouseX: Float, mouseY: Float, partialTick: Float) {
|
override fun innerRender(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) {
|
||||||
super.innerRender(stack, mouseX, mouseY, partialTick)
|
super.innerRender(graphics, mouseX, mouseY, partialTick)
|
||||||
|
|
||||||
if (skinElementWinding != null) {
|
if (skinElementWinding != null) {
|
||||||
skinElement?.render(stack, width = width, height = height, winding = skinElementWinding)
|
skinElement?.render(graphics, width = width, height = height, winding = skinElementWinding)
|
||||||
} else {
|
} else {
|
||||||
skinElement?.render(stack, width = width, height = height)
|
skinElement?.render(graphics, width = width, height = height)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@ import it.unimi.dsi.fastutil.chars.Char2IntOpenHashMap
|
|||||||
import it.unimi.dsi.fastutil.chars.CharOpenHashSet
|
import it.unimi.dsi.fastutil.chars.CharOpenHashSet
|
||||||
import it.unimi.dsi.fastutil.ints.Int2ObjectAVLTreeMap
|
import it.unimi.dsi.fastutil.ints.Int2ObjectAVLTreeMap
|
||||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap
|
import it.unimi.dsi.fastutil.ints.Int2ObjectMap
|
||||||
|
import net.minecraft.client.gui.GuiGraphics
|
||||||
import net.minecraft.client.gui.screens.Screen
|
import net.minecraft.client.gui.screens.Screen
|
||||||
import net.minecraft.client.renderer.GameRenderer
|
import net.minecraft.client.renderer.GameRenderer
|
||||||
import net.minecraft.network.chat.Component
|
import net.minecraft.network.chat.Component
|
||||||
@ -1071,9 +1072,9 @@ open class TextInputPanel<out S : Screen>(
|
|||||||
return accumulate
|
return accumulate
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun innerRender(stack: PoseStack, mouseX: Float, mouseY: Float, partialTick: Float) {
|
override fun innerRender(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) {
|
||||||
if (!backgroundColor.isFullyTransparent)
|
if (!backgroundColor.isFullyTransparent)
|
||||||
drawRect(stack, 0f, 0f, width, height, backgroundColor)
|
drawRect(graphics, 0f, 0f, width, height, backgroundColor)
|
||||||
|
|
||||||
var topPadding = dockPadding.top
|
var topPadding = dockPadding.top
|
||||||
|
|
||||||
@ -1107,15 +1108,16 @@ open class TextInputPanel<out S : Screen>(
|
|||||||
scrollPixels = 0f
|
scrollPixels = 0f
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val stack = graphics.pose()
|
||||||
|
|
||||||
stack.pushPose()
|
stack.pushPose()
|
||||||
stack.translate(-scrollPixels, 0f, 0f)
|
stack.translate(-scrollPixels, 0f, 0f)
|
||||||
|
|
||||||
var y = topPadding
|
var y = topPadding
|
||||||
|
|
||||||
if (lines.isEmpty() || lines.size == 1 && lines[0] == "") {
|
if (lines.isEmpty() || lines.size == 1 && lines[0] == "") {
|
||||||
font.drawAligned(
|
graphics.drawAligned(
|
||||||
poseStack = stack,
|
font = font,
|
||||||
buffer = BUFFER,
|
|
||||||
text = placeholder,
|
text = placeholder,
|
||||||
align = TextAlign.TOP_LEFT,
|
align = TextAlign.TOP_LEFT,
|
||||||
x = dockPadding.left,
|
x = dockPadding.left,
|
||||||
@ -1128,9 +1130,8 @@ open class TextInputPanel<out S : Screen>(
|
|||||||
val line = lines[i]
|
val line = lines[i]
|
||||||
val selection = selections[i]
|
val selection = selections[i]
|
||||||
|
|
||||||
font.drawAligned(
|
graphics.drawAligned(
|
||||||
poseStack = stack,
|
font = font,
|
||||||
buffer = BUFFER,
|
|
||||||
text = line,
|
text = line,
|
||||||
align = TextAlign.TOP_LEFT,
|
align = TextAlign.TOP_LEFT,
|
||||||
x = dockPadding.left,
|
x = dockPadding.left,
|
||||||
@ -1182,9 +1183,8 @@ open class TextInputPanel<out S : Screen>(
|
|||||||
val activeLine = this[cursorLine]
|
val activeLine = this[cursorLine]
|
||||||
|
|
||||||
if (activeLine == null || cursorRow >= activeLine.length) {
|
if (activeLine == null || cursorRow >= activeLine.length) {
|
||||||
font.drawAligned(
|
graphics.drawAligned(
|
||||||
poseStack = stack,
|
font = font,
|
||||||
buffer = BUFFER,
|
|
||||||
text = "_",
|
text = "_",
|
||||||
align = TextAlign.TOP_LEFT,
|
align = TextAlign.TOP_LEFT,
|
||||||
x = dockPadding.left + (if (activeLine == null) 0f else font.width(activeLine).toFloat()),
|
x = dockPadding.left + (if (activeLine == null) 0f else font.width(activeLine).toFloat()),
|
||||||
@ -1192,9 +1192,8 @@ open class TextInputPanel<out S : Screen>(
|
|||||||
color = cursorColor
|
color = cursorColor
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
font.drawAligned(
|
graphics.drawAligned(
|
||||||
poseStack = stack,
|
font = font,
|
||||||
buffer = BUFFER,
|
|
||||||
text = "|",
|
text = "|",
|
||||||
align = TextAlign.TOP_LEFT,
|
align = TextAlign.TOP_LEFT,
|
||||||
x = dockPadding.left + font.width(activeLine.substring(0, cursorRow)).toFloat() - 1f,
|
x = dockPadding.left + font.width(activeLine.substring(0, cursorRow)).toFloat() - 1f,
|
||||||
@ -1207,9 +1206,8 @@ open class TextInputPanel<out S : Screen>(
|
|||||||
stack.popPose()
|
stack.popPose()
|
||||||
|
|
||||||
if (debugDraw) {
|
if (debugDraw) {
|
||||||
font.drawAligned(
|
graphics.drawAligned(
|
||||||
poseStack = stack,
|
font = font,
|
||||||
buffer = BUFFER,
|
|
||||||
text = cursorLine.toString(),
|
text = cursorLine.toString(),
|
||||||
align = TextAlign.TOP_RIGHT,
|
align = TextAlign.TOP_RIGHT,
|
||||||
x = width,
|
x = width,
|
||||||
@ -1217,9 +1215,8 @@ open class TextInputPanel<out S : Screen>(
|
|||||||
color = cursorColor
|
color = cursorColor
|
||||||
)
|
)
|
||||||
|
|
||||||
font.drawAligned(
|
graphics.drawAligned(
|
||||||
poseStack = stack,
|
font = font,
|
||||||
buffer = BUFFER,
|
|
||||||
text = cursorRow.toString(),
|
text = cursorRow.toString(),
|
||||||
align = TextAlign.TOP_RIGHT,
|
align = TextAlign.TOP_RIGHT,
|
||||||
x = width - dockPadding.right,
|
x = width - dockPadding.right,
|
||||||
@ -1227,9 +1224,8 @@ open class TextInputPanel<out S : Screen>(
|
|||||||
color = cursorColor
|
color = cursorColor
|
||||||
)
|
)
|
||||||
|
|
||||||
font.drawAligned(
|
graphics.drawAligned(
|
||||||
poseStack = stack,
|
font = font,
|
||||||
buffer = BUFFER,
|
|
||||||
text = lines.size.toString(),
|
text = lines.size.toString(),
|
||||||
align = TextAlign.TOP_RIGHT,
|
align = TextAlign.TOP_RIGHT,
|
||||||
x = width - dockPadding.right,
|
x = width - dockPadding.right,
|
||||||
|
@ -2,6 +2,8 @@ package ru.dbotthepony.mc.otm.client.screen.panels.slot
|
|||||||
|
|
||||||
import com.mojang.blaze3d.systems.RenderSystem
|
import com.mojang.blaze3d.systems.RenderSystem
|
||||||
import com.mojang.blaze3d.vertex.PoseStack
|
import com.mojang.blaze3d.vertex.PoseStack
|
||||||
|
import net.minecraft.client.gui.GuiGraphics
|
||||||
|
import net.minecraft.client.gui.screens.Screen.getTooltipFromItem
|
||||||
import net.minecraft.client.renderer.GameRenderer
|
import net.minecraft.client.renderer.GameRenderer
|
||||||
import net.minecraft.network.chat.Component
|
import net.minecraft.network.chat.Component
|
||||||
import net.minecraft.world.item.ItemStack
|
import net.minecraft.world.item.ItemStack
|
||||||
@ -21,51 +23,50 @@ abstract class AbstractSlotPanel<out S : MatteryScreen<*>> @JvmOverloads constru
|
|||||||
height: Float = SIZE,
|
height: Float = SIZE,
|
||||||
open val noItemIcon: MatterySprite? = null
|
open val noItemIcon: MatterySprite? = null
|
||||||
) : EditablePanel<S>(screen, parent, x, y, width, height), IItemStackPanel {
|
) : EditablePanel<S>(screen, parent, x, y, width, height), IItemStackPanel {
|
||||||
protected open fun renderSlotBackground(stack: PoseStack, mouseX: Float, mouseY: Float, partialTick: Float) {
|
protected open fun renderSlotBackground(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) {
|
||||||
SLOT_BACKGROUND.render(stack, width = width, height = height)
|
SLOT_BACKGROUND.render(graphics, width = width, height = height)
|
||||||
}
|
}
|
||||||
|
|
||||||
protected open fun renderRegular(stack: PoseStack, itemstack: ItemStack, countOverride: String? = null) {
|
protected open fun renderRegular(graphics: GuiGraphics, itemstack: ItemStack, countOverride: String? = null) {
|
||||||
RenderSystem.setShader(GameRenderer::getPositionTexShader)
|
RenderSystem.setShader(GameRenderer::getPositionTexShader)
|
||||||
|
|
||||||
if (!itemstack.isEmpty) {
|
if (!itemstack.isEmpty) {
|
||||||
screen.renderItemStack(stack, itemstack, countOverride)
|
screen.renderItemStack(graphics, itemstack, countOverride)
|
||||||
clearDepth(stack)
|
clearDepth(graphics)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isHovered) {
|
if (isHovered) {
|
||||||
drawColor = SLOT_HIGHLIGHT
|
drawColor = SLOT_HIGHLIGHT
|
||||||
drawRect(stack, 1f, 1f, width - 1, height - 1)
|
drawRect(graphics, 1f, 1f, width - 1, height - 1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected open fun getItemStackTooltip(stack: ItemStack): List<Component> {
|
protected open fun getItemStackTooltip(stack: ItemStack): List<Component> {
|
||||||
return screen.getTooltipFromItem(stack)
|
return getTooltipFromItem(ru.dbotthepony.mc.otm.client.minecraft, stack)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun innerRender(stack: PoseStack, mouseX: Float, mouseY: Float, partialTick: Float) {
|
override fun innerRender(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) {
|
||||||
renderSlotBackground(stack, mouseX, mouseY, partialTick)
|
renderSlotBackground(graphics, mouseX, mouseY, partialTick)
|
||||||
val itemStack = itemStack
|
val itemStack = itemStack
|
||||||
renderRegular(stack, itemStack)
|
renderRegular(graphics, itemStack)
|
||||||
|
|
||||||
if (itemStack.isEmpty) {
|
if (itemStack.isEmpty) {
|
||||||
noItemIcon?.render(stack, width = width, height = height)
|
noItemIcon?.render(graphics, width = width, height = height)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun innerRenderTooltips(stack: PoseStack, mouseX: Float, mouseY: Float, partialTick: Float): Boolean {
|
override fun innerRenderTooltips(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float): Boolean {
|
||||||
if (isHovered) {
|
if (isHovered) {
|
||||||
val itemstack = itemStack
|
val itemstack = itemStack
|
||||||
|
|
||||||
if (!itemstack.isEmpty) {
|
if (!itemstack.isEmpty) {
|
||||||
val font = IClientItemExtensions.of(itemstack).getFont(itemstack, IClientItemExtensions.FontContext.TOOLTIP)
|
val font = IClientItemExtensions.of(itemstack).getFont(itemstack, IClientItemExtensions.FontContext.TOOLTIP)
|
||||||
|
|
||||||
screen.renderComponentTooltip(
|
graphics.renderComponentTooltip(
|
||||||
stack,
|
font ?: screen.font,
|
||||||
getItemStackTooltip(itemstack),
|
getItemStackTooltip(itemstack),
|
||||||
mouseX.toInt(),
|
mouseX.toInt(),
|
||||||
mouseY.toInt(),
|
mouseY.toInt(),
|
||||||
font ?: screen.font,
|
|
||||||
itemstack
|
itemstack
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ package ru.dbotthepony.mc.otm.client.screen.panels.slot
|
|||||||
import com.mojang.blaze3d.systems.RenderSystem
|
import com.mojang.blaze3d.systems.RenderSystem
|
||||||
import com.mojang.blaze3d.vertex.PoseStack
|
import com.mojang.blaze3d.vertex.PoseStack
|
||||||
import net.minecraft.ChatFormatting
|
import net.minecraft.ChatFormatting
|
||||||
import net.minecraft.client.gui.GuiComponent
|
import net.minecraft.client.gui.GuiGraphics
|
||||||
import net.minecraft.client.renderer.GameRenderer
|
import net.minecraft.client.renderer.GameRenderer
|
||||||
import net.minecraft.world.inventory.AbstractContainerMenu
|
import net.minecraft.world.inventory.AbstractContainerMenu
|
||||||
import net.minecraft.world.inventory.Slot
|
import net.minecraft.world.inventory.Slot
|
||||||
@ -56,10 +56,10 @@ open class SlotPanel<out S : MatteryScreen<*>, out T : Slot> @JvmOverloads const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun innerRender(stack: PoseStack, mouseX: Float, mouseY: Float, partialTick: Float) {
|
override fun innerRender(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) {
|
||||||
slot.x = absoluteX.roundToInt() - screen.guiLeft
|
slot.x = absoluteX.roundToInt() - screen.guiLeft
|
||||||
slot.y = absoluteY.roundToInt() - screen.guiTop
|
slot.y = absoluteY.roundToInt() - screen.guiTop
|
||||||
renderSlotBackground(stack, mouseX, mouseY, partialTick)
|
renderSlotBackground(graphics, mouseX, mouseY, partialTick)
|
||||||
|
|
||||||
var itemstack = slot.item
|
var itemstack = slot.item
|
||||||
val carried = screen.menu.carried
|
val carried = screen.menu.carried
|
||||||
@ -75,11 +75,10 @@ open class SlotPanel<out S : MatteryScreen<*>, out T : Slot> @JvmOverloads const
|
|||||||
itemstack = carried.copy()
|
itemstack = carried.copy()
|
||||||
dragHit = true
|
dragHit = true
|
||||||
|
|
||||||
AbstractContainerMenu.getQuickCraftSlotCount(
|
AbstractContainerMenu.getQuickCraftPlaceCount(
|
||||||
screen.quickCraftSlots,
|
screen.quickCraftSlots,
|
||||||
screen.quickCraftingType,
|
screen.quickCraftingType,
|
||||||
itemstack,
|
itemstack
|
||||||
if (slot.item.isEmpty) 0 else slot.item.count
|
|
||||||
)
|
)
|
||||||
|
|
||||||
val k = Math.min(itemstack.maxStackSize, slot.getMaxStackSize(itemstack))
|
val k = Math.min(itemstack.maxStackSize, slot.getMaxStackSize(itemstack))
|
||||||
@ -97,7 +96,7 @@ open class SlotPanel<out S : MatteryScreen<*>, out T : Slot> @JvmOverloads const
|
|||||||
|
|
||||||
if (dragHit) {
|
if (dragHit) {
|
||||||
setDrawColor(SLOT_HIGHLIGHT_DRAG)
|
setDrawColor(SLOT_HIGHLIGHT_DRAG)
|
||||||
drawRect(stack, 1f, 1f, width - 1, height - 1)
|
drawRect(graphics, 1f, 1f, width - 1, height - 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (itemstack.isEmpty) {
|
if (itemstack.isEmpty) {
|
||||||
@ -106,20 +105,20 @@ open class SlotPanel<out S : MatteryScreen<*>, out T : Slot> @JvmOverloads const
|
|||||||
if (icon != null) {
|
if (icon != null) {
|
||||||
val texture = minecraft.getTextureAtlas(icon.first).apply(icon.second)
|
val texture = minecraft.getTextureAtlas(icon.first).apply(icon.second)
|
||||||
RenderSystem.setShaderTexture(0, texture.atlasLocation())
|
RenderSystem.setShaderTexture(0, texture.atlasLocation())
|
||||||
GuiComponent.blit(stack, 1, 1, 0, 16, 16, texture)
|
graphics.blit(1, 1, 0, 16, 16, texture)
|
||||||
} else {
|
} else {
|
||||||
noItemIcon?.render(stack, width = width, height = height)
|
noItemIcon?.render(graphics, width = width, height = height)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
renderRegular(stack, itemstack, countOverride)
|
renderRegular(graphics, itemstack, countOverride)
|
||||||
|
|
||||||
if (isHovered) {
|
if (isHovered) {
|
||||||
screen.hoveredSlot = slot
|
screen.hoveredSlot = slot
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun innerRenderTooltips(@Nonnull stack: PoseStack, mouseX: Float, mouseY: Float, partialTick: Float): Boolean {
|
override fun innerRenderTooltips(@Nonnull graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float): Boolean {
|
||||||
// no op, screen does it for us (completely)
|
// no op, screen does it for us (completely)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ package ru.dbotthepony.mc.otm.client.screen.panels.slot
|
|||||||
import com.mojang.blaze3d.platform.InputConstants
|
import com.mojang.blaze3d.platform.InputConstants
|
||||||
import com.mojang.blaze3d.vertex.PoseStack
|
import com.mojang.blaze3d.vertex.PoseStack
|
||||||
import net.minecraft.ChatFormatting
|
import net.minecraft.ChatFormatting
|
||||||
|
import net.minecraft.client.gui.GuiGraphics
|
||||||
import net.minecraft.network.chat.Component
|
import net.minecraft.network.chat.Component
|
||||||
import net.minecraft.world.inventory.Slot
|
import net.minecraft.world.inventory.Slot
|
||||||
import net.minecraft.world.item.Item
|
import net.minecraft.world.item.Item
|
||||||
@ -35,31 +36,31 @@ abstract class UserFilteredSlotPanel<out S : MatteryScreen<*>, out T : Slot>(
|
|||||||
) : SlotPanel<S, T>(screen, parent, slot, x, y, width, height, noItemIcon) {
|
) : SlotPanel<S, T>(screen, parent, slot, x, y, width, height, noItemIcon) {
|
||||||
abstract var slotFilter: Item?
|
abstract var slotFilter: Item?
|
||||||
|
|
||||||
override fun renderSlotBackground(stack: PoseStack, mouseX: Float, mouseY: Float, partialTick: Float) {
|
override fun renderSlotBackground(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) {
|
||||||
super.renderSlotBackground(stack, mouseX, mouseY, partialTick)
|
super.renderSlotBackground(graphics, mouseX, mouseY, partialTick)
|
||||||
|
|
||||||
if (slotFilter != null) {
|
if (slotFilter != null) {
|
||||||
if (slotFilter !== Items.AIR) {
|
if (slotFilter !== Items.AIR) {
|
||||||
val itemStack = ItemStack(slotFilter!!, 1)
|
val itemStack = ItemStack(slotFilter!!, 1)
|
||||||
|
|
||||||
screen.renderItemStack(stack, itemStack, null)
|
screen.renderItemStack(graphics, itemStack, null)
|
||||||
clearDepth(stack)
|
clearDepth(graphics)
|
||||||
|
|
||||||
drawColor = SLOT_FILTER_COLOR
|
drawColor = SLOT_FILTER_COLOR
|
||||||
} else {
|
} else {
|
||||||
drawColor = SLOT_BLOCK_COLOR
|
drawColor = SLOT_BLOCK_COLOR
|
||||||
}
|
}
|
||||||
|
|
||||||
drawRect(stack, 0f, 0f, width, height)
|
drawRect(graphics, 0f, 0f, width, height)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun innerRenderTooltips(stack: PoseStack, mouseX: Float, mouseY: Float, partialTick: Float): Boolean {
|
override fun innerRenderTooltips(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float): Boolean {
|
||||||
if (isHovered && slotFilter != null && slotFilter !== Items.AIR && itemStack.isEmpty) {
|
if (isHovered && slotFilter != null && slotFilter !== Items.AIR && itemStack.isEmpty) {
|
||||||
val itemstack = ItemStack(slotFilter!!, 1)
|
val itemstack = ItemStack(slotFilter!!, 1)
|
||||||
|
|
||||||
screen.renderComponentTooltip(
|
graphics.renderComponentTooltip(
|
||||||
stack,
|
IClientItemExtensions.of(itemstack).getFont(itemstack, IClientItemExtensions.FontContext.TOOLTIP) ?: font,
|
||||||
getItemStackTooltip(itemstack).toMutableList().also {
|
getItemStackTooltip(itemstack).toMutableList().also {
|
||||||
it.add(0, TranslatableComponent("otm.gui.slot_filter.filtered").withStyle(ChatFormatting.GRAY))
|
it.add(0, TranslatableComponent("otm.gui.slot_filter.filtered").withStyle(ChatFormatting.GRAY))
|
||||||
it.add(1, TranslatableComponent("otm.gui.slot_filter.hint").withStyle(ChatFormatting.GRAY))
|
it.add(1, TranslatableComponent("otm.gui.slot_filter.hint").withStyle(ChatFormatting.GRAY))
|
||||||
@ -67,23 +68,21 @@ abstract class UserFilteredSlotPanel<out S : MatteryScreen<*>, out T : Slot>(
|
|||||||
},
|
},
|
||||||
mouseX.toInt(),
|
mouseX.toInt(),
|
||||||
mouseY.toInt(),
|
mouseY.toInt(),
|
||||||
IClientItemExtensions.of(itemstack).getFont(itemstack, IClientItemExtensions.FontContext.TOOLTIP) ?: screen.font,
|
|
||||||
itemstack
|
itemstack
|
||||||
)
|
)
|
||||||
} else if (isHovered && slotFilter === Items.AIR && itemStack.isEmpty) {
|
} else if (isHovered && slotFilter === Items.AIR && itemStack.isEmpty) {
|
||||||
screen.renderComponentTooltip(
|
graphics.renderComponentTooltip(
|
||||||
stack,
|
font,
|
||||||
ArrayList<Component>().also {
|
ArrayList<Component>().also {
|
||||||
it.add(TranslatableComponent("otm.gui.slot_filter.forbidden").withStyle(ChatFormatting.GRAY))
|
it.add(TranslatableComponent("otm.gui.slot_filter.forbidden").withStyle(ChatFormatting.GRAY))
|
||||||
it.add(TranslatableComponent("otm.gui.slot_filter.hint").withStyle(ChatFormatting.GRAY))
|
it.add(TranslatableComponent("otm.gui.slot_filter.hint").withStyle(ChatFormatting.GRAY))
|
||||||
},
|
},
|
||||||
mouseX.toInt(),
|
mouseX.toInt(),
|
||||||
mouseY.toInt(),
|
mouseY.toInt()
|
||||||
screen.font
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
return super.innerRenderTooltips(stack, mouseX, mouseY, partialTick)
|
return super.innerRenderTooltips(graphics, mouseX, mouseY, partialTick)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun mouseClickedInner(x: Double, y: Double, button: Int): Boolean {
|
override fun mouseClickedInner(x: Double, y: Double, button: Int): Boolean {
|
||||||
|
@ -2,6 +2,7 @@ package ru.dbotthepony.mc.otm.client.screen.panels.util
|
|||||||
|
|
||||||
import com.mojang.blaze3d.platform.InputConstants
|
import com.mojang.blaze3d.platform.InputConstants
|
||||||
import com.mojang.blaze3d.vertex.PoseStack
|
import com.mojang.blaze3d.vertex.PoseStack
|
||||||
|
import net.minecraft.client.gui.GuiGraphics
|
||||||
import net.minecraft.client.gui.screens.Screen
|
import net.minecraft.client.gui.screens.Screen
|
||||||
import ru.dbotthepony.mc.otm.client.screen.panels.EditablePanel
|
import ru.dbotthepony.mc.otm.client.screen.panels.EditablePanel
|
||||||
import ru.dbotthepony.mc.otm.client.screen.panels.slot.AbstractSlotPanel
|
import ru.dbotthepony.mc.otm.client.screen.panels.slot.AbstractSlotPanel
|
||||||
@ -26,26 +27,26 @@ open class AnalogScrollBarPanel<out S : Screen>(
|
|||||||
var isScrolling = false
|
var isScrolling = false
|
||||||
private set
|
private set
|
||||||
|
|
||||||
override fun innerRender(stack: PoseStack, mouseX: Float, mouseY: Float, partialTick: Float) {
|
override fun innerRender(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) {
|
||||||
if (this@AnalogScrollBarPanel.width == ScrollBarConstants.SLIM_WIDTH) {
|
if (this@AnalogScrollBarPanel.width == ScrollBarConstants.SLIM_WIDTH) {
|
||||||
if (isScrolling) {
|
if (isScrolling) {
|
||||||
ScrollBarConstants.SLIM_BUTTON_PRESS.render(stack, width = width, height = height)
|
ScrollBarConstants.SLIM_BUTTON_PRESS.render(graphics, width = width, height = height)
|
||||||
} else if (maxScroll.invoke(this@AnalogScrollBarPanel) <= 0) {
|
} else if (maxScroll.invoke(this@AnalogScrollBarPanel) <= 0) {
|
||||||
ScrollBarConstants.SLIM_BUTTON_DISABLED.render(stack, width = width, height = height)
|
ScrollBarConstants.SLIM_BUTTON_DISABLED.render(graphics, width = width, height = height)
|
||||||
} else if (isHovered) {
|
} else if (isHovered) {
|
||||||
ScrollBarConstants.SLIM_BUTTON_HOVER.render(stack, width = width, height = height)
|
ScrollBarConstants.SLIM_BUTTON_HOVER.render(graphics, width = width, height = height)
|
||||||
} else {
|
} else {
|
||||||
ScrollBarConstants.SLIM_BUTTON.render(stack, width = width, height = height)
|
ScrollBarConstants.SLIM_BUTTON.render(graphics, width = width, height = height)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (isScrolling) {
|
if (isScrolling) {
|
||||||
ScrollBarConstants.BUTTON_PRESS.render(stack, width = width, height = height)
|
ScrollBarConstants.BUTTON_PRESS.render(graphics, width = width, height = height)
|
||||||
} else if (maxScroll.invoke(this@AnalogScrollBarPanel) <= 0) {
|
} else if (maxScroll.invoke(this@AnalogScrollBarPanel) <= 0) {
|
||||||
ScrollBarConstants.BUTTON_DISABLED.render(stack, width = width, height = height)
|
ScrollBarConstants.BUTTON_DISABLED.render(graphics, width = width, height = height)
|
||||||
} else if (isHovered) {
|
} else if (isHovered) {
|
||||||
ScrollBarConstants.BUTTON_HOVER.render(stack, width = width, height = height)
|
ScrollBarConstants.BUTTON_HOVER.render(graphics, width = width, height = height)
|
||||||
} else {
|
} else {
|
||||||
ScrollBarConstants.BUTTON.render(stack, width = width, height = height)
|
ScrollBarConstants.BUTTON.render(graphics, width = width, height = height)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -98,15 +99,15 @@ open class AnalogScrollBarPanel<out S : Screen>(
|
|||||||
|
|
||||||
private var lastRender = milliTimeD
|
private var lastRender = milliTimeD
|
||||||
|
|
||||||
override fun innerRender(stack: PoseStack, mouseX: Float, mouseY: Float, partialTick: Float) {
|
override fun innerRender(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) {
|
||||||
if (width == ScrollBarConstants.SLIM_WIDTH) {
|
if (width == ScrollBarConstants.SLIM_WIDTH) {
|
||||||
ScrollBarConstants.SLIM_BODY.render(stack, y = 2f, height = height - 4f)
|
ScrollBarConstants.SLIM_BODY.render(graphics, y = 2f, height = height - 4f)
|
||||||
ScrollBarConstants.SLIM_TOP.render(stack)
|
ScrollBarConstants.SLIM_TOP.render(graphics)
|
||||||
ScrollBarConstants.SLIM_BOTTOM.render(stack, y = height - 2f)
|
ScrollBarConstants.SLIM_BOTTOM.render(graphics, y = height - 2f)
|
||||||
} else {
|
} else {
|
||||||
ScrollBarConstants.BODY.render(stack, y = 2f, height = height - 4f)
|
ScrollBarConstants.BODY.render(graphics, y = 2f, height = height - 4f)
|
||||||
ScrollBarConstants.TOP.render(stack)
|
ScrollBarConstants.TOP.render(graphics)
|
||||||
ScrollBarConstants.BOTTOM.render(stack, y = height - 2f)
|
ScrollBarConstants.BOTTOM.render(graphics, y = height - 2f)
|
||||||
}
|
}
|
||||||
|
|
||||||
val time = milliTimeD
|
val time = milliTimeD
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package ru.dbotthepony.mc.otm.client.screen.panels.util
|
package ru.dbotthepony.mc.otm.client.screen.panels.util
|
||||||
|
|
||||||
import com.mojang.blaze3d.vertex.PoseStack
|
import com.mojang.blaze3d.vertex.PoseStack
|
||||||
|
import net.minecraft.client.gui.GuiGraphics
|
||||||
import net.minecraft.client.gui.screens.Screen
|
import net.minecraft.client.gui.screens.Screen
|
||||||
import ru.dbotthepony.mc.otm.client.render.StretchingRectangleElement
|
import ru.dbotthepony.mc.otm.client.render.StretchingRectangleElement
|
||||||
import ru.dbotthepony.mc.otm.client.render.WidgetLocation
|
import ru.dbotthepony.mc.otm.client.render.WidgetLocation
|
||||||
@ -19,8 +20,8 @@ open class BackgroundPanel<out S : Screen>(
|
|||||||
dockPadding = DockProperty(3f, 3f, 3f, 3f)
|
dockPadding = DockProperty(3f, 3f, 3f, 3f)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun innerRender(stack: PoseStack, mouseX: Float, mouseY: Float, partialTick: Float) {
|
override fun innerRender(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) {
|
||||||
RECTANGLE.render(stack, width = width, height = height)
|
RECTANGLE.render(graphics, width = width, height = height)
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@ -2,6 +2,7 @@ package ru.dbotthepony.mc.otm.client.screen.panels.util
|
|||||||
|
|
||||||
import com.mojang.blaze3d.platform.InputConstants
|
import com.mojang.blaze3d.platform.InputConstants
|
||||||
import com.mojang.blaze3d.vertex.PoseStack
|
import com.mojang.blaze3d.vertex.PoseStack
|
||||||
|
import net.minecraft.client.gui.GuiGraphics
|
||||||
import net.minecraft.client.gui.screens.Screen
|
import net.minecraft.client.gui.screens.Screen
|
||||||
import ru.dbotthepony.mc.otm.client.screen.panels.EditablePanel
|
import ru.dbotthepony.mc.otm.client.screen.panels.EditablePanel
|
||||||
import kotlin.math.roundToInt
|
import kotlin.math.roundToInt
|
||||||
@ -20,26 +21,26 @@ open class DiscreteScrollBarPanel<out S : Screen>(
|
|||||||
var isScrolling = false
|
var isScrolling = false
|
||||||
private set
|
private set
|
||||||
|
|
||||||
override fun innerRender(stack: PoseStack, mouseX: Float, mouseY: Float, partialTick: Float) {
|
override fun innerRender(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) {
|
||||||
if (this@DiscreteScrollBarPanel.width == ScrollBarConstants.SLIM_WIDTH) {
|
if (this@DiscreteScrollBarPanel.width == ScrollBarConstants.SLIM_WIDTH) {
|
||||||
if (isScrolling) {
|
if (isScrolling) {
|
||||||
ScrollBarConstants.SLIM_BUTTON_PRESS.render(stack, width = width, height = height)
|
ScrollBarConstants.SLIM_BUTTON_PRESS.render(graphics, width = width, height = height)
|
||||||
} else if (maxScroll.invoke(this@DiscreteScrollBarPanel) <= 0) {
|
} else if (maxScroll.invoke(this@DiscreteScrollBarPanel) <= 0) {
|
||||||
ScrollBarConstants.SLIM_BUTTON_DISABLED.render(stack, width = width, height = height)
|
ScrollBarConstants.SLIM_BUTTON_DISABLED.render(graphics, width = width, height = height)
|
||||||
} else if (isHovered) {
|
} else if (isHovered) {
|
||||||
ScrollBarConstants.SLIM_BUTTON_HOVER.render(stack, width = width, height = height)
|
ScrollBarConstants.SLIM_BUTTON_HOVER.render(graphics, width = width, height = height)
|
||||||
} else {
|
} else {
|
||||||
ScrollBarConstants.SLIM_BUTTON.render(stack, width = width, height = height)
|
ScrollBarConstants.SLIM_BUTTON.render(graphics, width = width, height = height)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (isScrolling) {
|
if (isScrolling) {
|
||||||
ScrollBarConstants.BUTTON_PRESS.render(stack, width = width, height = height)
|
ScrollBarConstants.BUTTON_PRESS.render(graphics, width = width, height = height)
|
||||||
} else if (maxScroll.invoke(this@DiscreteScrollBarPanel) <= 0) {
|
} else if (maxScroll.invoke(this@DiscreteScrollBarPanel) <= 0) {
|
||||||
ScrollBarConstants.BUTTON_DISABLED.render(stack, width = width, height = height)
|
ScrollBarConstants.BUTTON_DISABLED.render(graphics, width = width, height = height)
|
||||||
} else if (isHovered) {
|
} else if (isHovered) {
|
||||||
ScrollBarConstants.BUTTON_HOVER.render(stack, width = width, height = height)
|
ScrollBarConstants.BUTTON_HOVER.render(graphics, width = width, height = height)
|
||||||
} else {
|
} else {
|
||||||
ScrollBarConstants.BUTTON.render(stack, width = width, height = height)
|
ScrollBarConstants.BUTTON.render(graphics, width = width, height = height)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -90,15 +91,15 @@ open class DiscreteScrollBarPanel<out S : Screen>(
|
|||||||
|
|
||||||
val scrollButton = Button()
|
val scrollButton = Button()
|
||||||
|
|
||||||
override fun innerRender(stack: PoseStack, mouseX: Float, mouseY: Float, partialTick: Float) {
|
override fun innerRender(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) {
|
||||||
if (width == ScrollBarConstants.SLIM_WIDTH) {
|
if (width == ScrollBarConstants.SLIM_WIDTH) {
|
||||||
ScrollBarConstants.SLIM_BODY.render(stack, y = 2f, height = height - 4f)
|
ScrollBarConstants.SLIM_BODY.render(graphics, y = 2f, height = height - 4f)
|
||||||
ScrollBarConstants.SLIM_TOP.render(stack)
|
ScrollBarConstants.SLIM_TOP.render(graphics)
|
||||||
ScrollBarConstants.SLIM_BOTTOM.render(stack, y = height - 2f)
|
ScrollBarConstants.SLIM_BOTTOM.render(graphics, y = height - 2f)
|
||||||
} else {
|
} else {
|
||||||
ScrollBarConstants.BODY.render(stack, y = 2f, height = height - 4f)
|
ScrollBarConstants.BODY.render(graphics, y = 2f, height = height - 4f)
|
||||||
ScrollBarConstants.TOP.render(stack)
|
ScrollBarConstants.TOP.render(graphics)
|
||||||
ScrollBarConstants.BOTTOM.render(stack, y = height - 2f)
|
ScrollBarConstants.BOTTOM.render(graphics, y = height - 2f)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package ru.dbotthepony.mc.otm.client.screen.panels.util
|
package ru.dbotthepony.mc.otm.client.screen.panels.util
|
||||||
|
|
||||||
import com.mojang.blaze3d.vertex.PoseStack
|
import com.mojang.blaze3d.vertex.PoseStack
|
||||||
|
import net.minecraft.client.gui.GuiGraphics
|
||||||
import net.minecraft.client.gui.screens.Screen
|
import net.minecraft.client.gui.screens.Screen
|
||||||
import ru.dbotthepony.mc.otm.client.render.AbstractMatterySprite
|
import ru.dbotthepony.mc.otm.client.render.AbstractMatterySprite
|
||||||
import ru.dbotthepony.mc.otm.client.render.UVWindingOrder
|
import ru.dbotthepony.mc.otm.client.render.UVWindingOrder
|
||||||
@ -16,7 +17,7 @@ class SpritePanel<out S : Screen>(
|
|||||||
height: Float = sprite.height,
|
height: Float = sprite.height,
|
||||||
val winding: UVWindingOrder = sprite.winding
|
val winding: UVWindingOrder = sprite.winding
|
||||||
) : EditablePanel<S>(screen, parent, x, y, width, height) {
|
) : EditablePanel<S>(screen, parent, x, y, width, height) {
|
||||||
override fun innerRender(stack: PoseStack, mouseX: Float, mouseY: Float, partialTick: Float) {
|
override fun innerRender(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) {
|
||||||
sprite.render(stack, 0f, 0f, width, height, winding)
|
sprite.render(graphics, 0f, 0f, width, height, winding)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package ru.dbotthepony.mc.otm.client.screen.storage
|
package ru.dbotthepony.mc.otm.client.screen.storage
|
||||||
|
|
||||||
import com.mojang.blaze3d.vertex.PoseStack
|
import com.mojang.blaze3d.vertex.PoseStack
|
||||||
|
import net.minecraft.client.gui.GuiGraphics
|
||||||
import net.minecraft.network.chat.Component
|
import net.minecraft.network.chat.Component
|
||||||
import net.minecraft.world.entity.player.Inventory
|
import net.minecraft.world.entity.player.Inventory
|
||||||
import net.minecraft.world.item.ItemStack
|
import net.minecraft.world.item.ItemStack
|
||||||
@ -78,9 +79,9 @@ class DriveViewerScreen(menu: DriveViewerMenu, inventory: Inventory, title: Comp
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun innerRender(stack: PoseStack, mouseX: Float, mouseY: Float, partialTick: Float) {
|
override fun innerRender(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) {
|
||||||
renderSlotBackground(stack, mouseX, mouseY, partialTick)
|
renderSlotBackground(graphics, mouseX, mouseY, partialTick)
|
||||||
renderRegular(stack, itemStack, "")
|
renderRegular(graphics, itemStack, "")
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getItemStackTooltip(stack: ItemStack): List<Component> {
|
override fun getItemStackTooltip(stack: ItemStack): List<Component> {
|
||||||
|
@ -3,6 +3,7 @@ package ru.dbotthepony.mc.otm.client.screen.storage
|
|||||||
import com.mojang.blaze3d.systems.RenderSystem
|
import com.mojang.blaze3d.systems.RenderSystem
|
||||||
import com.mojang.blaze3d.vertex.PoseStack
|
import com.mojang.blaze3d.vertex.PoseStack
|
||||||
import net.minecraft.ChatFormatting
|
import net.minecraft.ChatFormatting
|
||||||
|
import net.minecraft.client.gui.GuiGraphics
|
||||||
import net.minecraft.network.chat.Component
|
import net.minecraft.network.chat.Component
|
||||||
import net.minecraft.world.entity.player.Inventory
|
import net.minecraft.world.entity.player.Inventory
|
||||||
import net.minecraft.world.item.ItemStack
|
import net.minecraft.world.item.ItemStack
|
||||||
@ -81,12 +82,13 @@ class ItemMonitorScreen(menu: ItemMonitorMenu, inventory: Inventory, title: Comp
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun innerRender(stack: PoseStack, mouseX: Float, mouseY: Float, partialTick: Float) {
|
override fun innerRender(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) {
|
||||||
renderSlotBackground(stack, mouseX, mouseY, partialTick)
|
renderSlotBackground(graphics, mouseX, mouseY, partialTick)
|
||||||
|
|
||||||
val itemstack = menu.networkedItemView.sortedView.getOrNull(index)?.stack ?: ITEM_STORAGE.empty
|
val itemstack = menu.networkedItemView.sortedView.getOrNull(index)?.stack ?: ITEM_STORAGE.empty
|
||||||
|
val stack = graphics.pose()
|
||||||
|
|
||||||
renderRegular(stack, itemstack.stack, "")
|
renderRegular(graphics, itemstack.stack, "")
|
||||||
|
|
||||||
if (!itemstack.isEmpty) {
|
if (!itemstack.isEmpty) {
|
||||||
stack.pushPose()
|
stack.pushPose()
|
||||||
@ -100,8 +102,8 @@ class ItemMonitorScreen(menu: ItemMonitorMenu, inventory: Inventory, title: Comp
|
|||||||
|
|
||||||
RenderSystem.depthFunc(GL11.GL_ALWAYS)
|
RenderSystem.depthFunc(GL11.GL_ALWAYS)
|
||||||
|
|
||||||
font.draw(stack, text, 1f, 1f, 0x0)
|
graphics.drawString(font, text, 1, 1, 0x0)
|
||||||
font.draw(stack, text, 0f, 0f, 16777215)
|
graphics.drawString(font, text, 0, 0, 16777215)
|
||||||
|
|
||||||
stack.popPose()
|
stack.popPose()
|
||||||
}
|
}
|
||||||
@ -125,8 +127,8 @@ class ItemMonitorScreen(menu: ItemMonitorMenu, inventory: Inventory, title: Comp
|
|||||||
}
|
}
|
||||||
|
|
||||||
val arrowAndButtons = object : EditablePanel<ItemMonitorScreen>(this@ItemMonitorScreen, bottomPanel, width = ProgressGaugePanel.GAUGE_BACKGROUND.width) {
|
val arrowAndButtons = object : EditablePanel<ItemMonitorScreen>(this@ItemMonitorScreen, bottomPanel, width = ProgressGaugePanel.GAUGE_BACKGROUND.width) {
|
||||||
override fun innerRender(stack: PoseStack, mouseX: Float, mouseY: Float, partialTick: Float) {
|
override fun innerRender(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) {
|
||||||
ProgressGaugePanel.GAUGE_BACKGROUND.render(stack, y = height / 2f - ProgressGaugePanel.GAUGE_BACKGROUND.height / 2f)
|
ProgressGaugePanel.GAUGE_BACKGROUND.render(graphics, y = height / 2f - ProgressGaugePanel.GAUGE_BACKGROUND.height / 2f)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectFunction
|
|||||||
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap
|
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap
|
||||||
import net.minecraft.ChatFormatting
|
import net.minecraft.ChatFormatting
|
||||||
import net.minecraft.client.Minecraft
|
import net.minecraft.client.Minecraft
|
||||||
|
import net.minecraft.client.gui.GuiGraphics
|
||||||
import net.minecraft.network.chat.Component
|
import net.minecraft.network.chat.Component
|
||||||
import net.minecraft.world.entity.player.Inventory
|
import net.minecraft.world.entity.player.Inventory
|
||||||
import net.minecraft.world.item.ItemStack
|
import net.minecraft.world.item.ItemStack
|
||||||
@ -290,7 +291,7 @@ private class AndroidResearchButton(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun innerRender(stack: PoseStack, mouseX: Float, mouseY: Float, partialTick: Float) {
|
override fun innerRender(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) {
|
||||||
val hovered = screen.hoveredResearch
|
val hovered = screen.hoveredResearch
|
||||||
|
|
||||||
val isBlockedByHovered = hovered != null && node.type in hovered.type.allBlocking
|
val isBlockedByHovered = hovered != null && node.type in hovered.type.allBlocking
|
||||||
@ -298,7 +299,7 @@ private class AndroidResearchButton(
|
|||||||
if (isBlockedByHovered) {
|
if (isBlockedByHovered) {
|
||||||
AndroidStationScreen.CAN_NOT_BE_RESEARCHED.setSystemColor()
|
AndroidStationScreen.CAN_NOT_BE_RESEARCHED.setSystemColor()
|
||||||
|
|
||||||
drawRect(stack, 0f, 0f, width, height)
|
drawRect(graphics, 0f, 0f, width, height)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (node.isResearched) {
|
if (node.isResearched) {
|
||||||
@ -315,34 +316,35 @@ private class AndroidResearchButton(
|
|||||||
val itemIcon = node.type.itemIcon
|
val itemIcon = node.type.itemIcon
|
||||||
|
|
||||||
if (icon != null) {
|
if (icon != null) {
|
||||||
icon.render(stack, 0f, 0f, width, height)
|
icon.render(graphics, 0f, 0f, width, height)
|
||||||
} else if (itemIcon != null) {
|
} else if (itemIcon != null) {
|
||||||
val itemstack = ItemStack(itemIcon, 1)
|
val itemstack = ItemStack(itemIcon, 1)
|
||||||
|
|
||||||
|
val stack = graphics.pose()
|
||||||
stack.pushPose()
|
stack.pushPose()
|
||||||
stack.translate(1f, 1f, 0f)
|
stack.translate(1f, 1f, 0f)
|
||||||
screen.renderItemStack(stack, itemstack)
|
screen.renderItemStack(graphics, itemstack)
|
||||||
stack.popPose()
|
stack.popPose()
|
||||||
|
|
||||||
clearDepth(stack)
|
clearDepth(graphics)
|
||||||
} else {
|
} else {
|
||||||
drawRect(stack, 0f, 0f, width, height)
|
drawRect(graphics, 0f, 0f, width, height)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isBlockedByHovered) {
|
if (isBlockedByHovered) {
|
||||||
RGBAColor.RED.setSystemColor()
|
RGBAColor.RED.setSystemColor()
|
||||||
|
|
||||||
Widgets18.CROSS.render(stack)
|
Widgets18.CROSS.render(graphics)
|
||||||
} else if (node.isAnyBlockerResearched) {
|
} else if (node.isAnyBlockerResearched) {
|
||||||
RGBAColor.RED.setSystemColor()
|
RGBAColor.RED.setSystemColor()
|
||||||
|
|
||||||
Widgets18.FORWARD_SLASH.render(stack)
|
Widgets18.FORWARD_SLASH.render(graphics)
|
||||||
}
|
}
|
||||||
|
|
||||||
val text = node.type.iconText
|
val text = node.type.iconText
|
||||||
|
|
||||||
if (text != null) {
|
if (text != null) {
|
||||||
font.drawShadow(stack, text, width - font.width(text), height - font.lineHeight, -0x1)
|
graphics.drawString(font, text.visualOrderText, width - font.width(text), height - font.lineHeight, -0x1, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
drawColor = RGBAColor.WHITE
|
drawColor = RGBAColor.WHITE
|
||||||
@ -353,7 +355,7 @@ private class AndroidResearchButton(
|
|||||||
val (x1, y1) = pos1
|
val (x1, y1) = pos1
|
||||||
val (x2, y2) = pos2
|
val (x2, y2) = pos2
|
||||||
|
|
||||||
drawLine(stack, x1, y1, x2, y2, 0.5f)
|
drawLine(graphics, x1, y1, x2, y2, 0.5f)
|
||||||
}
|
}
|
||||||
|
|
||||||
hovered ?: return
|
hovered ?: return
|
||||||
@ -367,7 +369,7 @@ private class AndroidResearchButton(
|
|||||||
val (x1, y1) = pos1
|
val (x1, y1) = pos1
|
||||||
val (x2, y2) = pos2
|
val (x2, y2) = pos2
|
||||||
|
|
||||||
drawLine(stack, x1, y1, x2, y2, 0.5f)
|
drawLine(graphics, x1, y1, x2, y2, 0.5f)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -392,7 +394,7 @@ private class AndroidResearchButton(
|
|||||||
val (x1, y1) = pos1
|
val (x1, y1) = pos1
|
||||||
val (x2, y2) = pos2
|
val (x2, y2) = pos2
|
||||||
|
|
||||||
drawLine(stack, x1, y1, x2, y2, 0.5f)
|
drawLine(graphics, x1, y1, x2, y2, 0.5f)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -423,7 +425,7 @@ private class AndroidResearchButton(
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun innerRenderTooltips(stack: PoseStack, mouseX: Float, mouseY: Float, partialTick: Float): Boolean {
|
override fun innerRenderTooltips(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float): Boolean {
|
||||||
if (isHovered) {
|
if (isHovered) {
|
||||||
val list = ArrayList<Component>().also { it.addAll(node.screenTooltipLines) }
|
val list = ArrayList<Component>().also { it.addAll(node.screenTooltipLines) }
|
||||||
|
|
||||||
@ -445,7 +447,7 @@ private class AndroidResearchButton(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
screen.renderComponentTooltip(stack, list, mouseX.toInt(), mouseY.toInt())
|
graphics.renderComponentTooltip(font, list, mouseX.toInt(), mouseY.toInt())
|
||||||
}
|
}
|
||||||
|
|
||||||
return isHovered
|
return isHovered
|
||||||
@ -516,9 +518,9 @@ class AndroidStationScreen constructor(p_97741_: AndroidStationMenu, p_97742_: I
|
|||||||
private var scroller: PreviewScrollers = PreviewScrollers.values().let { it[random.nextInt(it.size)] }
|
private var scroller: PreviewScrollers = PreviewScrollers.values().let { it[random.nextInt(it.size)] }
|
||||||
private var firstTick = false
|
private var firstTick = false
|
||||||
|
|
||||||
override fun innerRender(stack: PoseStack, mouseX: Float, mouseY: Float, partialTick: Float) {
|
override fun innerRender(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) {
|
||||||
drawColor = RGBAColor.BLACK
|
drawColor = RGBAColor.BLACK
|
||||||
drawRect(stack, 0f, 0f, width, height)
|
drawRect(graphics, 0f, 0f, width, height)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun mouseClickedInner(x: Double, y: Double, button: Int): Boolean {
|
override fun mouseClickedInner(x: Double, y: Double, button: Int): Boolean {
|
||||||
@ -658,7 +660,7 @@ class AndroidStationScreen constructor(p_97741_: AndroidStationMenu, p_97742_: I
|
|||||||
align = TextAlign.TOP_RIGHT
|
align = TextAlign.TOP_RIGHT
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun innerRender(stack: PoseStack, mouseX: Float, mouseY: Float, partialTick: Float) {
|
override fun innerRender(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) {
|
||||||
if (menu.energyWidget.level >= AndroidStationBlockEntity.ENERGY_PER_RESEARCH) {
|
if (menu.energyWidget.level >= AndroidStationBlockEntity.ENERGY_PER_RESEARCH) {
|
||||||
text = POWER_OK
|
text = POWER_OK
|
||||||
color = RGBAColor.LIGHT_GREEN
|
color = RGBAColor.LIGHT_GREEN
|
||||||
@ -670,7 +672,7 @@ class AndroidStationScreen constructor(p_97741_: AndroidStationMenu, p_97742_: I
|
|||||||
color = RGBAColor.RED
|
color = RGBAColor.RED
|
||||||
}
|
}
|
||||||
|
|
||||||
super.innerRender(stack, mouseX, mouseY, partialTick)
|
super.innerRender(graphics, mouseX, mouseY, partialTick)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package ru.dbotthepony.mc.otm.client.screen.tech
|
package ru.dbotthepony.mc.otm.client.screen.tech
|
||||||
|
|
||||||
import com.mojang.blaze3d.vertex.PoseStack
|
import com.mojang.blaze3d.vertex.PoseStack
|
||||||
|
import net.minecraft.client.gui.GuiGraphics
|
||||||
import net.minecraft.network.chat.Component
|
import net.minecraft.network.chat.Component
|
||||||
import net.minecraft.world.entity.player.Inventory
|
import net.minecraft.world.entity.player.Inventory
|
||||||
import ru.dbotthepony.mc.otm.client.screen.MatteryScreen
|
import ru.dbotthepony.mc.otm.client.screen.MatteryScreen
|
||||||
@ -47,8 +48,8 @@ class EnergyServoScreen(menu: EnergyServoMenu, inventory: Inventory, title: Comp
|
|||||||
width = ProgressGaugePanel.GAUGE_BACKGROUND.width
|
width = ProgressGaugePanel.GAUGE_BACKGROUND.width
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun innerRender(stack: PoseStack, mouseX: Float, mouseY: Float, partialTick: Float) {
|
override fun innerRender(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) {
|
||||||
ProgressGaugePanel.GAUGE_BACKGROUND.render(stack)
|
ProgressGaugePanel.GAUGE_BACKGROUND.render(graphics)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -65,8 +66,8 @@ class EnergyServoScreen(menu: EnergyServoMenu, inventory: Inventory, title: Comp
|
|||||||
width = ProgressGaugePanel.GAUGE_BACKGROUND.width
|
width = ProgressGaugePanel.GAUGE_BACKGROUND.width
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun innerRender(stack: PoseStack, mouseX: Float, mouseY: Float, partialTick: Float) {
|
override fun innerRender(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) {
|
||||||
ProgressGaugePanel.GAUGE_BACKGROUND.render(stack)
|
ProgressGaugePanel.GAUGE_BACKGROUND.render(graphics)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@ package ru.dbotthepony.mc.otm.client.screen.tech
|
|||||||
|
|
||||||
import com.mojang.blaze3d.vertex.PoseStack
|
import com.mojang.blaze3d.vertex.PoseStack
|
||||||
import net.minecraft.ChatFormatting
|
import net.minecraft.ChatFormatting
|
||||||
|
import net.minecraft.client.gui.GuiGraphics
|
||||||
import net.minecraft.network.chat.Component
|
import net.minecraft.network.chat.Component
|
||||||
import net.minecraft.resources.ResourceLocation
|
import net.minecraft.resources.ResourceLocation
|
||||||
import net.minecraft.world.entity.player.Inventory
|
import net.minecraft.world.entity.player.Inventory
|
||||||
@ -52,11 +53,11 @@ class EssenceStorageScreen(menu: EssenceStorageMenu, inventory: Inventory, title
|
|||||||
dockMargin = DockProperty(bottom = 3f)
|
dockMargin = DockProperty(bottom = 3f)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun innerRender(stack: PoseStack, mouseX: Float, mouseY: Float, partialTick: Float) {
|
override fun innerRender(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) {
|
||||||
BAR_BACKGROUND.render(stack, width = width, height = height)
|
BAR_BACKGROUND.render(graphics, width = width, height = height)
|
||||||
val level = getLevelFromXp(menu.experienceStored)
|
val level = getLevelFromXp(menu.experienceStored)
|
||||||
val progress = (menu.experienceStored - getTotalXpRequiredForLevel(level)).toDouble() / getXpRequiredForLevelUp(level).toDouble()
|
val progress = (menu.experienceStored - getTotalXpRequiredForLevel(level)).toDouble() / getXpRequiredForLevelUp(level).toDouble()
|
||||||
BAR_FOREGROUND.renderPartial(stack, width = width * progress.toFloat(), height = height)
|
BAR_FOREGROUND.renderPartial(graphics, width = width * progress.toFloat(), height = height)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ import com.mojang.blaze3d.systems.RenderSystem
|
|||||||
import com.mojang.blaze3d.vertex.DefaultVertexFormat
|
import com.mojang.blaze3d.vertex.DefaultVertexFormat
|
||||||
import com.mojang.blaze3d.vertex.PoseStack
|
import com.mojang.blaze3d.vertex.PoseStack
|
||||||
import com.mojang.blaze3d.vertex.VertexFormat
|
import com.mojang.blaze3d.vertex.VertexFormat
|
||||||
|
import net.minecraft.client.gui.GuiGraphics
|
||||||
import net.minecraft.client.gui.screens.Screen
|
import net.minecraft.client.gui.screens.Screen
|
||||||
import net.minecraft.client.renderer.GameRenderer
|
import net.minecraft.client.renderer.GameRenderer
|
||||||
import net.minecraft.network.chat.Component
|
import net.minecraft.network.chat.Component
|
||||||
@ -44,16 +45,16 @@ open class FluidGaugePanel<out S : Screen>(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun innerRenderTooltips(stack: PoseStack, mouseX: Float, mouseY: Float, partialTick: Float): Boolean {
|
override fun innerRenderTooltips(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float): Boolean {
|
||||||
if (isHovered) {
|
if (isHovered) {
|
||||||
screen.renderComponentTooltip(stack, makeTooltip(), mouseX.toInt(), mouseY.toInt())
|
graphics.renderComponentTooltip(font, makeTooltip(), mouseX.toInt(), mouseY.toInt())
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun innerRender(stack: PoseStack, mouseX: Float, mouseY: Float, partialTick: Float) {
|
override fun innerRender(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) {
|
||||||
if (widget.percentage > 0.01f && widget.fluid.isNotEmpty) {
|
if (widget.percentage > 0.01f && widget.fluid.isNotEmpty) {
|
||||||
val data = IClientFluidTypeExtensions.of(widget.fluid.fluid)
|
val data = IClientFluidTypeExtensions.of(widget.fluid.fluid)
|
||||||
val texture = data.stillTexture!!
|
val texture = data.stillTexture!!
|
||||||
@ -62,7 +63,7 @@ open class FluidGaugePanel<out S : Screen>(
|
|||||||
var height = (height * widget.percentage) / 16f
|
var height = (height * widget.percentage) / 16f
|
||||||
var bottom = this.height
|
var bottom = this.height
|
||||||
|
|
||||||
val matrix = stack.last().pose()
|
val matrix = graphics.pose().last().pose()
|
||||||
val builder = tesselator.builder
|
val builder = tesselator.builder
|
||||||
|
|
||||||
builder.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX)
|
builder.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX)
|
||||||
@ -96,7 +97,7 @@ open class FluidGaugePanel<out S : Screen>(
|
|||||||
RenderSystem.depthFunc(GL11.GL_LESS)
|
RenderSystem.depthFunc(GL11.GL_LESS)
|
||||||
}
|
}
|
||||||
|
|
||||||
GAUGE.render(stack, 0f, 0f, width = width, height = height)
|
GAUGE.render(graphics, 0f, 0f, width = width, height = height)
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package ru.dbotthepony.mc.otm.client.screen.widget
|
package ru.dbotthepony.mc.otm.client.screen.widget
|
||||||
|
|
||||||
import com.mojang.blaze3d.vertex.PoseStack
|
import com.mojang.blaze3d.vertex.PoseStack
|
||||||
|
import net.minecraft.client.gui.GuiGraphics
|
||||||
import net.minecraft.client.gui.screens.Screen
|
import net.minecraft.client.gui.screens.Screen
|
||||||
import ru.dbotthepony.mc.otm.client.render.UVWindingOrder
|
import ru.dbotthepony.mc.otm.client.render.UVWindingOrder
|
||||||
import ru.dbotthepony.mc.otm.client.render.WidgetLocation
|
import ru.dbotthepony.mc.otm.client.render.WidgetLocation
|
||||||
@ -8,26 +9,26 @@ import ru.dbotthepony.mc.otm.client.screen.panels.EditablePanel
|
|||||||
import ru.dbotthepony.mc.otm.menu.widget.LevelGaugeWidget
|
import ru.dbotthepony.mc.otm.menu.widget.LevelGaugeWidget
|
||||||
import ru.dbotthepony.mc.otm.menu.widget.ProfiledEnergyGaugeWidget
|
import ru.dbotthepony.mc.otm.menu.widget.ProfiledEnergyGaugeWidget
|
||||||
|
|
||||||
private fun PowerGaugePanel<*>.doRender(stack: PoseStack, mouseX: Float, mouseY: Float, partialTick: Float, flop: Boolean) {
|
private fun PowerGaugePanel<*>.doRender(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float, flop: Boolean) {
|
||||||
if (height >= 18f) {
|
if (height >= 18f) {
|
||||||
if (flop) {
|
if (flop) {
|
||||||
HorizontalPowerGaugePanel.GAUGE_BACKGROUND_TALL.render(stack, height = height, width = this.width, winding = UVWindingOrder.U1_V0_U0_V1)
|
HorizontalPowerGaugePanel.GAUGE_BACKGROUND_TALL.render(graphics, height = height, width = this.width, winding = UVWindingOrder.U1_V0_U0_V1)
|
||||||
val width = this.width * widget.percentage
|
val width = this.width * widget.percentage
|
||||||
HorizontalPowerGaugePanel.GAUGE_FOREGROUND_TALL.renderPartial(stack, x = this.width - width, height = height, width = width, winding = UVWindingOrder.U1_V0_U0_V1)
|
HorizontalPowerGaugePanel.GAUGE_FOREGROUND_TALL.renderPartial(graphics, x = this.width - width, height = height, width = width, winding = UVWindingOrder.U1_V0_U0_V1)
|
||||||
} else {
|
} else {
|
||||||
HorizontalPowerGaugePanel.GAUGE_BACKGROUND_TALL.render(stack, height = height, width = this.width)
|
HorizontalPowerGaugePanel.GAUGE_BACKGROUND_TALL.render(graphics, height = height, width = this.width)
|
||||||
val width = this.width * widget.percentage
|
val width = this.width * widget.percentage
|
||||||
HorizontalPowerGaugePanel.GAUGE_FOREGROUND_TALL.renderPartial(stack, height = height, width = width)
|
HorizontalPowerGaugePanel.GAUGE_FOREGROUND_TALL.renderPartial(graphics, height = height, width = width)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (flop) {
|
if (flop) {
|
||||||
HorizontalPowerGaugePanel.GAUGE_BACKGROUND.render(stack, height = height, width = this.width, winding = UVWindingOrder.U1_V0_U0_V1)
|
HorizontalPowerGaugePanel.GAUGE_BACKGROUND.render(graphics, height = height, width = this.width, winding = UVWindingOrder.U1_V0_U0_V1)
|
||||||
val width = this.width * widget.percentage
|
val width = this.width * widget.percentage
|
||||||
HorizontalPowerGaugePanel.GAUGE_FOREGROUND.renderPartial(stack, x = this.width - width, height = height, width = width, winding = UVWindingOrder.U1_V0_U0_V1)
|
HorizontalPowerGaugePanel.GAUGE_FOREGROUND.renderPartial(graphics, x = this.width - width, height = height, width = width, winding = UVWindingOrder.U1_V0_U0_V1)
|
||||||
} else {
|
} else {
|
||||||
HorizontalPowerGaugePanel.GAUGE_BACKGROUND.render(stack, height = height, width = this.width)
|
HorizontalPowerGaugePanel.GAUGE_BACKGROUND.render(graphics, height = height, width = this.width)
|
||||||
val width = this.width * widget.percentage
|
val width = this.width * widget.percentage
|
||||||
HorizontalPowerGaugePanel.GAUGE_FOREGROUND.renderPartial(stack, height = height, width = width)
|
HorizontalPowerGaugePanel.GAUGE_FOREGROUND.renderPartial(graphics, height = height, width = width)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -43,8 +44,8 @@ open class HorizontalPowerGaugePanel<out S : Screen>(
|
|||||||
) : PowerGaugePanel<S>(screen, parent, widget, x, y, width, height) {
|
) : PowerGaugePanel<S>(screen, parent, widget, x, y, width, height) {
|
||||||
var flop = false
|
var flop = false
|
||||||
|
|
||||||
override fun innerRender(stack: PoseStack, mouseX: Float, mouseY: Float, partialTick: Float) {
|
override fun innerRender(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) {
|
||||||
doRender(stack, mouseX, mouseY, partialTick, flop)
|
doRender(graphics, mouseX, mouseY, partialTick, flop)
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
@ -81,8 +82,8 @@ open class HorizontalProfiledPowerGaugePanel<out S : Screen>(
|
|||||||
) : ProfiledPowerGaugePanel<S>(screen, parent, widget, x, y, width, height) {
|
) : ProfiledPowerGaugePanel<S>(screen, parent, widget, x, y, width, height) {
|
||||||
var flop = false
|
var flop = false
|
||||||
|
|
||||||
override fun innerRender(stack: PoseStack, mouseX: Float, mouseY: Float, partialTick: Float) {
|
override fun innerRender(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) {
|
||||||
doRender(stack, mouseX, mouseY, partialTick, flop)
|
doRender(graphics, mouseX, mouseY, partialTick, flop)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@ import com.mojang.blaze3d.vertex.BufferUploader
|
|||||||
import com.mojang.blaze3d.vertex.DefaultVertexFormat
|
import com.mojang.blaze3d.vertex.DefaultVertexFormat
|
||||||
import com.mojang.blaze3d.vertex.PoseStack
|
import com.mojang.blaze3d.vertex.PoseStack
|
||||||
import com.mojang.blaze3d.vertex.VertexFormat
|
import com.mojang.blaze3d.vertex.VertexFormat
|
||||||
|
import net.minecraft.client.gui.GuiGraphics
|
||||||
import net.minecraft.client.gui.screens.Screen
|
import net.minecraft.client.gui.screens.Screen
|
||||||
import net.minecraft.client.renderer.GameRenderer
|
import net.minecraft.client.renderer.GameRenderer
|
||||||
import net.minecraft.network.chat.Component
|
import net.minecraft.network.chat.Component
|
||||||
@ -49,7 +50,7 @@ open class MatterGaugePanel<out S : Screen> @JvmOverloads constructor(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun innerRender(stack: PoseStack, mouseX: Float, mouseY: Float, partialTick: Float) {
|
override fun innerRender(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) {
|
||||||
if (lastAbsoluteX == 0f && lastAbsoluteY == 0f) {
|
if (lastAbsoluteX == 0f && lastAbsoluteY == 0f) {
|
||||||
lastAbsoluteX = absoluteX
|
lastAbsoluteX = absoluteX
|
||||||
lastAbsoluteY = absoluteY
|
lastAbsoluteY = absoluteY
|
||||||
@ -66,7 +67,7 @@ open class MatterGaugePanel<out S : Screen> @JvmOverloads constructor(
|
|||||||
lastLevel = widget.percentage
|
lastLevel = widget.percentage
|
||||||
}
|
}
|
||||||
|
|
||||||
GAUGE_BACKGROUND.render(stack)
|
GAUGE_BACKGROUND.render(graphics)
|
||||||
val height = this.height * (1f - widget.percentage)
|
val height = this.height * (1f - widget.percentage)
|
||||||
|
|
||||||
if (widget.percentage > 0.01f) {
|
if (widget.percentage > 0.01f) {
|
||||||
@ -81,7 +82,7 @@ open class MatterGaugePanel<out S : Screen> @JvmOverloads constructor(
|
|||||||
val u1 = GAUGE_FOREGROUND.u1
|
val u1 = GAUGE_FOREGROUND.u1
|
||||||
val v1 = GAUGE_FOREGROUND.v1
|
val v1 = GAUGE_FOREGROUND.v1
|
||||||
|
|
||||||
val matrix = stack.last().pose()
|
val matrix = graphics.pose().last().pose()
|
||||||
val builder = tesselator.builder
|
val builder = tesselator.builder
|
||||||
|
|
||||||
builder.begin(VertexFormat.Mode.TRIANGLE_FAN, DefaultVertexFormat.POSITION_TEX)
|
builder.begin(VertexFormat.Mode.TRIANGLE_FAN, DefaultVertexFormat.POSITION_TEX)
|
||||||
@ -106,9 +107,9 @@ open class MatterGaugePanel<out S : Screen> @JvmOverloads constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun innerRenderTooltips(stack: PoseStack, mouseX: Float, mouseY: Float, partialTick: Float): Boolean {
|
override fun innerRenderTooltips(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float): Boolean {
|
||||||
if (isHovered) {
|
if (isHovered) {
|
||||||
screen.renderComponentTooltip(stack, makeTooltip(), mouseX.toInt(), mouseY.toInt())
|
graphics.renderComponentTooltip(font, makeTooltip(), mouseX.toInt(), mouseY.toInt())
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package ru.dbotthepony.mc.otm.client.screen.widget
|
package ru.dbotthepony.mc.otm.client.screen.widget
|
||||||
|
|
||||||
import com.mojang.blaze3d.vertex.PoseStack
|
import com.mojang.blaze3d.vertex.PoseStack
|
||||||
|
import net.minecraft.client.gui.GuiGraphics
|
||||||
import net.minecraft.client.gui.screens.Screen
|
import net.minecraft.client.gui.screens.Screen
|
||||||
import net.minecraft.network.chat.Component
|
import net.minecraft.network.chat.Component
|
||||||
import ru.dbotthepony.mc.otm.client.render.WidgetLocation
|
import ru.dbotthepony.mc.otm.client.render.WidgetLocation
|
||||||
@ -29,15 +30,15 @@ open class PatternGaugePanel<out S : Screen> @JvmOverloads constructor(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun innerRender(stack: PoseStack, mouseX: Float, mouseY: Float, partialTick: Float) {
|
override fun innerRender(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) {
|
||||||
GAUGE_BACKGROUND.render(stack)
|
GAUGE_BACKGROUND.render(graphics)
|
||||||
val height = this.height * widget.percentage
|
val height = this.height * widget.percentage
|
||||||
GAUGE_FOREGROUND.renderPartial(stack, y = this.height - height, height = height)
|
GAUGE_FOREGROUND.renderPartial(graphics, y = this.height - height, height = height)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun innerRenderTooltips(stack: PoseStack, mouseX: Float, mouseY: Float, partialTick: Float): Boolean {
|
override fun innerRenderTooltips(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float): Boolean {
|
||||||
if (isHovered) {
|
if (isHovered) {
|
||||||
screen.renderComponentTooltip(stack, makeTooltip(), mouseX.toInt(), mouseY.toInt())
|
graphics.renderComponentTooltip(font, makeTooltip(), mouseX.toInt(), mouseY.toInt())
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@ package ru.dbotthepony.mc.otm.client.screen.widget
|
|||||||
import com.mojang.blaze3d.vertex.PoseStack
|
import com.mojang.blaze3d.vertex.PoseStack
|
||||||
import it.unimi.dsi.fastutil.ints.IntArrayList
|
import it.unimi.dsi.fastutil.ints.IntArrayList
|
||||||
import net.minecraft.ChatFormatting
|
import net.minecraft.ChatFormatting
|
||||||
|
import net.minecraft.client.gui.GuiGraphics
|
||||||
import net.minecraft.client.gui.screens.Screen
|
import net.minecraft.client.gui.screens.Screen
|
||||||
import net.minecraft.network.chat.Component
|
import net.minecraft.network.chat.Component
|
||||||
import ru.dbotthepony.mc.otm.capability.energy.ProfiledEnergyStorage
|
import ru.dbotthepony.mc.otm.capability.energy.ProfiledEnergyStorage
|
||||||
@ -40,21 +41,21 @@ open class PowerGaugePanel<out S : Screen>(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun innerRender(stack: PoseStack, mouseX: Float, mouseY: Float, partialTick: Float) {
|
override fun innerRender(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) {
|
||||||
val height = this.height * widget.percentage
|
val height = this.height * widget.percentage
|
||||||
|
|
||||||
if (width >= 18f) {
|
if (width >= 18f) {
|
||||||
GAUGE_BACKGROUND_WIDE.render(stack, width = width, height = this.height)
|
GAUGE_BACKGROUND_WIDE.render(graphics, width = width, height = this.height)
|
||||||
GAUGE_FOREGROUND_WIDE.renderPartial(
|
GAUGE_FOREGROUND_WIDE.renderPartial(
|
||||||
stack,
|
graphics,
|
||||||
y = this.height - height,
|
y = this.height - height,
|
||||||
height = height,
|
height = height,
|
||||||
width = width,
|
width = width,
|
||||||
winding = UVWindingOrder.U0_V1_U1_V0)
|
winding = UVWindingOrder.U0_V1_U1_V0)
|
||||||
} else {
|
} else {
|
||||||
GAUGE_BACKGROUND.render(stack, width = width, height = this.height)
|
GAUGE_BACKGROUND.render(graphics, width = width, height = this.height)
|
||||||
GAUGE_FOREGROUND.renderPartial(
|
GAUGE_FOREGROUND.renderPartial(
|
||||||
stack,
|
graphics,
|
||||||
y = this.height - height,
|
y = this.height - height,
|
||||||
height = height,
|
height = height,
|
||||||
width = width,
|
width = width,
|
||||||
@ -62,9 +63,9 @@ open class PowerGaugePanel<out S : Screen>(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun innerRenderTooltips(stack: PoseStack, mouseX: Float, mouseY: Float, partialTick: Float): Boolean {
|
override fun innerRenderTooltips(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float): Boolean {
|
||||||
if (isHovered) {
|
if (isHovered) {
|
||||||
screen.renderComponentTooltip(stack, makeTooltip(), mouseX.toInt(), mouseY.toInt())
|
graphics.renderComponentTooltip(font, makeTooltip(), mouseX.toInt(), mouseY.toInt())
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@ package ru.dbotthepony.mc.otm.client.screen.widget
|
|||||||
import com.mojang.blaze3d.systems.RenderSystem
|
import com.mojang.blaze3d.systems.RenderSystem
|
||||||
import com.mojang.blaze3d.vertex.PoseStack
|
import com.mojang.blaze3d.vertex.PoseStack
|
||||||
import net.minecraft.ChatFormatting
|
import net.minecraft.ChatFormatting
|
||||||
|
import net.minecraft.client.gui.GuiGraphics
|
||||||
import net.minecraft.client.gui.screens.Screen
|
import net.minecraft.client.gui.screens.Screen
|
||||||
import net.minecraft.network.chat.Component
|
import net.minecraft.network.chat.Component
|
||||||
import ru.dbotthepony.mc.otm.client.render.UVWindingOrder
|
import ru.dbotthepony.mc.otm.client.render.UVWindingOrder
|
||||||
@ -48,19 +49,19 @@ open class ProgressGaugePanel<out S : Screen> @JvmOverloads constructor(
|
|||||||
return tooltip
|
return tooltip
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun innerRender(stack: PoseStack, mouseX: Float, mouseY: Float, partialTick: Float) {
|
override fun innerRender(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) {
|
||||||
if (widget.isStuck && tickCount % 40 <= 20) {
|
if (widget.isStuck && tickCount % 40 <= 20) {
|
||||||
RenderSystem.setShaderColor(0.75f, 0.4f, 0.4f, 1f)
|
RenderSystem.setShaderColor(0.75f, 0.4f, 0.4f, 1f)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flop) {
|
if (flop) {
|
||||||
GAUGE_BACKGROUND.render(stack, height = height, width = this.width, winding = UVWindingOrder.U1_V0_U0_V1)
|
GAUGE_BACKGROUND.render(graphics, height = height, width = this.width, winding = UVWindingOrder.U1_V0_U0_V1)
|
||||||
val width = (this.width * widget.percentage).roundToInt().toFloat()
|
val width = (this.width * widget.percentage).roundToInt().toFloat()
|
||||||
GAUGE_FOREGROUND.renderPartial(stack, x = this.width - width, height = height, width = width, winding = UVWindingOrder.U1_V0_U0_V1)
|
GAUGE_FOREGROUND.renderPartial(graphics, x = this.width - width, height = height, width = width, winding = UVWindingOrder.U1_V0_U0_V1)
|
||||||
} else {
|
} else {
|
||||||
GAUGE_BACKGROUND.render(stack, height = height, width = this.width)
|
GAUGE_BACKGROUND.render(graphics, height = height, width = this.width)
|
||||||
val width = (this.width * widget.percentage).roundToInt().toFloat()
|
val width = (this.width * widget.percentage).roundToInt().toFloat()
|
||||||
GAUGE_FOREGROUND.renderPartial(stack, height = height, width = width)
|
GAUGE_FOREGROUND.renderPartial(graphics, height = height, width = width)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (widget.isStuck && tickCount % 40 <= 20) {
|
if (widget.isStuck && tickCount % 40 <= 20) {
|
||||||
@ -68,9 +69,9 @@ open class ProgressGaugePanel<out S : Screen> @JvmOverloads constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun innerRenderTooltips(stack: PoseStack, mouseX: Float, mouseY: Float, partialTick: Float): Boolean {
|
override fun innerRenderTooltips(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float): Boolean {
|
||||||
if (isHovered) {
|
if (isHovered) {
|
||||||
screen.renderComponentTooltip(stack, makeTooltip(), mouseX.toInt(), mouseY.toInt())
|
graphics.renderComponentTooltip(font, makeTooltip(), mouseX.toInt(), mouseY.toInt())
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ import lain.mods.cos.impl.ModObjects
|
|||||||
import lain.mods.cos.impl.client.PlayerRenderHandler
|
import lain.mods.cos.impl.client.PlayerRenderHandler
|
||||||
import lain.mods.cos.impl.client.gui.GuiCosArmorInventory
|
import lain.mods.cos.impl.client.gui.GuiCosArmorInventory
|
||||||
import lain.mods.cos.impl.network.packet.PacketSetSkinArmor
|
import lain.mods.cos.impl.network.packet.PacketSetSkinArmor
|
||||||
|
import net.minecraft.client.gui.GuiGraphics
|
||||||
import net.minecraft.client.gui.screens.Screen
|
import net.minecraft.client.gui.screens.Screen
|
||||||
import net.minecraft.resources.ResourceLocation
|
import net.minecraft.resources.ResourceLocation
|
||||||
import net.minecraft.server.level.ServerPlayer
|
import net.minecraft.server.level.ServerPlayer
|
||||||
@ -174,13 +175,13 @@ class CosmeticToggleButton<out S : Screen>(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun innerRender(stack: PoseStack, mouseX: Float, mouseY: Float, partialTick: Float) {
|
override fun innerRender(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) {
|
||||||
val inv = ModObjects.invMan.getCosArmorInventoryClient(minecraft.player?.uuid ?: throw ConcurrentModificationException())
|
val inv = ModObjects.invMan.getCosArmorInventoryClient(minecraft.player?.uuid ?: throw ConcurrentModificationException())
|
||||||
|
|
||||||
if (inv.isSkinArmor(index)) {
|
if (inv.isSkinArmor(index)) {
|
||||||
BUTTON_ACTIVE.render(stack, width = width, height = height)
|
BUTTON_ACTIVE.render(graphics, width = width, height = height)
|
||||||
} else {
|
} else {
|
||||||
BUTTON_INACTIVE.render(stack, width = width, height = height)
|
BUTTON_INACTIVE.render(graphics, width = width, height = height)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -213,11 +214,11 @@ class CosmeticToggleRenderButton<out S : Screen>(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun innerRender(stack: PoseStack, mouseX: Float, mouseY: Float, partialTick: Float) {
|
override fun innerRender(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) {
|
||||||
if (PlayerRenderHandler.Disabled) {
|
if (PlayerRenderHandler.Disabled) {
|
||||||
BUTTON_ACTIVE.render(stack, width = width, height = height)
|
BUTTON_ACTIVE.render(graphics, width = width, height = height)
|
||||||
} else {
|
} else {
|
||||||
BUTTON_INACTIVE.render(stack, width = width, height = height)
|
BUTTON_INACTIVE.render(graphics, width = width, height = height)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -87,8 +87,8 @@ class MinecartCargoCrate(
|
|||||||
|
|
||||||
if (interactingPlayers++ == 0) {
|
if (interactingPlayers++ == 0) {
|
||||||
if (!isRemoved) {
|
if (!isRemoved) {
|
||||||
level.playSound(null, this, MSoundEvents.CARGO_CRATE_OPEN, SoundSource.BLOCKS, 1f, 0.8f + level.random.nextFloat() * 0.2f)
|
level().playSound(null, this, MSoundEvents.CARGO_CRATE_OPEN, SoundSource.BLOCKS, 1f, 0.8f + level().random.nextFloat() * 0.2f)
|
||||||
level.gameEvent(GameEvent.CONTAINER_OPEN, position, GameEvent.Context.of(this))
|
level().gameEvent(GameEvent.CONTAINER_OPEN, position, GameEvent.Context.of(this))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -99,7 +99,7 @@ class MinecartCargoCrate(
|
|||||||
|
|
||||||
if (--interactingPlayers == 0) {
|
if (--interactingPlayers == 0) {
|
||||||
if (!isRemoved) {
|
if (!isRemoved) {
|
||||||
level.gameEvent(GameEvent.CONTAINER_CLOSE, position, GameEvent.Context.of(this))
|
level().gameEvent(GameEvent.CONTAINER_CLOSE, position, GameEvent.Context.of(this))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ class PlasmaProjectile(level: Level) : Projectile(MEntityTypes.PLASMA as EntityT
|
|||||||
override fun onHit(p_37260_: HitResult) {
|
override fun onHit(p_37260_: HitResult) {
|
||||||
super.onHit(p_37260_)
|
super.onHit(p_37260_)
|
||||||
|
|
||||||
if (!level.isClientSide) {
|
if (!level().isClientSide) {
|
||||||
discard()
|
discard()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -37,8 +37,8 @@ class PlasmaProjectile(level: Level) : Projectile(MEntityTypes.PLASMA as EntityT
|
|||||||
override fun onHitEntity(p_37259_: EntityHitResult) {
|
override fun onHitEntity(p_37259_: EntityHitResult) {
|
||||||
super.onHitEntity(p_37259_)
|
super.onHitEntity(p_37259_)
|
||||||
|
|
||||||
if (!level.isClientSide) {
|
if (!level().isClientSide) {
|
||||||
p_37259_.entity.hurt(MatteryDamageSource(level.registryAccess().damageType(MDamageTypes.PLASMA), owner, inflictor), damage)
|
p_37259_.entity.hurt(MatteryDamageSource(level().registryAccess().damageType(MDamageTypes.PLASMA), owner, inflictor), damage)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,17 +54,17 @@ class PlasmaProjectile(level: Level) : Projectile(MEntityTypes.PLASMA as EntityT
|
|||||||
|
|
||||||
super.tick()
|
super.tick()
|
||||||
|
|
||||||
val trace = ProjectileUtil.getHitResult(this, this::canHitEntity)
|
val trace = ProjectileUtil.getHitResultOnMoveVector(this, this::canHitEntity)
|
||||||
|
|
||||||
if (trace.type == HitResult.Type.BLOCK) {
|
if (trace.type == HitResult.Type.BLOCK) {
|
||||||
val pos = (trace as BlockHitResult).blockPos
|
val pos = (trace as BlockHitResult).blockPos
|
||||||
val state = level.getBlockState(pos)
|
val state = level().getBlockState(pos)
|
||||||
|
|
||||||
if (state.`is`(Blocks.NETHER_PORTAL) || state.`is`(Blocks.END_GATEWAY)) {
|
if (state.`is`(Blocks.NETHER_PORTAL) || state.`is`(Blocks.END_GATEWAY)) {
|
||||||
onHitBlock(trace)
|
onHitBlock(trace)
|
||||||
|
|
||||||
// don't teleport plasma projectile
|
// don't teleport plasma projectile
|
||||||
if (!level.isClientSide)
|
if (!level().isClientSide)
|
||||||
discard()
|
discard()
|
||||||
|
|
||||||
return
|
return
|
||||||
@ -85,7 +85,7 @@ class PlasmaProjectile(level: Level) : Projectile(MEntityTypes.PLASMA as EntityT
|
|||||||
// extinguish
|
// extinguish
|
||||||
|
|
||||||
for (i in 0 .. 4) {
|
for (i in 0 .. 4) {
|
||||||
level.addParticle(
|
level().addParticle(
|
||||||
ParticleTypes.BUBBLE,
|
ParticleTypes.BUBBLE,
|
||||||
x - deltaMovement.x * 0.25,
|
x - deltaMovement.x * 0.25,
|
||||||
y - deltaMovement.y * 0.25,
|
y - deltaMovement.y * 0.25,
|
||||||
@ -96,9 +96,9 @@ class PlasmaProjectile(level: Level) : Projectile(MEntityTypes.PLASMA as EntityT
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!level.isClientSide) {
|
if (!level().isClientSide) {
|
||||||
discard()
|
discard()
|
||||||
level.levelEvent(LevelEvent.LAVA_FIZZ, blockPosition(), 0)
|
level().levelEvent(LevelEvent.LAVA_FIZZ, blockPosition(), 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
|
@ -22,11 +22,11 @@ class EssenceServoItem : Item(Properties().stacksTo(64)) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun useServo(player: Player, pos: BlockPos): InteractionResult {
|
fun useServo(player: Player, pos: BlockPos): InteractionResult {
|
||||||
val block = player.level.getBlockEntity(pos) ?: return InteractionResult.FAIL
|
val block = player.level().getBlockEntity(pos) ?: return InteractionResult.FAIL
|
||||||
|
|
||||||
// TODO: опыт как жидкость
|
// TODO: опыт как жидкость
|
||||||
if (block is EssenceStorageBlockEntity) {
|
if (block is EssenceStorageBlockEntity) {
|
||||||
if (player.level.isClientSide) return InteractionResult.SUCCESS
|
if (player.level().isClientSide) return InteractionResult.SUCCESS
|
||||||
if (player !is ServerPlayer) return InteractionResult.FAIL
|
if (player !is ServerPlayer) return InteractionResult.FAIL
|
||||||
|
|
||||||
if (player.isCrouching) { // выгружаем в блок
|
if (player.isCrouching) { // выгружаем в блок
|
||||||
|
@ -90,7 +90,7 @@ class FluidCapsuleItem(val capacity: IntSupplier) : Item(Properties().stacksTo(6
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun canInteract(item: ItemStack, player: Player, context: Context): Boolean {
|
override fun canInteract(item: ItemStack, player: Player, context: Context): Boolean {
|
||||||
return player.level.getBlockState(context.blockPos).`is`(Blocks.CAULDRON)
|
return player.level().getBlockState(context.blockPos).`is`(Blocks.CAULDRON)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun interact(item: ItemStack, player: Player, context: Context): InteractionResult {
|
override fun interact(item: ItemStack, player: Player, context: Context): InteractionResult {
|
||||||
@ -105,12 +105,12 @@ class FluidCapsuleItem(val capacity: IntSupplier) : Item(Properties().stacksTo(6
|
|||||||
val drained = cap.drain(toDrain, IFluidHandler.FluidAction.SIMULATE)
|
val drained = cap.drain(toDrain, IFluidHandler.FluidAction.SIMULATE)
|
||||||
|
|
||||||
if (!drained.isEmpty && drained.amount == 1000) {
|
if (!drained.isEmpty && drained.amount == 1000) {
|
||||||
player.level.playSound(player, context.blockPos, soundEvent, SoundSource.BLOCKS)
|
player.level().playSound(player, context.blockPos, soundEvent, SoundSource.BLOCKS)
|
||||||
val level = player.level as? ServerLevel ?: return InteractionResult.SUCCESS
|
val level = player.level() as? ServerLevel ?: return InteractionResult.SUCCESS
|
||||||
level.setBlock(context.blockPos, newState, Block.UPDATE_ALL)
|
level.setBlock(context.blockPos, newState, Block.UPDATE_ALL)
|
||||||
cap.drain(toDrain, IFluidHandler.FluidAction.EXECUTE)
|
cap.drain(toDrain, IFluidHandler.FluidAction.EXECUTE)
|
||||||
|
|
||||||
if (item.count != 1 && !player.level.isClientSide) {
|
if (item.count != 1 && !player.level().isClientSide) {
|
||||||
item.count--
|
item.count--
|
||||||
|
|
||||||
if (!player.inventory.add(targetItem)) {
|
if (!player.inventory.add(targetItem)) {
|
||||||
@ -133,7 +133,7 @@ class FluidCapsuleItem(val capacity: IntSupplier) : Item(Properties().stacksTo(6
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun canInteract(item: ItemStack, player: Player, context: Context): Boolean {
|
override fun canInteract(item: ItemStack, player: Player, context: Context): Boolean {
|
||||||
return player.level.getBlockState(context.blockPos) in mapping
|
return player.level().getBlockState(context.blockPos) in mapping
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun interact(item: ItemStack, player: Player, context: Context): InteractionResult {
|
override fun interact(item: ItemStack, player: Player, context: Context): InteractionResult {
|
||||||
@ -149,13 +149,13 @@ class FluidCapsuleItem(val capacity: IntSupplier) : Item(Properties().stacksTo(6
|
|||||||
val fill = cap.fill(toFill, IFluidHandler.FluidAction.SIMULATE)
|
val fill = cap.fill(toFill, IFluidHandler.FluidAction.SIMULATE)
|
||||||
if (fill != 1000) return InteractionResult.FAIL
|
if (fill != 1000) return InteractionResult.FAIL
|
||||||
|
|
||||||
player.level.playSound(player, context.blockPos, mapped.second, SoundSource.BLOCKS)
|
player.level().playSound(player, context.blockPos, mapped.second, SoundSource.BLOCKS)
|
||||||
|
|
||||||
val level = player.level as? ServerLevel ?: return InteractionResult.SUCCESS
|
val level = player.level() as? ServerLevel ?: return InteractionResult.SUCCESS
|
||||||
level.setBlock(context.blockPos, Blocks.CAULDRON.defaultBlockState(), Block.UPDATE_ALL)
|
level.setBlock(context.blockPos, Blocks.CAULDRON.defaultBlockState(), Block.UPDATE_ALL)
|
||||||
cap.fill(toFill, IFluidHandler.FluidAction.EXECUTE)
|
cap.fill(toFill, IFluidHandler.FluidAction.EXECUTE)
|
||||||
|
|
||||||
if (item.count != 1 && !player.level.isClientSide) {
|
if (item.count != 1 && !player.level().isClientSide) {
|
||||||
item.count--
|
item.count--
|
||||||
|
|
||||||
if (!player.inventory.add(targetItem)) {
|
if (!player.inventory.add(targetItem)) {
|
||||||
@ -163,13 +163,13 @@ class FluidCapsuleItem(val capacity: IntSupplier) : Item(Properties().stacksTo(6
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return InteractionResult.sidedSuccess(player.level.isClientSide)
|
return InteractionResult.sidedSuccess(player.level().isClientSide)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private object FillEmptyCapability : Interaction {
|
private object FillEmptyCapability : Interaction {
|
||||||
override fun canInteract(item: ItemStack, player: Player, context: Context): Boolean {
|
override fun canInteract(item: ItemStack, player: Player, context: Context): Boolean {
|
||||||
val target = player.level.getBlockEntity(context.blockPos)?.getCapability(ForgeCapabilities.FLUID_HANDLER, context.side)?.orNull() ?: return false
|
val target = player.level().getBlockEntity(context.blockPos)?.getCapability(ForgeCapabilities.FLUID_HANDLER, context.side)?.orNull() ?: return false
|
||||||
val cap = item.getCapability(ForgeCapabilities.FLUID_HANDLER_ITEM).orNull() ?: return false
|
val cap = item.getCapability(ForgeCapabilities.FLUID_HANDLER_ITEM).orNull() ?: return false
|
||||||
return target.stream().anyMatch { !it.isEmpty } || cap.stream().anyMatch { !it.isEmpty }
|
return target.stream().anyMatch { !it.isEmpty } || cap.stream().anyMatch { !it.isEmpty }
|
||||||
}
|
}
|
||||||
@ -180,21 +180,21 @@ class FluidCapsuleItem(val capacity: IntSupplier) : Item(Properties().stacksTo(6
|
|||||||
val targetItem = if (item.count == 1) item else item.copyWithCount(1)
|
val targetItem = if (item.count == 1) item else item.copyWithCount(1)
|
||||||
|
|
||||||
val itemCap = targetItem.getCapability(ForgeCapabilities.FLUID_HANDLER_ITEM).orNull() ?: return InteractionResult.FAIL
|
val itemCap = targetItem.getCapability(ForgeCapabilities.FLUID_HANDLER_ITEM).orNull() ?: return InteractionResult.FAIL
|
||||||
val blockCap = player.level.getBlockEntity(context.blockPos)?.getCapability(ForgeCapabilities.FLUID_HANDLER, context.side)?.orNull() ?: return InteractionResult.FAIL
|
val blockCap = player.level().getBlockEntity(context.blockPos)?.getCapability(ForgeCapabilities.FLUID_HANDLER, context.side)?.orNull() ?: return InteractionResult.FAIL
|
||||||
val fluid = itemCap[0]
|
val fluid = itemCap[0]
|
||||||
|
|
||||||
if (fluid.isEmpty) {
|
if (fluid.isEmpty) {
|
||||||
// заполняем из блока
|
// заполняем из блока
|
||||||
val moveResult = moveFluid(source = blockCap, destination = itemCap, actuallyDrain = !player.level.isClientSide, actuallyFill = !player.level.isClientSide)
|
val moveResult = moveFluid(source = blockCap, destination = itemCap, actuallyDrain = !player.level().isClientSide, actuallyFill = !player.level().isClientSide)
|
||||||
|
|
||||||
if (!moveResult.isEmpty) {
|
if (!moveResult.isEmpty) {
|
||||||
val sound = moveResult.fluid.fluidType.getSound(moveResult, SoundActions.BUCKET_FILL)
|
val sound = moveResult.fluid.fluidType.getSound(moveResult, SoundActions.BUCKET_FILL)
|
||||||
|
|
||||||
if (sound != null) {
|
if (sound != null) {
|
||||||
player.level.playSound(player, context.blockPos, sound, SoundSource.BLOCKS)
|
player.level().playSound(player, context.blockPos, sound, SoundSource.BLOCKS)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.count != 1 && !player.level.isClientSide) {
|
if (item.count != 1 && !player.level().isClientSide) {
|
||||||
item.count--
|
item.count--
|
||||||
|
|
||||||
if (!player.inventory.add(targetItem)) {
|
if (!player.inventory.add(targetItem)) {
|
||||||
@ -202,21 +202,21 @@ class FluidCapsuleItem(val capacity: IntSupplier) : Item(Properties().stacksTo(6
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return InteractionResult.sidedSuccess(player.level.isClientSide)
|
return InteractionResult.sidedSuccess(player.level().isClientSide)
|
||||||
} else {
|
} else {
|
||||||
return InteractionResult.FAIL
|
return InteractionResult.FAIL
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
val moveResult = moveFluid(source = itemCap, destination = blockCap, actuallyDrain = !player.level.isClientSide, actuallyFill = !player.level.isClientSide)
|
val moveResult = moveFluid(source = itemCap, destination = blockCap, actuallyDrain = !player.level().isClientSide, actuallyFill = !player.level().isClientSide)
|
||||||
|
|
||||||
if (!moveResult.isEmpty) {
|
if (!moveResult.isEmpty) {
|
||||||
val sound = moveResult.fluid.fluidType.getSound(moveResult, SoundActions.BUCKET_EMPTY)
|
val sound = moveResult.fluid.fluidType.getSound(moveResult, SoundActions.BUCKET_EMPTY)
|
||||||
|
|
||||||
if (sound != null) {
|
if (sound != null) {
|
||||||
player.level.playSound(player, context.blockPos, sound, SoundSource.BLOCKS)
|
player.level().playSound(player, context.blockPos, sound, SoundSource.BLOCKS)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.count != 1 && !player.level.isClientSide) {
|
if (item.count != 1 && !player.level().isClientSide) {
|
||||||
item.count--
|
item.count--
|
||||||
|
|
||||||
if (!player.inventory.add(targetItem)) {
|
if (!player.inventory.add(targetItem)) {
|
||||||
@ -224,7 +224,7 @@ class FluidCapsuleItem(val capacity: IntSupplier) : Item(Properties().stacksTo(6
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return InteractionResult.sidedSuccess(player.level.isClientSide)
|
return InteractionResult.sidedSuccess(player.level().isClientSide)
|
||||||
} else {
|
} else {
|
||||||
return InteractionResult.FAIL
|
return InteractionResult.FAIL
|
||||||
}
|
}
|
||||||
|
@ -90,7 +90,7 @@ class MatterDustItem : Item(Properties().stacksTo(64)), IMatterItem {
|
|||||||
val matterHalf = getMatterValue(pStack)?.matter?.div(2) ?: return true
|
val matterHalf = getMatterValue(pStack)?.matter?.div(2) ?: return true
|
||||||
|
|
||||||
val halfStack = pStack.copyWithCount(1)
|
val halfStack = pStack.copyWithCount(1)
|
||||||
matter(halfStack, -addMatterValue(pStack, -matterHalf, pPlayer.level.isClientSide()))
|
matter(halfStack, -addMatterValue(pStack, -matterHalf, pPlayer.level().isClientSide()))
|
||||||
pSlot.set(halfStack)
|
pSlot.set(halfStack)
|
||||||
|
|
||||||
if (getMatterValue(pStack)?.matter!! <= Decimal.ZERO) {
|
if (getMatterValue(pStack)?.matter!! <= Decimal.ZERO) {
|
||||||
@ -120,13 +120,13 @@ class MatterDustItem : Item(Properties().stacksTo(64)), IMatterItem {
|
|||||||
val matterHalf = getMatterValue(pStack)?.matter?.div(2) ?: return true
|
val matterHalf = getMatterValue(pStack)?.matter?.div(2) ?: return true
|
||||||
|
|
||||||
val halfStack = pStack.copyWithCount(1)
|
val halfStack = pStack.copyWithCount(1)
|
||||||
matter(halfStack, -addMatterValue(pStack, -matterHalf, pPlayer.level.isClientSide()))
|
matter(halfStack, -addMatterValue(pStack, -matterHalf, pPlayer.level().isClientSide()))
|
||||||
pAccess.set(halfStack)
|
pAccess.set(halfStack)
|
||||||
|
|
||||||
return true
|
return true
|
||||||
} else if (pOther.item is MatterDustItem && pOther.count == 1) {
|
} else if (pOther.item is MatterDustItem && pOther.count == 1) {
|
||||||
val matterOther = getMatterValue(pOther)?.matter ?: return true
|
val matterOther = getMatterValue(pOther)?.matter ?: return true
|
||||||
val diff = addMatterValue(pStack, matterOther, pPlayer.level.isClientSide())
|
val diff = addMatterValue(pStack, matterOther, pPlayer.level().isClientSide())
|
||||||
|
|
||||||
if (matterOther - diff <= Decimal.ZERO) {
|
if (matterOther - diff <= Decimal.ZERO) {
|
||||||
pOther.shrink(1)
|
pOther.shrink(1)
|
||||||
|
@ -91,20 +91,20 @@ class ExplosiveHammerItem(durability: Int = 512) : Item(Properties().stacksTo(1)
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun attackAt(itemStack: ItemStack, attacker: LivingEntity, pos: Vec3, aim: Vec3, hand: InteractionHand) {
|
fun attackAt(itemStack: ItemStack, attacker: LivingEntity, pos: Vec3, aim: Vec3, hand: InteractionHand) {
|
||||||
if (!isPrimed(itemStack) || attacker.level.isClientSide || attacker is Player && attacker.getAttackStrengthScale(0.4f) < 0.98f)
|
if (!isPrimed(itemStack) || attacker.level().isClientSide || attacker is Player && attacker.getAttackStrengthScale(0.4f) < 0.98f)
|
||||||
return
|
return
|
||||||
|
|
||||||
val (ex, ey, ez) = pos
|
val (ex, ey, ez) = pos
|
||||||
|
|
||||||
// взрыв в месте удара молотком
|
// взрыв в месте удара молотком
|
||||||
val exp = Explosion(attacker.level, attacker, ex, ey, ez, 1f, false, if (ToolsConfig.ExplosiveHammer.EXPLOSION_DAMAGE_BLOCKS) Explosion.BlockInteraction.DESTROY_WITH_DECAY else Explosion.BlockInteraction.KEEP)
|
val exp = Explosion(attacker.level(), attacker, ex, ey, ez, 1f, false, if (ToolsConfig.ExplosiveHammer.EXPLOSION_DAMAGE_BLOCKS) Explosion.BlockInteraction.DESTROY_WITH_DECAY else Explosion.BlockInteraction.KEEP)
|
||||||
exp.explode()
|
exp.explode()
|
||||||
exp.finalizeExplosion(true)
|
exp.finalizeExplosion(true)
|
||||||
|
|
||||||
if (!ToolsConfig.ExplosiveHammer.EXPLOSION_DAMAGE_BLOCKS)
|
if (!ToolsConfig.ExplosiveHammer.EXPLOSION_DAMAGE_BLOCKS)
|
||||||
exp.clearToBlow()
|
exp.clearToBlow()
|
||||||
|
|
||||||
val level = attacker.level as ServerLevel
|
val level = attacker.level() as ServerLevel
|
||||||
|
|
||||||
val hitEntities = ObjectArraySet<LivingEntity>()
|
val hitEntities = ObjectArraySet<LivingEntity>()
|
||||||
hitEntities.add(attacker)
|
hitEntities.add(attacker)
|
||||||
@ -164,7 +164,7 @@ class ExplosiveHammerItem(durability: Int = 512) : Item(Properties().stacksTo(1)
|
|||||||
rayPos += aim * delta
|
rayPos += aim * delta
|
||||||
}
|
}
|
||||||
|
|
||||||
MatteryBlockEntity.watchingPlayers(pos, attacker.level)
|
MatteryBlockEntity.watchingPlayers(pos, level)
|
||||||
.filter { it.position.distanceTo(pos) <= 64.0 }
|
.filter { it.position.distanceTo(pos) <= 64.0 }
|
||||||
.forEach {
|
.forEach {
|
||||||
it.connection.send(ClientboundExplodePacket(ex, ey, ez, 1f, exp.toBlow, exp.hitPlayers[it]))
|
it.connection.send(ClientboundExplodePacket(ex, ey, ez, 1f, exp.toBlow, exp.hitPlayers[it]))
|
||||||
@ -183,7 +183,7 @@ class ExplosiveHammerItem(durability: Int = 512) : Item(Properties().stacksTo(1)
|
|||||||
attacker.setItemInHand(hand, ItemStack.EMPTY)
|
attacker.setItemInHand(hand, ItemStack.EMPTY)
|
||||||
|
|
||||||
val (x, y, z) = attacker.position
|
val (x, y, z) = attacker.position
|
||||||
val entity = ItemEntity(attacker.level, x, y, z, itemStack)
|
val entity = ItemEntity(level, x, y, z, itemStack)
|
||||||
|
|
||||||
val (xv, yv, zv) = attacker.getViewVector(0f)
|
val (xv, yv, zv) = attacker.getViewVector(0f)
|
||||||
|
|
||||||
@ -193,7 +193,7 @@ class ExplosiveHammerItem(durability: Int = 512) : Item(Properties().stacksTo(1)
|
|||||||
(attacker.random.nextDouble() + 0.65) * zv * -2.0,
|
(attacker.random.nextDouble() + 0.65) * zv * -2.0,
|
||||||
)
|
)
|
||||||
|
|
||||||
attacker.level.addFreshEntity(entity)
|
level.addFreshEntity(entity)
|
||||||
|
|
||||||
if (attacker.random.nextDouble() <= ToolsConfig.ExplosiveHammer.FLY_OFF_DAMAGE_CHANCE) {
|
if (attacker.random.nextDouble() <= ToolsConfig.ExplosiveHammer.FLY_OFF_DAMAGE_CHANCE) {
|
||||||
attacker.invulnerableTime = 0
|
attacker.invulnerableTime = 0
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
package ru.dbotthepony.mc.otm.item.tool
|
package ru.dbotthepony.mc.otm.item.tool
|
||||||
|
|
||||||
|
import net.minecraft.tags.BlockTags
|
||||||
import net.minecraft.world.item.AxeItem
|
import net.minecraft.world.item.AxeItem
|
||||||
import net.minecraft.world.item.ItemStack
|
import net.minecraft.world.item.ItemStack
|
||||||
import net.minecraft.world.item.Tier
|
import net.minecraft.world.item.Tier
|
||||||
import net.minecraft.world.level.block.state.BlockState
|
import net.minecraft.world.level.block.state.BlockState
|
||||||
import net.minecraft.world.level.material.Material
|
|
||||||
import ru.dbotthepony.mc.otm.config.ToolsConfig
|
import ru.dbotthepony.mc.otm.config.ToolsConfig
|
||||||
|
|
||||||
class MatteryAxeItem(pTier: Tier, pAttackDamageModifier: Float, pAttackSpeedModifier: Float, pProperties: Properties) : AxeItem(pTier, pAttackDamageModifier, pAttackSpeedModifier, pProperties) {
|
class MatteryAxeItem(pTier: Tier, pAttackDamageModifier: Float, pAttackSpeedModifier: Float, pProperties: Properties) : AxeItem(pTier, pAttackDamageModifier, pAttackSpeedModifier, pProperties) {
|
||||||
override fun getDestroySpeed(pStack: ItemStack, pState: BlockState): Float {
|
override fun getDestroySpeed(pStack: ItemStack, pState: BlockState): Float {
|
||||||
if (pState.material == Material.LEAVES && ToolsConfig.AXES_BREAK_LEAVES_INSTANTLY)
|
if (pState.`is`(BlockTags.LEAVES) && ToolsConfig.AXES_BREAK_LEAVES_INSTANTLY)
|
||||||
return 64f
|
return 64f
|
||||||
|
|
||||||
return super.getDestroySpeed(pStack, pState)
|
return super.getDestroySpeed(pStack, pState)
|
||||||
|
@ -24,6 +24,8 @@ import net.minecraftforge.network.NetworkEvent
|
|||||||
import ru.dbotthepony.mc.otm.*
|
import ru.dbotthepony.mc.otm.*
|
||||||
import ru.dbotthepony.mc.otm.capability.matteryEnergy
|
import ru.dbotthepony.mc.otm.capability.matteryEnergy
|
||||||
import ru.dbotthepony.mc.otm.client.font
|
import ru.dbotthepony.mc.otm.client.font
|
||||||
|
import ru.dbotthepony.mc.otm.client.render.TextAlign
|
||||||
|
import ru.dbotthepony.mc.otm.client.render.drawAligned
|
||||||
import ru.dbotthepony.mc.otm.client.render.drawRect
|
import ru.dbotthepony.mc.otm.client.render.drawRect
|
||||||
import ru.dbotthepony.mc.otm.client.render.setDrawColor
|
import ru.dbotthepony.mc.otm.client.render.setDrawColor
|
||||||
import ru.dbotthepony.mc.otm.core.*
|
import ru.dbotthepony.mc.otm.core.*
|
||||||
@ -466,7 +468,7 @@ abstract class AbstractWeaponItem<D : WeaponDataTable>(val tables: KClass<D>, pr
|
|||||||
pose.translate(0.0, 0.0, -1.0)
|
pose.translate(0.0, 0.0, -1.0)
|
||||||
pose.scale(0.7f, 0.7f, 0.7f)
|
pose.scale(0.7f, 0.7f, 0.7f)
|
||||||
val text = it.batteryLevel.formatPower()
|
val text = it.batteryLevel.formatPower()
|
||||||
font.draw(pose, text, 2f, 2f, RGBAColor.WHITE.toInt())
|
font.drawAligned(pose, text, TextAlign.TOP_LEFT, 2f, 2f, RGBAColor.WHITE.toInt())
|
||||||
pose.popPose()
|
pose.popPose()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ import net.minecraft.ChatFormatting
|
|||||||
import net.minecraft.core.BlockPos
|
import net.minecraft.core.BlockPos
|
||||||
import net.minecraft.nbt.CompoundTag
|
import net.minecraft.nbt.CompoundTag
|
||||||
import net.minecraft.network.chat.Component
|
import net.minecraft.network.chat.Component
|
||||||
|
import net.minecraft.tags.BlockTags
|
||||||
import net.minecraft.world.entity.EquipmentSlot
|
import net.minecraft.world.entity.EquipmentSlot
|
||||||
import net.minecraft.world.entity.LivingEntity
|
import net.minecraft.world.entity.LivingEntity
|
||||||
import net.minecraft.world.entity.ai.attributes.Attribute
|
import net.minecraft.world.entity.ai.attributes.Attribute
|
||||||
@ -22,7 +23,6 @@ import net.minecraft.world.item.enchantment.EnchantmentCategory
|
|||||||
import net.minecraft.world.level.Level
|
import net.minecraft.world.level.Level
|
||||||
import net.minecraft.world.level.block.Blocks
|
import net.minecraft.world.level.block.Blocks
|
||||||
import net.minecraft.world.level.block.state.BlockState
|
import net.minecraft.world.level.block.state.BlockState
|
||||||
import net.minecraft.world.level.material.Material
|
|
||||||
import net.minecraftforge.common.ForgeConfigSpec
|
import net.minecraftforge.common.ForgeConfigSpec
|
||||||
import net.minecraftforge.common.ToolAction
|
import net.minecraftforge.common.ToolAction
|
||||||
import net.minecraftforge.common.ToolActions
|
import net.minecraftforge.common.ToolActions
|
||||||
@ -83,17 +83,11 @@ class EnergySwordItem : Item(Properties().stacksTo(1).rarity(Rarity.RARE)), Vani
|
|||||||
val energy = itemStack.getCapability(MatteryCapability.ENERGY).orNull() ?: return 1f
|
val energy = itemStack.getCapability(MatteryCapability.ENERGY).orNull() ?: return 1f
|
||||||
|
|
||||||
if (blockState.`is`(Blocks.COBWEB)) {
|
if (blockState.`is`(Blocks.COBWEB)) {
|
||||||
if (energy.batteryLevel < COBWEB_POWER_COST) {
|
return if (energy.batteryLevel < COBWEB_POWER_COST) 2f else 25f
|
||||||
return 2f
|
} else if (blockState.`is`(BlockTags.SWORD_EFFICIENT)) {
|
||||||
|
return if (energy.batteryLevel < PLANT_POWER_COST) 1.5f else 8f
|
||||||
} else {
|
} else {
|
||||||
return 25f
|
return 1f
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return when (blockState.material) {
|
|
||||||
Material.PLANT, Material.REPLACEABLE_PLANT, Material.VEGETABLE -> if (energy.batteryLevel < PLANT_POWER_COST) 1.5f else 4f
|
|
||||||
Material.LEAVES -> if (energy.batteryLevel < PLANT_POWER_COST) 1.5f else 8f
|
|
||||||
else -> 1f
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -106,7 +100,7 @@ class EnergySwordItem : Item(Properties().stacksTo(1).rarity(Rarity.RARE)), Vani
|
|||||||
victim.matteryPlayer?.let {
|
victim.matteryPlayer?.let {
|
||||||
if (it.isAndroid) {
|
if (it.isAndroid) {
|
||||||
victim.invulnerableTime = 0
|
victim.invulnerableTime = 0
|
||||||
victim.hurt(MatteryDamageSource(attacker.level.registryAccess().damageType(MDamageTypes.EMP), attacker, itemStack), 8f)
|
victim.hurt(MatteryDamageSource(attacker.level().registryAccess().damageType(MDamageTypes.EMP), attacker, itemStack), 8f)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -115,11 +109,11 @@ class EnergySwordItem : Item(Properties().stacksTo(1).rarity(Rarity.RARE)), Vani
|
|||||||
|
|
||||||
itemStack.getCapability(MatteryCapability.ENERGY).ifPresentK {
|
itemStack.getCapability(MatteryCapability.ENERGY).ifPresentK {
|
||||||
if (it.extractEnergyExact(ENERGY_PER_SWING, false)) {
|
if (it.extractEnergyExact(ENERGY_PER_SWING, false)) {
|
||||||
it.extractEnergy(attacker.level.random.nextVariance(ENERGY_PER_SWING_VARIANCE), false)
|
it.extractEnergy(attacker.level().random.nextVariance(ENERGY_PER_SWING_VARIANCE), false)
|
||||||
victim.matteryPlayer?.let {
|
victim.matteryPlayer?.let {
|
||||||
if (it.isAndroid && it.androidEnergy.extractEnergyExact(ENERGY_ZAP, false)) {
|
if (it.isAndroid && it.androidEnergy.extractEnergyExact(ENERGY_ZAP, false)) {
|
||||||
it.androidEnergy.extractEnergy(attacker.level.random.nextVariance(ENERGY_ZAP_VARIANCE), false)
|
it.androidEnergy.extractEnergy(attacker.level().random.nextVariance(ENERGY_ZAP_VARIANCE), false)
|
||||||
victim.hurt(MatteryDamageSource(attacker.level.registryAccess().damageType(MDamageTypes.EMP), attacker, itemStack), 8f)
|
victim.hurt(MatteryDamageSource(attacker.level().registryAccess().damageType(MDamageTypes.EMP), attacker, itemStack), 8f)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -166,15 +160,14 @@ class EnergySwordItem : Item(Properties().stacksTo(1).rarity(Rarity.RARE)), Vani
|
|||||||
if (blockState.getDestroySpeed(p_41417_, p_41419_) != 0f && (user !is Player || !user.isCreative)) {
|
if (blockState.getDestroySpeed(p_41417_, p_41419_) != 0f && (user !is Player || !user.isCreative)) {
|
||||||
val energy = itemStack.matteryEnergy
|
val energy = itemStack.matteryEnergy
|
||||||
|
|
||||||
when (blockState.material) {
|
if (blockState.`is`(BlockTags.SWORD_EFFICIENT)) {
|
||||||
Material.PLANT, Material.REPLACEABLE_PLANT, Material.VEGETABLE, Material.LEAVES ->
|
|
||||||
if (energy?.extractEnergyExact(PLANT_POWER_COST, false) == true)
|
if (energy?.extractEnergyExact(PLANT_POWER_COST, false) == true)
|
||||||
energy.extractEnergyExact(user.level.random.nextVariance(PLANT_POWER_COST_VARIANCE), false)
|
energy.extractEnergyExact(user.level().random.nextVariance(PLANT_POWER_COST_VARIANCE), false)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (blockState.`is`(Blocks.COBWEB)) {
|
if (blockState.`is`(Blocks.COBWEB)) {
|
||||||
if (energy?.extractEnergyExact(COBWEB_POWER_COST, false) == true)
|
if (energy?.extractEnergyExact(COBWEB_POWER_COST, false) == true)
|
||||||
energy.extractEnergyExact(user.level.random.nextVariance(COBWEB_POWER_COST_VARIANCE), false)
|
energy.extractEnergyExact(user.level().random.nextVariance(COBWEB_POWER_COST_VARIANCE), false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,8 +25,8 @@ class PlasmaRifleItem : PlasmaWeaponItem<PlasmaWeaponDataTable>(PlasmaWeaponData
|
|||||||
get() = Angle(-0.02, 0.0, 0.0)
|
get() = Angle(-0.02, 0.0, 0.0)
|
||||||
|
|
||||||
override fun primaryFire(itemStack: ItemStack, player: Player, dt: PlasmaWeaponDataTable): Boolean {
|
override fun primaryFire(itemStack: ItemStack, player: Player, dt: PlasmaWeaponDataTable): Boolean {
|
||||||
if (!player.level.isClientSide) {
|
if (!player.level().isClientSide) {
|
||||||
val arrow = PlasmaProjectile(player.level)
|
val arrow = PlasmaProjectile(player.level())
|
||||||
arrow.position = player.eyePosition
|
arrow.position = player.eyePosition
|
||||||
|
|
||||||
val calc = VelocityCalculation(player, force = 4.0, deviation = 0.3)
|
val calc = VelocityCalculation(player, force = 4.0, deviation = 0.3)
|
||||||
@ -34,14 +34,14 @@ class PlasmaRifleItem : PlasmaWeaponItem<PlasmaWeaponDataTable>(PlasmaWeaponData
|
|||||||
|
|
||||||
arrow.owner = player
|
arrow.owner = player
|
||||||
|
|
||||||
player.level.addFreshEntity(arrow)
|
player.level().addFreshEntity(arrow)
|
||||||
} else {
|
} else {
|
||||||
dt.doFireAnim(deviation = rotFireAnimDeviation)
|
dt.doFireAnim(deviation = rotFireAnimDeviation)
|
||||||
}
|
}
|
||||||
|
|
||||||
receiveHeat(itemStack, player, 10.0, dt)
|
receiveHeat(itemStack, player, 10.0, dt)
|
||||||
|
|
||||||
player.level.playSound(
|
player.level().playSound(
|
||||||
player,
|
player,
|
||||||
player,
|
player,
|
||||||
MSoundEvents.RIFLE_SHOT,
|
MSoundEvents.RIFLE_SHOT,
|
||||||
|
@ -280,7 +280,7 @@ abstract class PlasmaWeaponItem<D : PlasmaWeaponDataTable>(tables: KClass<D>, pr
|
|||||||
dt.heatCooldown = overheatCooldown
|
dt.heatCooldown = overheatCooldown
|
||||||
|
|
||||||
if (!before) {
|
if (!before) {
|
||||||
player.level.playSound(player, player, MSoundEvents.PLASMA_WEAPON_OVERHEAT, SoundSource.PLAYERS, 1f, 1f)
|
player.level().playSound(player, player, MSoundEvents.PLASMA_WEAPON_OVERHEAT, SoundSource.PLAYERS, 1f, 1f)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -90,7 +90,7 @@ class VelocityCalculation(
|
|||||||
if (owner != null) {
|
if (owner != null) {
|
||||||
val ownerVel = owner.deltaMovement
|
val ownerVel = owner.deltaMovement
|
||||||
|
|
||||||
if (owner.isOnGround) {
|
if (owner.onGround()) {
|
||||||
velocity += ownerVel
|
velocity += ownerVel
|
||||||
} else {
|
} else {
|
||||||
velocity += Vec3(ownerVel.x, 0.0, ownerVel.z)
|
velocity += Vec3(ownerVel.x, 0.0, ownerVel.z)
|
||||||
|
@ -40,6 +40,7 @@ import net.minecraft.world.Container
|
|||||||
import net.minecraft.world.entity.player.Player
|
import net.minecraft.world.entity.player.Player
|
||||||
import net.minecraft.world.inventory.AbstractContainerMenu
|
import net.minecraft.world.inventory.AbstractContainerMenu
|
||||||
import net.minecraft.world.inventory.CraftingContainer
|
import net.minecraft.world.inventory.CraftingContainer
|
||||||
|
import net.minecraft.world.inventory.TransientCraftingContainer
|
||||||
import net.minecraft.world.item.Item
|
import net.minecraft.world.item.Item
|
||||||
import net.minecraft.world.item.ItemStack
|
import net.minecraft.world.item.ItemStack
|
||||||
import net.minecraft.world.item.crafting.Recipe
|
import net.minecraft.world.item.crafting.Recipe
|
||||||
@ -556,7 +557,7 @@ object MatterManager {
|
|||||||
height = 1
|
height = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
val container = CraftingContainer(object : AbstractContainerMenu(null, 0) {
|
val container = TransientCraftingContainer(object : AbstractContainerMenu(null, 0) {
|
||||||
override fun quickMoveStack(pPlayer: Player, pIndex: Int): ItemStack {
|
override fun quickMoveStack(pPlayer: Player, pIndex: Int): ItemStack {
|
||||||
return ItemStack.EMPTY
|
return ItemStack.EMPTY
|
||||||
}
|
}
|
||||||
@ -1555,7 +1556,7 @@ object MatterManager {
|
|||||||
val targetFile = File(MINECRAFT_SERVER.serverDirectory, "otm/registry_dumps/${filter.name.lowercase()}_${System.currentTimeMillis() / 1_000L}.csv")
|
val targetFile = File(MINECRAFT_SERVER.serverDirectory, "otm/registry_dumps/${filter.name.lowercase()}_${System.currentTimeMillis() / 1_000L}.csv")
|
||||||
File(MINECRAFT_SERVER.serverDirectory, "otm/registry_dumps").mkdirs()
|
File(MINECRAFT_SERVER.serverDirectory, "otm/registry_dumps").mkdirs()
|
||||||
|
|
||||||
stack.source.sendSuccess(TranslatableComponent("otm.dumping_matter_registry", targetFile.absolutePath), false)
|
stack.source.sendSuccess({ TranslatableComponent("otm.dumping_matter_registry", targetFile.absolutePath) }, false)
|
||||||
|
|
||||||
val writer = targetFile.bufferedWriter(Charsets.UTF_8)
|
val writer = targetFile.bufferedWriter(Charsets.UTF_8)
|
||||||
|
|
||||||
@ -1601,7 +1602,7 @@ object MatterManager {
|
|||||||
|
|
||||||
writer.close()
|
writer.close()
|
||||||
|
|
||||||
stack.source.sendSuccess(TranslatableComponent("otm.dumped_matter_registry", targetFile.absolutePath), true)
|
stack.source.sendSuccess({ TranslatableComponent("otm.dumped_matter_registry", targetFile.absolutePath) }, true)
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
@ -23,9 +23,9 @@ class ExoPackInventoryMenu(val capability: MatteryPlayerCapability) : MatteryMen
|
|||||||
|
|
||||||
init {
|
init {
|
||||||
if (capability.isExoPackCraftingUpgraded) {
|
if (capability.isExoPackCraftingUpgraded) {
|
||||||
craftingGrid = CraftingContainer(this, 3, 3)
|
craftingGrid = TransientCraftingContainer(this, 3, 3)
|
||||||
} else {
|
} else {
|
||||||
craftingGrid = CraftingContainer(this, 2, 2)
|
craftingGrid = TransientCraftingContainer(this, 2, 2)
|
||||||
}
|
}
|
||||||
|
|
||||||
val builder = ImmutableList.builder<MatterySlot>()
|
val builder = ImmutableList.builder<MatterySlot>()
|
||||||
@ -111,7 +111,7 @@ class ExoPackInventoryMenu(val capability: MatteryPlayerCapability) : MatteryMen
|
|||||||
super.slotsChanged(container)
|
super.slotsChanged(container)
|
||||||
|
|
||||||
if (container == craftingGrid) {
|
if (container == craftingGrid) {
|
||||||
CraftingMenu.slotChangedCraftingGrid(this, capability.ply.level, capability.ply, craftingGrid, craftingResultContainer)
|
CraftingMenu.slotChangedCraftingGrid(this, capability.ply.level(), capability.ply, craftingGrid, craftingResultContainer)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -135,7 +135,7 @@ class ExoPackInventoryMenu(val capability: MatteryPlayerCapability) : MatteryMen
|
|||||||
|
|
||||||
craftingResultContainer.clearContent()
|
craftingResultContainer.clearContent()
|
||||||
|
|
||||||
if (!player.level.isClientSide) {
|
if (!player.level().isClientSide) {
|
||||||
val iterator = craftingGrid.iterator()
|
val iterator = craftingGrid.iterator()
|
||||||
|
|
||||||
for (itemStack in iterator) {
|
for (itemStack in iterator) {
|
||||||
|
@ -373,7 +373,7 @@ abstract class MatteryMenu @JvmOverloads protected constructor(
|
|||||||
override fun stillValid(player: Player): Boolean {
|
override fun stillValid(player: Player): Boolean {
|
||||||
if (tile == null) return true
|
if (tile == null) return true
|
||||||
|
|
||||||
if (player.level.getBlockEntity(tile.blockPos) !== tile) {
|
if (player.level().getBlockEntity(tile.blockPos) !== tile) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -349,7 +349,7 @@ class MatterPanelMenu @JvmOverloads constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun fullPatternBroadcast() {
|
fun fullPatternBroadcast() {
|
||||||
if (inventory.player.level.isClientSide) {
|
if (inventory.player.level().isClientSide) {
|
||||||
initialSend = true
|
initialSend = true
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,7 @@ class BlockEntitySyncPacket(val position: BlockPos, val buffer: ByteArray, val v
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun execute() {
|
private fun execute() {
|
||||||
val level = minecraft.player?.level
|
val level = minecraft.player?.level()
|
||||||
|
|
||||||
if (level == null) {
|
if (level == null) {
|
||||||
LOGGER.error("Received BlockEntitySyncPacket before we are in valid level.")
|
LOGGER.error("Received BlockEntitySyncPacket before we are in valid level.")
|
||||||
|
@ -6,26 +6,19 @@ import net.minecraft.network.chat.Component
|
|||||||
import net.minecraft.sounds.SoundEvents
|
import net.minecraft.sounds.SoundEvents
|
||||||
import net.minecraft.util.valueproviders.UniformInt
|
import net.minecraft.util.valueproviders.UniformInt
|
||||||
import net.minecraft.world.entity.Entity
|
import net.minecraft.world.entity.Entity
|
||||||
|
import net.minecraft.world.entity.EntityType
|
||||||
import net.minecraft.world.entity.monster.Zombie
|
import net.minecraft.world.entity.monster.Zombie
|
||||||
import net.minecraft.world.item.DyeColor
|
import net.minecraft.world.item.DyeColor
|
||||||
import net.minecraft.world.item.ItemStack
|
import net.minecraft.world.item.ItemStack
|
||||||
import net.minecraft.world.item.TooltipFlag
|
import net.minecraft.world.item.TooltipFlag
|
||||||
import net.minecraft.world.level.BlockGetter
|
import net.minecraft.world.level.BlockGetter
|
||||||
import net.minecraft.world.level.block.AnvilBlock
|
import net.minecraft.world.level.block.*
|
||||||
import net.minecraft.world.level.block.Block
|
|
||||||
import net.minecraft.world.level.block.DoorBlock
|
|
||||||
import net.minecraft.world.level.block.DropExperienceBlock
|
|
||||||
import net.minecraft.world.level.block.IronBarsBlock
|
|
||||||
import net.minecraft.world.level.block.SlabBlock
|
|
||||||
import net.minecraft.world.level.block.SoundType
|
|
||||||
import net.minecraft.world.level.block.StairBlock
|
|
||||||
import net.minecraft.world.level.block.TrapDoorBlock
|
|
||||||
import net.minecraft.world.level.block.WallBlock
|
|
||||||
import net.minecraft.world.level.block.state.BlockBehaviour
|
import net.minecraft.world.level.block.state.BlockBehaviour
|
||||||
import net.minecraft.world.level.block.state.BlockState
|
import net.minecraft.world.level.block.state.BlockState
|
||||||
import net.minecraft.world.level.block.state.properties.BlockSetType
|
import net.minecraft.world.level.block.state.properties.BlockSetType
|
||||||
import net.minecraft.world.level.material.Material
|
import net.minecraft.world.level.block.state.properties.NoteBlockInstrument
|
||||||
import net.minecraft.world.level.material.MaterialColor
|
import net.minecraft.world.level.material.MapColor
|
||||||
|
import net.minecraft.world.level.material.PushReaction
|
||||||
import net.minecraftforge.eventbus.api.IEventBus
|
import net.minecraftforge.eventbus.api.IEventBus
|
||||||
import net.minecraftforge.registries.DeferredRegister
|
import net.minecraftforge.registries.DeferredRegister
|
||||||
import net.minecraftforge.registries.ForgeRegistries
|
import net.minecraftforge.registries.ForgeRegistries
|
||||||
@ -117,18 +110,19 @@ object MBlocks {
|
|||||||
val FLUID_TANK: FluidTankBlock by registry.register(MNames.FLUID_TANK) { FluidTankBlock() }
|
val FLUID_TANK: FluidTankBlock by registry.register(MNames.FLUID_TANK) { FluidTankBlock() }
|
||||||
|
|
||||||
val TRITANIUM_ORE: Block by registry.register(MNames.TRITANIUM_ORE) { DropExperienceBlock(
|
val TRITANIUM_ORE: Block by registry.register(MNames.TRITANIUM_ORE) { DropExperienceBlock(
|
||||||
BlockBehaviour.Properties.of(Material.STONE)
|
BlockBehaviour.Properties.of()
|
||||||
|
.mapColor(MapColor.STONE)
|
||||||
.strength(3.25f, 6.0f)
|
.strength(3.25f, 6.0f)
|
||||||
.requiresCorrectToolForDrops(),
|
.requiresCorrectToolForDrops(),
|
||||||
UniformInt.of(0, 3)
|
UniformInt.of(0, 3)
|
||||||
) }
|
) }
|
||||||
|
|
||||||
val TRITANIUM_INGOT_BLOCK: Block by registry.register(MNames.TRITANIUM_INGOT_BLOCK) {
|
val TRITANIUM_INGOT_BLOCK: Block by registry.register(MNames.TRITANIUM_INGOT_BLOCK) {
|
||||||
Block(BlockBehaviour.Properties.of(Material.METAL, MaterialColor.COLOR_BLUE).explosionResistance(400f).destroyTime(3f).requiresCorrectToolForDrops())
|
Block(BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_BLUE).sound(SoundType.METAL).explosionResistance(400f).destroyTime(3f).requiresCorrectToolForDrops())
|
||||||
}
|
}
|
||||||
|
|
||||||
val METAL_JUNK: Block by registry.register(MNames.METAL_JUNK) {
|
val METAL_JUNK: Block by registry.register(MNames.METAL_JUNK) {
|
||||||
object : Block(BlockBehaviour.Properties.of(Material.HEAVY_METAL, MaterialColor.COLOR_GRAY).sound(SoundType.NETHERITE_BLOCK).explosionResistance(45f).destroyTime(3f).requiresCorrectToolForDrops()) {
|
object : Block(BlockBehaviour.Properties.of().sound(SoundType.NETHERITE_BLOCK).mapColor(MapColor.COLOR_GRAY).explosionResistance(45f).destroyTime(3f).requiresCorrectToolForDrops()) {
|
||||||
override fun appendHoverText(
|
override fun appendHoverText(
|
||||||
p_49816_: ItemStack,
|
p_49816_: ItemStack,
|
||||||
p_49817_: BlockGetter?,
|
p_49817_: BlockGetter?,
|
||||||
@ -142,32 +136,35 @@ object MBlocks {
|
|||||||
}
|
}
|
||||||
|
|
||||||
val METAL_MESH: Block by registry.register(MNames.METAL_MESH) {
|
val METAL_MESH: Block by registry.register(MNames.METAL_MESH) {
|
||||||
Block(BlockBehaviour.Properties.of(Material.GLASS, MaterialColor.COLOR_GRAY)
|
Block(BlockBehaviour.Properties.of()
|
||||||
|
.mapColor(MapColor.COLOR_GRAY)
|
||||||
.noOcclusion()
|
.noOcclusion()
|
||||||
.sound(SoundType.COPPER).explosionResistance(30f)
|
.sound(SoundType.COPPER).explosionResistance(30f)
|
||||||
.destroyTime(2f).requiresCorrectToolForDrops())
|
.destroyTime(2f).requiresCorrectToolForDrops())
|
||||||
}
|
}
|
||||||
|
|
||||||
val TRITANIUM_BARS: IronBarsBlock by registry.register(MNames.TRITANIUM_BARS) {
|
val TRITANIUM_BARS: IronBarsBlock by registry.register(MNames.TRITANIUM_BARS) {
|
||||||
IronBarsBlock(BlockBehaviour.Properties.of(Material.METAL, MaterialColor.COLOR_BLUE).explosionResistance(45f).destroyTime(2.5f).requiresCorrectToolForDrops())
|
IronBarsBlock(BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_LIGHT_BLUE).sound(SoundType.METAL).explosionResistance(45f).destroyTime(2.5f).requiresCorrectToolForDrops())
|
||||||
}
|
}
|
||||||
|
|
||||||
val DEEPSLATE_TRITANIUM_ORE: Block by registry.register(MNames.DEEPSLATE_TRITANIUM_ORE) { DropExperienceBlock(
|
val DEEPSLATE_TRITANIUM_ORE: Block by registry.register(MNames.DEEPSLATE_TRITANIUM_ORE) { DropExperienceBlock(
|
||||||
BlockBehaviour.Properties.of(Material.STONE)
|
BlockBehaviour.Properties.of()
|
||||||
|
.mapColor(MapColor.DEEPSLATE)
|
||||||
|
.sound(SoundType.DEEPSLATE)
|
||||||
.strength(4.75f, 6.5f)
|
.strength(4.75f, 6.5f)
|
||||||
.requiresCorrectToolForDrops().sound(SoundType.DEEPSLATE),
|
.requiresCorrectToolForDrops().sound(SoundType.DEEPSLATE),
|
||||||
UniformInt.of(0, 3)
|
UniformInt.of(0, 3)
|
||||||
) }
|
) }
|
||||||
|
|
||||||
val TRITANIUM_RAW_BLOCK: Block by registry.register(MNames.TRITANIUM_RAW_BLOCK) { Block(
|
val TRITANIUM_RAW_BLOCK: Block by registry.register(MNames.TRITANIUM_RAW_BLOCK) { Block(
|
||||||
BlockBehaviour.Properties.of(Material.STONE).strength(8.0f, 10f).requiresCorrectToolForDrops()
|
BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_LIGHT_BLUE).instrument(NoteBlockInstrument.BASEDRUM).strength(8.0f, 10f).requiresCorrectToolForDrops()
|
||||||
) }
|
) }
|
||||||
|
|
||||||
val LABORATORY_LAMP: Block by registry.register(MNames.LABORATORY_LAMP) { LaboratoryLamp(false) }
|
val LABORATORY_LAMP: Block by registry.register(MNames.LABORATORY_LAMP) { LaboratoryLamp(false) }
|
||||||
val LABORATORY_LAMP_INVERTED: Block by registry.register(MNames.LABORATORY_LAMP_INVERTED) { LaboratoryLamp(true) }
|
val LABORATORY_LAMP_INVERTED: Block by registry.register(MNames.LABORATORY_LAMP_INVERTED) { LaboratoryLamp(true) }
|
||||||
val LABORATORY_LAMP_LIGHT: Block by registry.register(MNames.LABORATORY_LAMP_LIGHT) { LaboratoryLampLight() }
|
val LABORATORY_LAMP_LIGHT: Block by registry.register(MNames.LABORATORY_LAMP_LIGHT) { LaboratoryLampLight() }
|
||||||
val DANGER_STRIPE_BLOCK: Block by registry.register(MNames.DANGER_STRIPE_BLOCK) { Block(BlockBehaviour.Properties.of(Material.METAL, DyeColor.GRAY).explosionResistance(6f).destroyTime(1.5f).requiresCorrectToolForDrops()) }
|
val DANGER_STRIPE_BLOCK: Block by registry.register(MNames.DANGER_STRIPE_BLOCK) { Block(BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_GRAY).explosionResistance(6f).destroyTime(1.5f).requiresCorrectToolForDrops()) }
|
||||||
val METAL_BEAM: Block by registry.register(MNames.METAL_BEAM) { Block(BlockBehaviour.Properties.of(Material.METAL, DyeColor.GRAY).explosionResistance(14f).destroyTime(2.5f).requiresCorrectToolForDrops()) }
|
val METAL_BEAM: Block by registry.register(MNames.METAL_BEAM) { Block(BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_GRAY).sound(SoundType.METAL).explosionResistance(14f).destroyTime(2.5f).requiresCorrectToolForDrops()) }
|
||||||
val ENGINE: Block by registry.register(MNames.ENGINE) { EngineBlock() }
|
val ENGINE: Block by registry.register(MNames.ENGINE) { EngineBlock() }
|
||||||
val HOLO_SIGN: Block by registry.register(MNames.HOLO_SIGN) { HoloSignBlock() }
|
val HOLO_SIGN: Block by registry.register(MNames.HOLO_SIGN) { HoloSignBlock() }
|
||||||
|
|
||||||
@ -179,9 +176,12 @@ object MBlocks {
|
|||||||
val anvils = ArrayList<() -> Block>()
|
val anvils = ArrayList<() -> Block>()
|
||||||
|
|
||||||
for (i in 0 until TRITANIUM_ANVIL_VARIANTS) {
|
for (i in 0 until TRITANIUM_ANVIL_VARIANTS) {
|
||||||
val props = BlockBehaviour.Properties.of(Material.METAL, DyeColor.LIGHT_BLUE)
|
val props = BlockBehaviour.Properties.of()
|
||||||
|
.mapColor(MapColor.COLOR_LIGHT_BLUE)
|
||||||
|
.sound(SoundType.ANVIL)
|
||||||
.destroyTime(2.5f - i * 0.15f)
|
.destroyTime(2.5f - i * 0.15f)
|
||||||
.explosionResistance(1200f - i * 80f)
|
.explosionResistance(1200f - i * 80f)
|
||||||
|
.pushReaction(PushReaction.BLOCK)
|
||||||
.requiresCorrectToolForDrops()
|
.requiresCorrectToolForDrops()
|
||||||
|
|
||||||
anvils.add(registry.register(MNames.TRITANIUM_ANVIL + i) { AnvilBlock(props) }::get)
|
anvils.add(registry.register(MNames.TRITANIUM_ANVIL + i) { AnvilBlock(props) }::get)
|
||||||
@ -191,7 +191,16 @@ object MBlocks {
|
|||||||
}
|
}
|
||||||
|
|
||||||
val TRITANIUM_DOOR = registry.allColored(MNames.TRITANIUM_DOOR) { color, _ ->
|
val TRITANIUM_DOOR = registry.allColored(MNames.TRITANIUM_DOOR) { color, _ ->
|
||||||
object : DoorBlock(Properties.of(Material.METAL, color ?: DyeColor.LIGHT_BLUE).explosionResistance(80f).noOcclusion().destroyTime(3f).requiresCorrectToolForDrops(), BlockSetType.IRON) {
|
object : DoorBlock(
|
||||||
|
Properties.of()
|
||||||
|
.mapColor(color ?: DyeColor.LIGHT_BLUE)
|
||||||
|
.explosionResistance(80f)
|
||||||
|
.noOcclusion()
|
||||||
|
.destroyTime(3f)
|
||||||
|
.pushReaction(PushReaction.DESTROY)
|
||||||
|
.requiresCorrectToolForDrops(),
|
||||||
|
BlockSetType.IRON
|
||||||
|
) {
|
||||||
override fun appendHoverText(
|
override fun appendHoverText(
|
||||||
p_49816_: ItemStack,
|
p_49816_: ItemStack,
|
||||||
p_49817_: BlockGetter?,
|
p_49817_: BlockGetter?,
|
||||||
@ -219,7 +228,15 @@ object MBlocks {
|
|||||||
}
|
}
|
||||||
|
|
||||||
val TRITANIUM_TRAPDOOR = registry.allColored(MNames.TRITANIUM_TRAPDOOR) { color, _ ->
|
val TRITANIUM_TRAPDOOR = registry.allColored(MNames.TRITANIUM_TRAPDOOR) { color, _ ->
|
||||||
object : TrapDoorBlock(Properties.of(Material.METAL, color ?: DyeColor.LIGHT_BLUE).explosionResistance(80f).noOcclusion().destroyTime(3f).requiresCorrectToolForDrops(), BlockSetType.IRON) {
|
object : TrapDoorBlock(
|
||||||
|
Properties.of()
|
||||||
|
.mapColor(color ?: DyeColor.LIGHT_BLUE)
|
||||||
|
.explosionResistance(80f)
|
||||||
|
.noOcclusion().destroyTime(3f)
|
||||||
|
.requiresCorrectToolForDrops()
|
||||||
|
.isValidSpawn { _: BlockState, _: BlockGetter, _: BlockPos, _: EntityType<*>? -> false },
|
||||||
|
BlockSetType.IRON
|
||||||
|
) {
|
||||||
override fun appendHoverText(
|
override fun appendHoverText(
|
||||||
p_49816_: ItemStack,
|
p_49816_: ItemStack,
|
||||||
p_49817_: BlockGetter?,
|
p_49817_: BlockGetter?,
|
||||||
@ -256,7 +273,8 @@ object MBlocks {
|
|||||||
}
|
}
|
||||||
|
|
||||||
val TRITANIUM_STRIPED_BLOCK: Block by registry.register(MNames.TRITANIUM_STRIPED_BLOCK) { Block(
|
val TRITANIUM_STRIPED_BLOCK: Block by registry.register(MNames.TRITANIUM_STRIPED_BLOCK) { Block(
|
||||||
BlockBehaviour.Properties.of(Material.METAL, MaterialColor.COLOR_LIGHT_BLUE)
|
BlockBehaviour.Properties.of()
|
||||||
|
.mapColor(MapColor.COLOR_LIGHT_BLUE)
|
||||||
.sound(SoundType.BASALT)
|
.sound(SoundType.BASALT)
|
||||||
.requiresCorrectToolForDrops()
|
.requiresCorrectToolForDrops()
|
||||||
.explosionResistance(80f)
|
.explosionResistance(80f)
|
||||||
@ -277,7 +295,8 @@ object MBlocks {
|
|||||||
}
|
}
|
||||||
|
|
||||||
val CARBON_FIBRE_BLOCK: Block by registry.register(MNames.CARBON_FIBRE_BLOCK) { Block(
|
val CARBON_FIBRE_BLOCK: Block by registry.register(MNames.CARBON_FIBRE_BLOCK) { Block(
|
||||||
BlockBehaviour.Properties.of(Material.METAL, MaterialColor.COLOR_LIGHT_BLUE)
|
BlockBehaviour.Properties.of()
|
||||||
|
.mapColor(MapColor.COLOR_GRAY)
|
||||||
.sound(SoundType.BASALT)
|
.sound(SoundType.BASALT)
|
||||||
.requiresCorrectToolForDrops()
|
.requiresCorrectToolForDrops()
|
||||||
.explosionResistance(40f)
|
.explosionResistance(40f)
|
||||||
|
@ -1,15 +1,16 @@
|
|||||||
package ru.dbotthepony.mc.otm.registry
|
package ru.dbotthepony.mc.otm.registry
|
||||||
|
|
||||||
import net.minecraft.resources.ResourceLocation
|
import net.minecraft.core.registries.Registries
|
||||||
import net.minecraft.world.item.CreativeModeTab
|
import net.minecraft.world.item.CreativeModeTab
|
||||||
import net.minecraft.world.item.DyeColor
|
import net.minecraft.world.item.DyeColor
|
||||||
import net.minecraft.world.item.Item
|
import net.minecraft.world.item.Item
|
||||||
import net.minecraft.world.item.ItemStack
|
import net.minecraft.world.item.ItemStack
|
||||||
import net.minecraft.world.level.material.Fluids
|
import net.minecraft.world.level.material.Fluids
|
||||||
import net.minecraftforge.common.capabilities.ForgeCapabilities
|
import net.minecraftforge.common.capabilities.ForgeCapabilities
|
||||||
import net.minecraftforge.event.CreativeModeTabEvent
|
import net.minecraftforge.event.BuildCreativeModeTabContentsEvent
|
||||||
import net.minecraftforge.fluids.FluidStack
|
import net.minecraftforge.fluids.FluidStack
|
||||||
import net.minecraftforge.fluids.capability.IFluidHandler
|
import net.minecraftforge.fluids.capability.IFluidHandler
|
||||||
|
import net.minecraftforge.registries.DeferredRegister
|
||||||
import net.minecraftforge.registries.ForgeRegistries
|
import net.minecraftforge.registries.ForgeRegistries
|
||||||
import ru.dbotthepony.mc.otm.OverdriveThatMatters
|
import ru.dbotthepony.mc.otm.OverdriveThatMatters
|
||||||
import ru.dbotthepony.mc.otm.capability.matter.matter
|
import ru.dbotthepony.mc.otm.capability.matter.matter
|
||||||
@ -18,7 +19,6 @@ import ru.dbotthepony.mc.otm.core.util.CreativeMenuComparator
|
|||||||
import ru.dbotthepony.mc.otm.core.TranslatableComponent
|
import ru.dbotthepony.mc.otm.core.TranslatableComponent
|
||||||
import ru.dbotthepony.mc.otm.core.ifPresentK
|
import ru.dbotthepony.mc.otm.core.ifPresentK
|
||||||
import ru.dbotthepony.mc.otm.core.registryName
|
import ru.dbotthepony.mc.otm.core.registryName
|
||||||
import ru.dbotthepony.mc.otm.core.util.WriteOnce
|
|
||||||
import ru.dbotthepony.mc.otm.registry.MItems.BATTERY_CREATIVE
|
import ru.dbotthepony.mc.otm.registry.MItems.BATTERY_CREATIVE
|
||||||
|
|
||||||
private fun CreativeModeTab.Output.accept(values: Collection<Item>) {
|
private fun CreativeModeTab.Output.accept(values: Collection<Item>) {
|
||||||
@ -254,30 +254,29 @@ private fun addDecorativeTabItems(consumer: CreativeModeTab.Output) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
object MCreativeTabs {
|
object MCreativeTabs {
|
||||||
var MAIN by WriteOnce<CreativeModeTab>()
|
private val registry = DeferredRegister.create(Registries.CREATIVE_MODE_TAB, OverdriveThatMatters.MOD_ID)
|
||||||
private set
|
|
||||||
var DECORATIVE by WriteOnce<CreativeModeTab>()
|
|
||||||
private set
|
|
||||||
|
|
||||||
fun register(event: CreativeModeTabEvent.Register) {
|
val MAIN: CreativeModeTab by registry.register("main") {
|
||||||
|
CreativeModeTab.builder()
|
||||||
|
.title(TranslatableComponent("itemGroup.otm"))
|
||||||
|
.icon { ItemStack(BATTERY_CREATIVE, 1) }
|
||||||
|
.build()
|
||||||
|
}
|
||||||
|
val DECORATIVE: CreativeModeTab by registry.register("decorative") {
|
||||||
|
CreativeModeTab.builder()
|
||||||
|
.title(TranslatableComponent("itemGroup.otm_decorative"))
|
||||||
|
.icon { ItemStack(MRegistry.VENT.item, 1) }
|
||||||
|
.build()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun register(event: BuildCreativeModeTabContentsEvent) {
|
||||||
CreativeMenuComparator.invalidate()
|
CreativeMenuComparator.invalidate()
|
||||||
|
|
||||||
MAIN = event.registerCreativeModeTab(ResourceLocation(OverdriveThatMatters.MOD_ID, "main")) {
|
if (event.tab == MAIN) {
|
||||||
it.icon { ItemStack(BATTERY_CREATIVE, 1) }
|
addMainCreativeTabItems(event)
|
||||||
it.title(TranslatableComponent("itemGroup.otm"))
|
|
||||||
|
|
||||||
it.displayItems { _, consumer ->
|
|
||||||
addMainCreativeTabItems(consumer)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
DECORATIVE = event.registerCreativeModeTab(ResourceLocation(OverdriveThatMatters.MOD_ID, "decorative"), listOf(), listOf(MAIN)) {
|
|
||||||
it.icon { ItemStack(MRegistry.VENT.item, 1) }
|
|
||||||
it.title(TranslatableComponent("itemGroup.otm_decorative"))
|
|
||||||
|
|
||||||
it.displayItems { _, consumer ->
|
|
||||||
addDecorativeTabItems(consumer)
|
|
||||||
}
|
}
|
||||||
|
if (event.tab == DECORATIVE) {
|
||||||
|
addDecorativeTabItems(event)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,8 +9,8 @@ import net.minecraft.world.level.BlockGetter
|
|||||||
import net.minecraft.world.level.block.*
|
import net.minecraft.world.level.block.*
|
||||||
import net.minecraft.world.level.block.state.BlockBehaviour
|
import net.minecraft.world.level.block.state.BlockBehaviour
|
||||||
import net.minecraft.world.level.block.state.BlockState
|
import net.minecraft.world.level.block.state.BlockState
|
||||||
import net.minecraft.world.level.material.Material
|
import net.minecraft.world.level.block.state.properties.NoteBlockInstrument
|
||||||
import net.minecraft.world.level.material.MaterialColor
|
import net.minecraft.world.level.material.MapColor
|
||||||
import net.minecraftforge.eventbus.api.IEventBus
|
import net.minecraftforge.eventbus.api.IEventBus
|
||||||
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent
|
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent
|
||||||
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent
|
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent
|
||||||
@ -61,7 +61,8 @@ object MRegistry {
|
|||||||
val CARGO_CRATES = DecorativeBlock(MNames.CARGO_CRATE, ::CargoCrateBlock)
|
val CARGO_CRATES = DecorativeBlock(MNames.CARGO_CRATE, ::CargoCrateBlock)
|
||||||
|
|
||||||
val DECORATIVE_CRATE = DecorativeBlock.simple(MNames.DECORATIVE_CRATE) {
|
val DECORATIVE_CRATE = DecorativeBlock.simple(MNames.DECORATIVE_CRATE) {
|
||||||
BlockBehaviour.Properties.of(Material.METAL, it?.materialColor ?: MaterialColor.SNOW)
|
BlockBehaviour.Properties.of()
|
||||||
|
.mapColor(it?.mapColor ?: MapColor.SNOW)
|
||||||
.sound(SoundType.METAL)
|
.sound(SoundType.METAL)
|
||||||
.requiresCorrectToolForDrops()
|
.requiresCorrectToolForDrops()
|
||||||
.explosionResistance(10f)
|
.explosionResistance(10f)
|
||||||
@ -69,7 +70,8 @@ object MRegistry {
|
|||||||
}
|
}
|
||||||
|
|
||||||
val TRITANIUM_BLOCK = DecorativeBlock.simple(MNames.TRITANIUM_BLOCK) {
|
val TRITANIUM_BLOCK = DecorativeBlock.simple(MNames.TRITANIUM_BLOCK) {
|
||||||
BlockBehaviour.Properties.of(Material.METAL, it?.materialColor ?: MaterialColor.COLOR_LIGHT_BLUE)
|
BlockBehaviour.Properties.of()
|
||||||
|
.mapColor(it?.mapColor ?: MapColor.COLOR_LIGHT_BLUE)
|
||||||
.sound(SoundType.BASALT)
|
.sound(SoundType.BASALT)
|
||||||
.requiresCorrectToolForDrops()
|
.requiresCorrectToolForDrops()
|
||||||
.explosionResistance(80f)
|
.explosionResistance(80f)
|
||||||
@ -94,7 +96,8 @@ object MRegistry {
|
|||||||
val TRITANIUM_PRESSURE_PLATE = DecorativeBlock(MNames.TRITANIUM_PRESSURE_PLATE, ::TritaniumPressurePlate)
|
val TRITANIUM_PRESSURE_PLATE = DecorativeBlock(MNames.TRITANIUM_PRESSURE_PLATE, ::TritaniumPressurePlate)
|
||||||
|
|
||||||
val VENT = DecorativeBlock.simple(MNames.VENT) {
|
val VENT = DecorativeBlock.simple(MNames.VENT) {
|
||||||
BlockBehaviour.Properties.of(Material.METAL, it?.materialColor ?: MaterialColor.COLOR_LIGHT_BLUE)
|
BlockBehaviour.Properties.of()
|
||||||
|
.mapColor(it?.mapColor ?: MapColor.COLOR_LIGHT_BLUE)
|
||||||
.sound(SoundType.BASALT)
|
.sound(SoundType.BASALT)
|
||||||
.requiresCorrectToolForDrops()
|
.requiresCorrectToolForDrops()
|
||||||
.explosionResistance(20f)
|
.explosionResistance(20f)
|
||||||
@ -102,7 +105,8 @@ object MRegistry {
|
|||||||
}
|
}
|
||||||
|
|
||||||
val VENT_ALTERNATIVE = DecorativeBlock.simple(MNames.VENT_ALTERNATIVE) {
|
val VENT_ALTERNATIVE = DecorativeBlock.simple(MNames.VENT_ALTERNATIVE) {
|
||||||
BlockBehaviour.Properties.of(Material.METAL, it?.materialColor ?: MaterialColor.COLOR_LIGHT_BLUE)
|
BlockBehaviour.Properties.of()
|
||||||
|
.mapColor(it?.mapColor ?: MapColor.COLOR_LIGHT_BLUE)
|
||||||
.sound(SoundType.BASALT)
|
.sound(SoundType.BASALT)
|
||||||
.requiresCorrectToolForDrops()
|
.requiresCorrectToolForDrops()
|
||||||
.explosionResistance(20f)
|
.explosionResistance(20f)
|
||||||
@ -110,7 +114,8 @@ object MRegistry {
|
|||||||
}
|
}
|
||||||
|
|
||||||
val FLOOR_TILES = ColoredDecorativeBlock.simple(MNames.FLOOR_TILES) {
|
val FLOOR_TILES = ColoredDecorativeBlock.simple(MNames.FLOOR_TILES) {
|
||||||
BlockBehaviour.Properties.of(Material.STONE, it.materialColor)
|
BlockBehaviour.Properties.of()
|
||||||
|
.mapColor(it.mapColor)
|
||||||
.sound(SoundType.STONE)
|
.sound(SoundType.STONE)
|
||||||
.requiresCorrectToolForDrops()
|
.requiresCorrectToolForDrops()
|
||||||
.strength(1.5f, 6f)
|
.strength(1.5f, 6f)
|
||||||
@ -128,14 +133,17 @@ object MRegistry {
|
|||||||
}
|
}
|
||||||
|
|
||||||
val UNREFINED_FLOOR_TILES = ColoredDecorativeBlock.simple(MNames.UNREFINED_FLOOR_TILES) {
|
val UNREFINED_FLOOR_TILES = ColoredDecorativeBlock.simple(MNames.UNREFINED_FLOOR_TILES) {
|
||||||
BlockBehaviour.Properties.of(Material.CLAY, it.materialColor)
|
BlockBehaviour.Properties.of()
|
||||||
|
.mapColor(it.mapColor)
|
||||||
.sound(SoundType.GRAVEL)
|
.sound(SoundType.GRAVEL)
|
||||||
.strength(1f, 2f)
|
.strength(1f, 2f)
|
||||||
}
|
}
|
||||||
|
|
||||||
val INDUSTRIAL_GLASS = DecorativeBlock(MNames.INDUSTRIAL_GLASS) { color ->
|
val INDUSTRIAL_GLASS = DecorativeBlock(MNames.INDUSTRIAL_GLASS) { color ->
|
||||||
val properties =
|
val properties =
|
||||||
BlockBehaviour.Properties.of(Material.GLASS, if (color != null) color.materialColor else MaterialColor.NONE)
|
BlockBehaviour.Properties.of()
|
||||||
|
.mapColor(if (color != null) color.mapColor else MapColor.NONE)
|
||||||
|
.instrument(NoteBlockInstrument.HAT)
|
||||||
.destroyTime(1.5f)
|
.destroyTime(1.5f)
|
||||||
.explosionResistance(40f)
|
.explosionResistance(40f)
|
||||||
.requiresCorrectToolForDrops()
|
.requiresCorrectToolForDrops()
|
||||||
@ -155,7 +163,9 @@ object MRegistry {
|
|||||||
|
|
||||||
val INDUSTRIAL_GLASS_PANE = DecorativeBlock(MNames.INDUSTRIAL_GLASS_PANE) { color ->
|
val INDUSTRIAL_GLASS_PANE = DecorativeBlock(MNames.INDUSTRIAL_GLASS_PANE) { color ->
|
||||||
val properties =
|
val properties =
|
||||||
BlockBehaviour.Properties.of(Material.GLASS, if (color != null) color.materialColor else MaterialColor.NONE)
|
BlockBehaviour.Properties.of()
|
||||||
|
.mapColor(if (color != null) color.mapColor else MapColor.NONE)
|
||||||
|
.instrument(NoteBlockInstrument.HAT)
|
||||||
.strength(1.25f, 5.0f)
|
.strength(1.25f, 5.0f)
|
||||||
.requiresCorrectToolForDrops()
|
.requiresCorrectToolForDrops()
|
||||||
.sound(SoundType.GLASS)
|
.sound(SoundType.GLASS)
|
||||||
@ -169,7 +179,8 @@ object MRegistry {
|
|||||||
}
|
}
|
||||||
|
|
||||||
val TRITANIUM_STRIPED_BLOCK = StripedColoredDecorativeBlock(MNames.TRITANIUM_STRIPED_BLOCK, { colorA, _ ->
|
val TRITANIUM_STRIPED_BLOCK = StripedColoredDecorativeBlock(MNames.TRITANIUM_STRIPED_BLOCK, { colorA, _ ->
|
||||||
Block(BlockBehaviour.Properties.of(Material.METAL, colorA.materialColor)
|
Block(BlockBehaviour.Properties.of()
|
||||||
|
.mapColor(colorA.mapColor)
|
||||||
.sound(SoundType.BASALT)
|
.sound(SoundType.BASALT)
|
||||||
.requiresCorrectToolForDrops()
|
.requiresCorrectToolForDrops()
|
||||||
.explosionResistance(80f)
|
.explosionResistance(80f)
|
||||||
|
@ -1,12 +1,7 @@
|
|||||||
package ru.dbotthepony.mc.otm.triggers
|
package ru.dbotthepony.mc.otm.triggers
|
||||||
|
|
||||||
import com.google.gson.JsonObject
|
import com.google.gson.JsonObject
|
||||||
import net.minecraft.advancements.critereon.AbstractCriterionTriggerInstance
|
import net.minecraft.advancements.critereon.*
|
||||||
import net.minecraft.advancements.critereon.DeserializationContext
|
|
||||||
import net.minecraft.advancements.critereon.EntityPredicate.Composite
|
|
||||||
import net.minecraft.advancements.critereon.ItemPredicate
|
|
||||||
import net.minecraft.advancements.critereon.SerializationContext
|
|
||||||
import net.minecraft.advancements.critereon.SimpleCriterionTrigger
|
|
||||||
import net.minecraft.resources.ResourceLocation
|
import net.minecraft.resources.ResourceLocation
|
||||||
import net.minecraft.server.level.ServerPlayer
|
import net.minecraft.server.level.ServerPlayer
|
||||||
import net.minecraft.world.item.ItemStack
|
import net.minecraft.world.item.ItemStack
|
||||||
@ -23,7 +18,7 @@ object AndroidBatteryTrigger : SimpleCriterionTrigger<AndroidBatteryTrigger.Inst
|
|||||||
|
|
||||||
override fun createInstance(
|
override fun createInstance(
|
||||||
p_66248_: JsonObject,
|
p_66248_: JsonObject,
|
||||||
p_66249_: Composite,
|
p_286603_: ContextAwarePredicate,
|
||||||
p_66250_: DeserializationContext
|
p_66250_: DeserializationContext
|
||||||
): Instance {
|
): Instance {
|
||||||
return Instance(
|
return Instance(
|
||||||
@ -35,7 +30,7 @@ object AndroidBatteryTrigger : SimpleCriterionTrigger<AndroidBatteryTrigger.Inst
|
|||||||
trigger(player) { it.predicate.matches(newItem) }
|
trigger(player) { it.predicate.matches(newItem) }
|
||||||
}
|
}
|
||||||
|
|
||||||
class Instance(val predicate: ItemPredicate) : AbstractCriterionTriggerInstance(ID, Composite.ANY) {
|
class Instance(val predicate: ItemPredicate) : AbstractCriterionTriggerInstance(ID, ContextAwarePredicate.ANY) {
|
||||||
override fun serializeToJson(p_16979_: SerializationContext): JsonObject {
|
override fun serializeToJson(p_16979_: SerializationContext): JsonObject {
|
||||||
return super.serializeToJson(p_16979_).also {
|
return super.serializeToJson(p_16979_).also {
|
||||||
it["predicate"] = predicate.serializeToJson()
|
it["predicate"] = predicate.serializeToJson()
|
||||||
|
@ -2,11 +2,7 @@ package ru.dbotthepony.mc.otm.triggers
|
|||||||
|
|
||||||
import com.google.gson.JsonObject
|
import com.google.gson.JsonObject
|
||||||
import com.google.gson.JsonPrimitive
|
import com.google.gson.JsonPrimitive
|
||||||
import net.minecraft.advancements.critereon.AbstractCriterionTriggerInstance
|
import net.minecraft.advancements.critereon.*
|
||||||
import net.minecraft.advancements.critereon.DeserializationContext
|
|
||||||
import net.minecraft.advancements.critereon.EntityPredicate
|
|
||||||
import net.minecraft.advancements.critereon.SerializationContext
|
|
||||||
import net.minecraft.advancements.critereon.SimpleCriterionTrigger
|
|
||||||
import net.minecraft.resources.ResourceLocation
|
import net.minecraft.resources.ResourceLocation
|
||||||
import net.minecraft.server.level.ServerPlayer
|
import net.minecraft.server.level.ServerPlayer
|
||||||
import ru.dbotthepony.mc.otm.OverdriveThatMatters
|
import ru.dbotthepony.mc.otm.OverdriveThatMatters
|
||||||
@ -24,7 +20,7 @@ object AndroidResearchTrigger : SimpleCriterionTrigger<AndroidResearchTrigger.In
|
|||||||
|
|
||||||
override fun createInstance(
|
override fun createInstance(
|
||||||
p_66248_: JsonObject,
|
p_66248_: JsonObject,
|
||||||
p_66249_: EntityPredicate.Composite,
|
p_286603_: ContextAwarePredicate,
|
||||||
p_66250_: DeserializationContext
|
p_66250_: DeserializationContext
|
||||||
): Instance {
|
): Instance {
|
||||||
return Instance(
|
return Instance(
|
||||||
@ -38,7 +34,7 @@ object AndroidResearchTrigger : SimpleCriterionTrigger<AndroidResearchTrigger.In
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class Instance(val research: ResourceLocation?) : AbstractCriterionTriggerInstance(ID, EntityPredicate.Composite.ANY), Predicate<AndroidResearchType> {
|
class Instance(val research: ResourceLocation?) : AbstractCriterionTriggerInstance(ID, ContextAwarePredicate.ANY), Predicate<AndroidResearchType> {
|
||||||
constructor(research: AndroidResearchType) : this(research.id)
|
constructor(research: AndroidResearchType) : this(research.id)
|
||||||
|
|
||||||
override fun test(t: AndroidResearchType): Boolean {
|
override fun test(t: AndroidResearchType): Boolean {
|
||||||
|
@ -1,10 +1,7 @@
|
|||||||
package ru.dbotthepony.mc.otm.triggers
|
package ru.dbotthepony.mc.otm.triggers
|
||||||
|
|
||||||
import com.google.gson.JsonObject
|
import com.google.gson.JsonObject
|
||||||
import net.minecraft.advancements.critereon.AbstractCriterionTriggerInstance
|
import net.minecraft.advancements.critereon.*
|
||||||
import net.minecraft.advancements.critereon.DeserializationContext
|
|
||||||
import net.minecraft.advancements.critereon.EntityPredicate
|
|
||||||
import net.minecraft.advancements.critereon.SimpleCriterionTrigger
|
|
||||||
import net.minecraft.resources.ResourceLocation
|
import net.minecraft.resources.ResourceLocation
|
||||||
import net.minecraft.server.level.ServerPlayer
|
import net.minecraft.server.level.ServerPlayer
|
||||||
import ru.dbotthepony.mc.otm.OverdriveThatMatters
|
import ru.dbotthepony.mc.otm.OverdriveThatMatters
|
||||||
@ -18,7 +15,7 @@ object BecomeAndroidTrigger : SimpleCriterionTrigger<BecomeAndroidTrigger.Instan
|
|||||||
|
|
||||||
override fun createInstance(
|
override fun createInstance(
|
||||||
p_66248_: JsonObject,
|
p_66248_: JsonObject,
|
||||||
p_66249_: EntityPredicate.Composite,
|
p_286603_: ContextAwarePredicate,
|
||||||
p_66250_: DeserializationContext
|
p_66250_: DeserializationContext
|
||||||
): Instance {
|
): Instance {
|
||||||
return Instance
|
return Instance
|
||||||
@ -28,7 +25,7 @@ object BecomeAndroidTrigger : SimpleCriterionTrigger<BecomeAndroidTrigger.Instan
|
|||||||
trigger(player) { true }
|
trigger(player) { true }
|
||||||
}
|
}
|
||||||
|
|
||||||
object Instance : AbstractCriterionTriggerInstance(ID, EntityPredicate.Composite.ANY)
|
object Instance : AbstractCriterionTriggerInstance(ID, ContextAwarePredicate.ANY)
|
||||||
}
|
}
|
||||||
|
|
||||||
object BecomeAndroidSleepTrigger : SimpleCriterionTrigger<BecomeAndroidSleepTrigger.Instance>() {
|
object BecomeAndroidSleepTrigger : SimpleCriterionTrigger<BecomeAndroidSleepTrigger.Instance>() {
|
||||||
@ -40,7 +37,7 @@ object BecomeAndroidSleepTrigger : SimpleCriterionTrigger<BecomeAndroidSleepTrig
|
|||||||
|
|
||||||
override fun createInstance(
|
override fun createInstance(
|
||||||
p_66248_: JsonObject,
|
p_66248_: JsonObject,
|
||||||
p_66249_: EntityPredicate.Composite,
|
p_286603_: ContextAwarePredicate,
|
||||||
p_66250_: DeserializationContext
|
p_66250_: DeserializationContext
|
||||||
): Instance {
|
): Instance {
|
||||||
return Instance
|
return Instance
|
||||||
@ -50,7 +47,7 @@ object BecomeAndroidSleepTrigger : SimpleCriterionTrigger<BecomeAndroidSleepTrig
|
|||||||
trigger(player) { true }
|
trigger(player) { true }
|
||||||
}
|
}
|
||||||
|
|
||||||
object Instance : AbstractCriterionTriggerInstance(ID, EntityPredicate.Composite.ANY)
|
object Instance : AbstractCriterionTriggerInstance(ID, ContextAwarePredicate.ANY)
|
||||||
}
|
}
|
||||||
|
|
||||||
object BecomeAndroidDeathTrigger : SimpleCriterionTrigger<BecomeAndroidDeathTrigger.Instance>() {
|
object BecomeAndroidDeathTrigger : SimpleCriterionTrigger<BecomeAndroidDeathTrigger.Instance>() {
|
||||||
@ -62,7 +59,7 @@ object BecomeAndroidDeathTrigger : SimpleCriterionTrigger<BecomeAndroidDeathTrig
|
|||||||
|
|
||||||
override fun createInstance(
|
override fun createInstance(
|
||||||
p_66248_: JsonObject,
|
p_66248_: JsonObject,
|
||||||
p_66249_: EntityPredicate.Composite,
|
p_286603_: ContextAwarePredicate,
|
||||||
p_66250_: DeserializationContext
|
p_66250_: DeserializationContext
|
||||||
): Instance {
|
): Instance {
|
||||||
return Instance
|
return Instance
|
||||||
@ -72,7 +69,7 @@ object BecomeAndroidDeathTrigger : SimpleCriterionTrigger<BecomeAndroidDeathTrig
|
|||||||
trigger(player) { true }
|
trigger(player) { true }
|
||||||
}
|
}
|
||||||
|
|
||||||
object Instance : AbstractCriterionTriggerInstance(ID, EntityPredicate.Composite.ANY)
|
object Instance : AbstractCriterionTriggerInstance(ID, ContextAwarePredicate.ANY)
|
||||||
}
|
}
|
||||||
|
|
||||||
object BecomeHumaneTrigger : SimpleCriterionTrigger<BecomeHumaneTrigger.Instance>() {
|
object BecomeHumaneTrigger : SimpleCriterionTrigger<BecomeHumaneTrigger.Instance>() {
|
||||||
@ -84,7 +81,7 @@ object BecomeHumaneTrigger : SimpleCriterionTrigger<BecomeHumaneTrigger.Instance
|
|||||||
|
|
||||||
override fun createInstance(
|
override fun createInstance(
|
||||||
p_66248_: JsonObject,
|
p_66248_: JsonObject,
|
||||||
p_66249_: EntityPredicate.Composite,
|
p_286603_: ContextAwarePredicate,
|
||||||
p_66250_: DeserializationContext
|
p_66250_: DeserializationContext
|
||||||
): Instance {
|
): Instance {
|
||||||
return Instance
|
return Instance
|
||||||
@ -94,5 +91,5 @@ object BecomeHumaneTrigger : SimpleCriterionTrigger<BecomeHumaneTrigger.Instance
|
|||||||
trigger(player) { true }
|
trigger(player) { true }
|
||||||
}
|
}
|
||||||
|
|
||||||
object Instance : AbstractCriterionTriggerInstance(ID, EntityPredicate.Composite.ANY)
|
object Instance : AbstractCriterionTriggerInstance(ID, ContextAwarePredicate.ANY)
|
||||||
}
|
}
|
||||||
|
@ -3,11 +3,7 @@ package ru.dbotthepony.mc.otm.triggers
|
|||||||
import com.google.gson.JsonObject
|
import com.google.gson.JsonObject
|
||||||
import com.google.gson.JsonParseException
|
import com.google.gson.JsonParseException
|
||||||
import com.google.gson.JsonPrimitive
|
import com.google.gson.JsonPrimitive
|
||||||
import net.minecraft.advancements.critereon.AbstractCriterionTriggerInstance
|
import net.minecraft.advancements.critereon.*
|
||||||
import net.minecraft.advancements.critereon.DeserializationContext
|
|
||||||
import net.minecraft.advancements.critereon.EntityPredicate
|
|
||||||
import net.minecraft.advancements.critereon.SerializationContext
|
|
||||||
import net.minecraft.advancements.critereon.SimpleCriterionTrigger
|
|
||||||
import net.minecraft.resources.ResourceLocation
|
import net.minecraft.resources.ResourceLocation
|
||||||
import net.minecraft.server.level.ServerPlayer
|
import net.minecraft.server.level.ServerPlayer
|
||||||
import ru.dbotthepony.mc.otm.OverdriveThatMatters
|
import ru.dbotthepony.mc.otm.OverdriveThatMatters
|
||||||
@ -20,7 +16,7 @@ object AndroidTravelUnderwater : SimpleCriterionTrigger<AndroidTravelUnderwater.
|
|||||||
return ID
|
return ID
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun createInstance(pJson: JsonObject, pPlayer: EntityPredicate.Composite, pContext: DeserializationContext): Instance {
|
override fun createInstance(pJson: JsonObject, pPlayer: ContextAwarePredicate, pContext: DeserializationContext): Instance {
|
||||||
return Instance((pJson["distance_to_travel"] as? JsonPrimitive)?.asDouble ?: throw JsonParseException("Invalid 'distance_to_travel' value"))
|
return Instance((pJson["distance_to_travel"] as? JsonPrimitive)?.asDouble ?: throw JsonParseException("Invalid 'distance_to_travel' value"))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -30,7 +26,7 @@ object AndroidTravelUnderwater : SimpleCriterionTrigger<AndroidTravelUnderwater.
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class Instance(val distanceToTravel: Double) : AbstractCriterionTriggerInstance(ID, EntityPredicate.Composite.ANY) {
|
class Instance(val distanceToTravel: Double) : AbstractCriterionTriggerInstance(ID, ContextAwarePredicate.ANY) {
|
||||||
override fun serializeToJson(pConditions: SerializationContext): JsonObject {
|
override fun serializeToJson(pConditions: SerializationContext): JsonObject {
|
||||||
return super.serializeToJson(pConditions).also {
|
return super.serializeToJson(pConditions).also {
|
||||||
it["distance_to_travel"] = JsonPrimitive(distanceToTravel)
|
it["distance_to_travel"] = JsonPrimitive(distanceToTravel)
|
||||||
|
@ -2,8 +2,8 @@ package ru.dbotthepony.mc.otm.triggers
|
|||||||
|
|
||||||
import com.google.gson.JsonObject
|
import com.google.gson.JsonObject
|
||||||
import net.minecraft.advancements.critereon.AbstractCriterionTriggerInstance
|
import net.minecraft.advancements.critereon.AbstractCriterionTriggerInstance
|
||||||
|
import net.minecraft.advancements.critereon.ContextAwarePredicate
|
||||||
import net.minecraft.advancements.critereon.DeserializationContext
|
import net.minecraft.advancements.critereon.DeserializationContext
|
||||||
import net.minecraft.advancements.critereon.EntityPredicate.Composite
|
|
||||||
import net.minecraft.advancements.critereon.SimpleCriterionTrigger
|
import net.minecraft.advancements.critereon.SimpleCriterionTrigger
|
||||||
import net.minecraft.resources.ResourceLocation
|
import net.minecraft.resources.ResourceLocation
|
||||||
import net.minecraft.server.level.ServerPlayer
|
import net.minecraft.server.level.ServerPlayer
|
||||||
@ -18,7 +18,7 @@ object BlackHoleTrigger : SimpleCriterionTrigger<BlackHoleTrigger.Instance>() {
|
|||||||
|
|
||||||
override fun createInstance(
|
override fun createInstance(
|
||||||
p_66248_: JsonObject,
|
p_66248_: JsonObject,
|
||||||
p_66249_: Composite,
|
p_286603_: ContextAwarePredicate,
|
||||||
p_66250_: DeserializationContext
|
p_66250_: DeserializationContext
|
||||||
): Instance {
|
): Instance {
|
||||||
return Instance
|
return Instance
|
||||||
@ -28,5 +28,5 @@ object BlackHoleTrigger : SimpleCriterionTrigger<BlackHoleTrigger.Instance>() {
|
|||||||
trigger(player) { true }
|
trigger(player) { true }
|
||||||
}
|
}
|
||||||
|
|
||||||
object Instance : AbstractCriterionTriggerInstance(ID, Composite.ANY)
|
object Instance : AbstractCriterionTriggerInstance(ID, ContextAwarePredicate.ANY)
|
||||||
}
|
}
|
||||||
|
@ -2,8 +2,8 @@ package ru.dbotthepony.mc.otm.triggers
|
|||||||
|
|
||||||
import com.google.gson.JsonObject
|
import com.google.gson.JsonObject
|
||||||
import net.minecraft.advancements.critereon.AbstractCriterionTriggerInstance
|
import net.minecraft.advancements.critereon.AbstractCriterionTriggerInstance
|
||||||
|
import net.minecraft.advancements.critereon.ContextAwarePredicate
|
||||||
import net.minecraft.advancements.critereon.DeserializationContext
|
import net.minecraft.advancements.critereon.DeserializationContext
|
||||||
import net.minecraft.advancements.critereon.EntityPredicate.Composite
|
|
||||||
import net.minecraft.advancements.critereon.SimpleCriterionTrigger
|
import net.minecraft.advancements.critereon.SimpleCriterionTrigger
|
||||||
import net.minecraft.resources.ResourceLocation
|
import net.minecraft.resources.ResourceLocation
|
||||||
import net.minecraft.server.level.ServerPlayer
|
import net.minecraft.server.level.ServerPlayer
|
||||||
@ -18,7 +18,7 @@ object EnderTeleporterFallDeathTrigger : SimpleCriterionTrigger<EnderTeleporterF
|
|||||||
|
|
||||||
override fun createInstance(
|
override fun createInstance(
|
||||||
p_66248_: JsonObject,
|
p_66248_: JsonObject,
|
||||||
p_66249_: Composite,
|
p_286603_: ContextAwarePredicate,
|
||||||
p_66250_: DeserializationContext
|
p_66250_: DeserializationContext
|
||||||
): Instance {
|
): Instance {
|
||||||
return Instance
|
return Instance
|
||||||
@ -28,5 +28,5 @@ object EnderTeleporterFallDeathTrigger : SimpleCriterionTrigger<EnderTeleporterF
|
|||||||
trigger(player) { true }
|
trigger(player) { true }
|
||||||
}
|
}
|
||||||
|
|
||||||
object Instance : AbstractCriterionTriggerInstance(ID, Composite.ANY)
|
object Instance : AbstractCriterionTriggerInstance(ID, ContextAwarePredicate.ANY)
|
||||||
}
|
}
|
||||||
|
@ -2,8 +2,8 @@ package ru.dbotthepony.mc.otm.triggers
|
|||||||
|
|
||||||
import com.google.gson.JsonObject
|
import com.google.gson.JsonObject
|
||||||
import net.minecraft.advancements.critereon.AbstractCriterionTriggerInstance
|
import net.minecraft.advancements.critereon.AbstractCriterionTriggerInstance
|
||||||
|
import net.minecraft.advancements.critereon.ContextAwarePredicate
|
||||||
import net.minecraft.advancements.critereon.DeserializationContext
|
import net.minecraft.advancements.critereon.DeserializationContext
|
||||||
import net.minecraft.advancements.critereon.EntityPredicate.Composite
|
|
||||||
import net.minecraft.advancements.critereon.SimpleCriterionTrigger
|
import net.minecraft.advancements.critereon.SimpleCriterionTrigger
|
||||||
import net.minecraft.resources.ResourceLocation
|
import net.minecraft.resources.ResourceLocation
|
||||||
import net.minecraft.server.level.ServerPlayer
|
import net.minecraft.server.level.ServerPlayer
|
||||||
@ -18,7 +18,7 @@ object FallDampenersSaveTrigger : SimpleCriterionTrigger<FallDampenersSaveTrigge
|
|||||||
|
|
||||||
override fun createInstance(
|
override fun createInstance(
|
||||||
p_66248_: JsonObject,
|
p_66248_: JsonObject,
|
||||||
p_66249_: Composite,
|
p_286603_: ContextAwarePredicate,
|
||||||
p_66250_: DeserializationContext
|
p_66250_: DeserializationContext
|
||||||
): Instance {
|
): Instance {
|
||||||
return Instance
|
return Instance
|
||||||
@ -28,5 +28,5 @@ object FallDampenersSaveTrigger : SimpleCriterionTrigger<FallDampenersSaveTrigge
|
|||||||
trigger(player) { true }
|
trigger(player) { true }
|
||||||
}
|
}
|
||||||
|
|
||||||
object Instance : AbstractCriterionTriggerInstance(ID, Composite.ANY)
|
object Instance : AbstractCriterionTriggerInstance(ID, ContextAwarePredicate.ANY)
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,8 @@
|
|||||||
package ru.dbotthepony.mc.otm.triggers
|
package ru.dbotthepony.mc.otm.triggers
|
||||||
|
|
||||||
import com.google.gson.JsonObject
|
import com.google.gson.JsonObject
|
||||||
import net.minecraft.advancements.critereon.AbstractCriterionTriggerInstance
|
import net.minecraft.advancements.critereon.*
|
||||||
import net.minecraft.advancements.critereon.DeserializationContext
|
|
||||||
import net.minecraft.advancements.critereon.EntityPredicate.Composite
|
|
||||||
import net.minecraft.advancements.critereon.MinMaxBounds.Doubles
|
import net.minecraft.advancements.critereon.MinMaxBounds.Doubles
|
||||||
import net.minecraft.advancements.critereon.SerializationContext
|
|
||||||
import net.minecraft.advancements.critereon.SimpleCriterionTrigger
|
|
||||||
import net.minecraft.resources.ResourceLocation
|
import net.minecraft.resources.ResourceLocation
|
||||||
import net.minecraft.server.level.ServerPlayer
|
import net.minecraft.server.level.ServerPlayer
|
||||||
import ru.dbotthepony.mc.otm.OverdriveThatMatters
|
import ru.dbotthepony.mc.otm.OverdriveThatMatters
|
||||||
@ -22,7 +18,7 @@ object NanobotsArmorTrigger : SimpleCriterionTrigger<NanobotsArmorTrigger.Instan
|
|||||||
|
|
||||||
override fun createInstance(
|
override fun createInstance(
|
||||||
p_66248_: JsonObject,
|
p_66248_: JsonObject,
|
||||||
p_66249_: Composite,
|
p_286603_: ContextAwarePredicate,
|
||||||
p_66250_: DeserializationContext
|
p_66250_: DeserializationContext
|
||||||
): Instance {
|
): Instance {
|
||||||
return Instance(
|
return Instance(
|
||||||
@ -34,7 +30,7 @@ object NanobotsArmorTrigger : SimpleCriterionTrigger<NanobotsArmorTrigger.Instan
|
|||||||
trigger(player) { it.predicate.matches(damageAbsorbed) }
|
trigger(player) { it.predicate.matches(damageAbsorbed) }
|
||||||
}
|
}
|
||||||
|
|
||||||
class Instance(val predicate: Doubles) : AbstractCriterionTriggerInstance(ID, Composite.ANY) {
|
class Instance(val predicate: Doubles) : AbstractCriterionTriggerInstance(ID, ContextAwarePredicate.ANY) {
|
||||||
override fun serializeToJson(p_16979_: SerializationContext): JsonObject {
|
override fun serializeToJson(p_16979_: SerializationContext): JsonObject {
|
||||||
return super.serializeToJson(p_16979_).also {
|
return super.serializeToJson(p_16979_).also {
|
||||||
it["predicate"] = predicate.serializeToJson()
|
it["predicate"] = predicate.serializeToJson()
|
||||||
|
@ -2,8 +2,8 @@ package ru.dbotthepony.mc.otm.triggers
|
|||||||
|
|
||||||
import com.google.gson.JsonObject
|
import com.google.gson.JsonObject
|
||||||
import net.minecraft.advancements.critereon.AbstractCriterionTriggerInstance
|
import net.minecraft.advancements.critereon.AbstractCriterionTriggerInstance
|
||||||
|
import net.minecraft.advancements.critereon.ContextAwarePredicate
|
||||||
import net.minecraft.advancements.critereon.DeserializationContext
|
import net.minecraft.advancements.critereon.DeserializationContext
|
||||||
import net.minecraft.advancements.critereon.EntityPredicate.Composite
|
|
||||||
import net.minecraft.advancements.critereon.SimpleCriterionTrigger
|
import net.minecraft.advancements.critereon.SimpleCriterionTrigger
|
||||||
import net.minecraft.resources.ResourceLocation
|
import net.minecraft.resources.ResourceLocation
|
||||||
import net.minecraft.server.level.ServerPlayer
|
import net.minecraft.server.level.ServerPlayer
|
||||||
@ -18,7 +18,7 @@ object ShockwaveTrigger : SimpleCriterionTrigger<ShockwaveTrigger.Instance>() {
|
|||||||
|
|
||||||
override fun createInstance(
|
override fun createInstance(
|
||||||
p_66248_: JsonObject,
|
p_66248_: JsonObject,
|
||||||
p_66249_: Composite,
|
p_286603_: ContextAwarePredicate,
|
||||||
p_66250_: DeserializationContext
|
p_66250_: DeserializationContext
|
||||||
): Instance {
|
): Instance {
|
||||||
return Instance
|
return Instance
|
||||||
@ -28,5 +28,5 @@ object ShockwaveTrigger : SimpleCriterionTrigger<ShockwaveTrigger.Instance>() {
|
|||||||
trigger(player) { true }
|
trigger(player) { true }
|
||||||
}
|
}
|
||||||
|
|
||||||
object Instance : AbstractCriterionTriggerInstance(ID, Composite.ANY)
|
object Instance : AbstractCriterionTriggerInstance(ID, ContextAwarePredicate.ANY)
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,7 @@ public net.minecraft.server.level.ServerPlayer f_143380_ # containerListener
|
|||||||
protected net.minecraft.client.gui.screens.inventory.AbstractContainerScreen m_97762_(I)V # checkHotbarMouseClicked
|
protected net.minecraft.client.gui.screens.inventory.AbstractContainerScreen m_97762_(I)V # checkHotbarMouseClicked
|
||||||
protected net.minecraft.client.gui.screens.inventory.AbstractContainerScreen m_97818_()V # recalculateQuickCraftRemaining
|
protected net.minecraft.client.gui.screens.inventory.AbstractContainerScreen m_97818_()V # recalculateQuickCraftRemaining
|
||||||
protected net.minecraft.client.gui.screens.inventory.AbstractContainerScreen m_97744_(DD)Lnet/minecraft/world/inventory/Slot; # findSlot
|
protected net.minecraft.client.gui.screens.inventory.AbstractContainerScreen m_97744_(DD)Lnet/minecraft/world/inventory/Slot; # findSlot
|
||||||
protected net.minecraft.client.gui.screens.inventory.AbstractContainerScreen m_274323_(Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/world/item/ItemStack;IILjava/lang/String;)V # renderFloatingItem
|
protected net.minecraft.client.gui.screens.inventory.AbstractContainerScreen m_280211_(Lnet/minecraft/client/gui/GuiGraphics;Lnet/minecraft/world/item/ItemStack;IILjava/lang/String;)V # renderFloatingItem
|
||||||
|
|
||||||
protected net.minecraft.client.resources.TextureAtlasHolder f_118884_ # textureAtlas
|
protected net.minecraft.client.resources.TextureAtlasHolder f_118884_ # textureAtlas
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user