More backporting
This commit is contained in:
parent
df15bd2f69
commit
2a117a540e
@ -37,7 +37,6 @@ import ru.dbotthepony.mc.otm.client.render.sprites.sprite
|
|||||||
import ru.dbotthepony.mc.otm.config.AndroidConfig
|
import ru.dbotthepony.mc.otm.config.AndroidConfig
|
||||||
import ru.dbotthepony.mc.otm.core.genericPositions
|
import ru.dbotthepony.mc.otm.core.genericPositions
|
||||||
import ru.dbotthepony.mc.otm.core.holder
|
import ru.dbotthepony.mc.otm.core.holder
|
||||||
import ru.dbotthepony.mc.otm.core.isFall
|
|
||||||
import ru.dbotthepony.mc.otm.core.math.RGBAColor
|
import ru.dbotthepony.mc.otm.core.math.RGBAColor
|
||||||
import ru.dbotthepony.mc.otm.core.math.Vector
|
import ru.dbotthepony.mc.otm.core.math.Vector
|
||||||
import ru.dbotthepony.mc.otm.core.math.asVector
|
import ru.dbotthepony.mc.otm.core.math.asVector
|
||||||
|
@ -1,20 +1,12 @@
|
|||||||
package ru.dbotthepony.mc.otm.android.feature
|
package ru.dbotthepony.mc.otm.android.feature
|
||||||
|
|
||||||
import net.minecraft.ChatFormatting
|
|
||||||
import net.minecraft.resources.ResourceLocation
|
|
||||||
import net.minecraft.server.level.ServerPlayer
|
import net.minecraft.server.level.ServerPlayer
|
||||||
import net.minecraftforge.event.entity.living.LivingAttackEvent
|
import net.minecraftforge.event.entity.living.LivingAttackEvent
|
||||||
import net.minecraftforge.event.entity.living.LivingHurtEvent
|
import net.minecraftforge.event.entity.living.LivingHurtEvent
|
||||||
import ru.dbotthepony.mc.otm.OverdriveThatMatters
|
|
||||||
import ru.dbotthepony.mc.otm.android.AndroidFeature
|
import ru.dbotthepony.mc.otm.android.AndroidFeature
|
||||||
import ru.dbotthepony.mc.otm.android.AndroidResearchManager
|
|
||||||
import ru.dbotthepony.mc.otm.capability.MatteryPlayerCapability
|
import ru.dbotthepony.mc.otm.capability.MatteryPlayerCapability
|
||||||
import ru.dbotthepony.mc.otm.config.AndroidConfig
|
import ru.dbotthepony.mc.otm.config.AndroidConfig
|
||||||
import ru.dbotthepony.mc.otm.core.TextComponent
|
|
||||||
import ru.dbotthepony.mc.otm.core.TranslatableComponent
|
|
||||||
import ru.dbotthepony.mc.otm.core.isFall
|
|
||||||
import ru.dbotthepony.mc.otm.registry.AndroidFeatures
|
import ru.dbotthepony.mc.otm.registry.AndroidFeatures
|
||||||
import ru.dbotthepony.mc.otm.registry.MNames
|
|
||||||
import ru.dbotthepony.mc.otm.triggers.FallDampenersSaveTrigger
|
import ru.dbotthepony.mc.otm.triggers.FallDampenersSaveTrigger
|
||||||
|
|
||||||
class FallDampenersFeature(capability: MatteryPlayerCapability) : AndroidFeature(AndroidFeatures.FALL_DAMPENERS, capability) {
|
class FallDampenersFeature(capability: MatteryPlayerCapability) : AndroidFeature(AndroidFeatures.FALL_DAMPENERS, capability) {
|
||||||
|
@ -4,12 +4,9 @@ import net.minecraft.nbt.CompoundTag
|
|||||||
import net.minecraft.resources.ResourceLocation
|
import net.minecraft.resources.ResourceLocation
|
||||||
import net.minecraft.server.level.ServerPlayer
|
import net.minecraft.server.level.ServerPlayer
|
||||||
import net.minecraftforge.event.entity.living.LivingHurtEvent
|
import net.minecraftforge.event.entity.living.LivingHurtEvent
|
||||||
import ru.dbotthepony.mc.otm.OverdriveThatMatters
|
|
||||||
import ru.dbotthepony.mc.otm.android.AndroidFeature
|
import ru.dbotthepony.mc.otm.android.AndroidFeature
|
||||||
import ru.dbotthepony.mc.otm.android.AndroidResearchManager
|
|
||||||
import ru.dbotthepony.mc.otm.capability.MatteryPlayerCapability
|
import ru.dbotthepony.mc.otm.capability.MatteryPlayerCapability
|
||||||
import ru.dbotthepony.mc.otm.capability.energy.extractEnergyExact
|
import ru.dbotthepony.mc.otm.capability.energy.extractEnergyExact
|
||||||
import ru.dbotthepony.mc.otm.core.isBypassArmor
|
|
||||||
import ru.dbotthepony.mc.otm.core.math.Decimal
|
import ru.dbotthepony.mc.otm.core.math.Decimal
|
||||||
import ru.dbotthepony.mc.otm.registry.AndroidFeatures
|
import ru.dbotthepony.mc.otm.registry.AndroidFeatures
|
||||||
import ru.dbotthepony.mc.otm.registry.StatNames
|
import ru.dbotthepony.mc.otm.registry.StatNames
|
||||||
|
@ -14,7 +14,6 @@ import ru.dbotthepony.mc.otm.capability.matteryPlayer
|
|||||||
import ru.dbotthepony.mc.otm.client.render.MGUIGraphics
|
import ru.dbotthepony.mc.otm.client.render.MGUIGraphics
|
||||||
import ru.dbotthepony.mc.otm.client.render.ResearchIcons
|
import ru.dbotthepony.mc.otm.client.render.ResearchIcons
|
||||||
import ru.dbotthepony.mc.otm.config.AndroidConfig
|
import ru.dbotthepony.mc.otm.config.AndroidConfig
|
||||||
import ru.dbotthepony.mc.otm.core.damageType
|
|
||||||
import ru.dbotthepony.mc.otm.core.getEntitiesInEllipsoid
|
import ru.dbotthepony.mc.otm.core.getEntitiesInEllipsoid
|
||||||
import ru.dbotthepony.mc.otm.core.getExplosionResistance
|
import ru.dbotthepony.mc.otm.core.getExplosionResistance
|
||||||
import ru.dbotthepony.mc.otm.core.math.RGBAColor
|
import ru.dbotthepony.mc.otm.core.math.RGBAColor
|
||||||
|
@ -151,7 +151,7 @@ class MatterEntanglerBlockEntity(blockPos: BlockPos, blockState: BlockState) : M
|
|||||||
.values
|
.values
|
||||||
.firstOrNull { it.value.matches(inputs, level!!) } ?: return JobContainer.noItem()
|
.firstOrNull { it.value.matches(inputs, level!!) } ?: return JobContainer.noItem()
|
||||||
|
|
||||||
val result = recipe.value.assemble(inputs, level!!.registryAccess())
|
val result = recipe.value.assemble(inputs)
|
||||||
|
|
||||||
inputs.forEach { it.shrink(1) }
|
inputs.forEach { it.shrink(1) }
|
||||||
inputs.setChanged()
|
inputs.setChanged()
|
||||||
|
@ -292,7 +292,7 @@ class ItemMonitorBlockEntity(blockPos: BlockPos, blockState: BlockState) : Matte
|
|||||||
|
|
||||||
override fun getItem(slot: Int): ItemStack {
|
override fun getItem(slot: Int): ItemStack {
|
||||||
require(slot == 0) { "Invalid slot: $slot" }
|
require(slot == 0) { "Invalid slot: $slot" }
|
||||||
return craftingRecipe?.getResultItem(level?.registryAccess() ?: return ItemStack.EMPTY)?.copy() ?: ItemStack.EMPTY
|
return craftingRecipe?.resultItem?.copy() ?: ItemStack.EMPTY
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun removeItem(index: Int, amount: Int): ItemStack {
|
override fun removeItem(index: Int, amount: Int): ItemStack {
|
||||||
@ -305,7 +305,7 @@ class ItemMonitorBlockEntity(blockPos: BlockPos, blockState: BlockState) : Matte
|
|||||||
try {
|
try {
|
||||||
ForgeHooks.setCraftingPlayer(craftingPlayer)
|
ForgeHooks.setCraftingPlayer(craftingPlayer)
|
||||||
|
|
||||||
if (craftingRecipe.getResultItem(level.registryAccess()).count != amount) {
|
if (craftingRecipe.resultItem.count != amount) {
|
||||||
return ItemStack.EMPTY
|
return ItemStack.EMPTY
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
@ -331,7 +331,7 @@ class ItemMonitorBlockEntity(blockPos: BlockPos, blockState: BlockState) : Matte
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
residue = craftingRecipe.getRemainingItems(craftingGrid)
|
residue = craftingRecipe.getRemainingItems(craftingGrid)
|
||||||
result = craftingRecipe.getResultItem(level.registryAccess())
|
result = craftingRecipe.resultItem
|
||||||
} finally {
|
} finally {
|
||||||
ForgeHooks.setCraftingPlayer(null)
|
ForgeHooks.setCraftingPlayer(null)
|
||||||
}
|
}
|
||||||
@ -398,7 +398,7 @@ class ItemMonitorBlockEntity(blockPos: BlockPos, blockState: BlockState) : Matte
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun setItem(p_18944_: Int, p_18945_: ItemStack) {
|
override fun setItem(p_18944_: Int, p_18945_: ItemStack) {
|
||||||
if ((craftingRecipe != null && !craftingRecipe!!.let { it.getResultItem(level?.registryAccess() ?: return@let ItemStack.EMPTY) }.isEmpty) || !p_18945_.isEmpty) {
|
if ((craftingRecipe != null && !craftingRecipe!!.resultItem.isEmpty) || !p_18945_.isEmpty) {
|
||||||
throw RuntimeException("BUG-DETECT: Tried to set crafting result slot item to something, and either we have crafting recipe which have valid result, or we are trying to set slot to non empty item: $p_18945_")
|
throw RuntimeException("BUG-DETECT: Tried to set crafting result slot item to something, and either we have crafting recipe which have valid result, or we are trying to set slot to non empty item: $p_18945_")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -93,7 +93,7 @@ class PlatePressBlockEntity(
|
|||||||
|
|
||||||
return JobContainer.success(
|
return JobContainer.success(
|
||||||
ItemJob(
|
ItemJob(
|
||||||
recipe.getResultItem(level.registryAccess()).copyWithCount(toProcess),
|
recipe.getResultItem().copyWithCount(toProcess),
|
||||||
recipe.workTime * MachinesConfig.PLATE_PRESS.workTimeMultiplier,
|
recipe.workTime * MachinesConfig.PLATE_PRESS.workTimeMultiplier,
|
||||||
MachinesConfig.PLATE_PRESS.energyConsumption * toProcess,
|
MachinesConfig.PLATE_PRESS.energyConsumption * toProcess,
|
||||||
experience = recipe.experience.sample(level.random) * toProcess))
|
experience = recipe.experience.sample(level.random) * toProcess))
|
||||||
|
@ -136,7 +136,7 @@ class PoweredFurnaceBlockEntity(
|
|||||||
}
|
}
|
||||||
|
|
||||||
return level.recipeManager.getRecipeFor(recipeType as RecipeType<AbstractCookingRecipe>, inputs[id], level).map {
|
return level.recipeManager.getRecipeFor(recipeType as RecipeType<AbstractCookingRecipe>, inputs[id], level).map {
|
||||||
val output = it.value.assemble(inputs[id], level.registryAccess())
|
val output = it.value.assemble(inputs[id])
|
||||||
val toProcess = inputs[id][0].count.coerceAtMost(upgrades.processingItems + 1)
|
val toProcess = inputs[id][0].count.coerceAtMost(upgrades.processingItems + 1)
|
||||||
inputs[id][0].shrink(toProcess)
|
inputs[id][0].shrink(toProcess)
|
||||||
|
|
||||||
|
@ -4,12 +4,12 @@ import net.minecraft.nbt.CompoundTag
|
|||||||
import net.minecraft.server.level.ServerPlayer
|
import net.minecraft.server.level.ServerPlayer
|
||||||
import net.minecraft.world.entity.player.Player
|
import net.minecraft.world.entity.player.Player
|
||||||
import net.minecraft.world.item.ItemStack
|
import net.minecraft.world.item.ItemStack
|
||||||
import net.minecraft.world.ticks.ContainerSingleItem
|
|
||||||
import net.minecraftforge.common.capabilities.ForgeCapabilities
|
import net.minecraftforge.common.capabilities.ForgeCapabilities
|
||||||
import net.minecraftforge.common.util.INBTSerializable
|
import net.minecraftforge.common.util.INBTSerializable
|
||||||
import ru.dbotthepony.mc.otm.capability.FlowDirection
|
import ru.dbotthepony.mc.otm.capability.FlowDirection
|
||||||
import ru.dbotthepony.mc.otm.capability.extractEnergy
|
import ru.dbotthepony.mc.otm.capability.extractEnergy
|
||||||
import ru.dbotthepony.mc.otm.capability.receiveEnergy
|
import ru.dbotthepony.mc.otm.capability.receiveEnergy
|
||||||
|
import ru.dbotthepony.mc.otm.container.IContainer
|
||||||
import ru.dbotthepony.mc.otm.core.math.Decimal
|
import ru.dbotthepony.mc.otm.core.math.Decimal
|
||||||
import ru.dbotthepony.mc.otm.core.math.getDecimal
|
import ru.dbotthepony.mc.otm.core.math.getDecimal
|
||||||
import ru.dbotthepony.mc.otm.core.nbt.getItemStack
|
import ru.dbotthepony.mc.otm.core.nbt.getItemStack
|
||||||
@ -27,7 +27,7 @@ class BatteryBackedEnergyStorage(
|
|||||||
maxCharge: Decimal,
|
maxCharge: Decimal,
|
||||||
val isAndroid: Boolean,
|
val isAndroid: Boolean,
|
||||||
val onChange: Runnable? = null
|
val onChange: Runnable? = null
|
||||||
) : IMatteryEnergyStorage, INBTSerializable<CompoundTag?>, ContainerSingleItem {
|
) : IMatteryEnergyStorage, INBTSerializable<CompoundTag?>, IContainer {
|
||||||
override val energyFlow: FlowDirection
|
override val energyFlow: FlowDirection
|
||||||
get() = FlowDirection.INPUT
|
get() = FlowDirection.INPUT
|
||||||
|
|
||||||
@ -61,6 +61,22 @@ class BatteryBackedEnergyStorage(
|
|||||||
item = stack
|
item = stack
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun clearContent() {
|
||||||
|
item = ItemStack.EMPTY
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getContainerSize(): Int {
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun isEmpty(): Boolean {
|
||||||
|
return item.isEmpty
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun removeItemNoUpdate(slot: Int): ItemStack {
|
||||||
|
TODO("Not yet implemented")
|
||||||
|
}
|
||||||
|
|
||||||
override fun setChanged() {
|
override fun setChanged() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ private fun buffer() = buffer
|
|||||||
|
|
||||||
private fun Font.drawInBatch(
|
private fun Font.drawInBatch(
|
||||||
text: Any, x: Float, y: Float, color: Int, drawShadow: Boolean,
|
text: Any, x: Float, y: Float, color: Int, drawShadow: Boolean,
|
||||||
matrix4f: Matrix4f, buffer: MultiBufferSource, displayMode: Font.DisplayMode,
|
matrix4f: Matrix4f, buffer: MultiBufferSource, displayMode: Boolean,
|
||||||
effectColor: Int, packedLightCoords: Int, gravity: RenderGravity,
|
effectColor: Int, packedLightCoords: Int, gravity: RenderGravity,
|
||||||
rounding: GravityRounding, width: FloatSupplier
|
rounding: GravityRounding, width: FloatSupplier
|
||||||
): Int {
|
): Int {
|
||||||
@ -120,7 +120,7 @@ private fun Font.drawInternal(
|
|||||||
scale: Float,
|
scale: Float,
|
||||||
color: RGBAColor,
|
color: RGBAColor,
|
||||||
drawShadow: Boolean,
|
drawShadow: Boolean,
|
||||||
displayMode: Font.DisplayMode,
|
displayMode: Boolean,
|
||||||
packedLightCoords: Int,
|
packedLightCoords: Int,
|
||||||
effectColor: Int,
|
effectColor: Int,
|
||||||
shadowColor: RGBAColor,
|
shadowColor: RGBAColor,
|
||||||
@ -239,7 +239,7 @@ fun Font.draw(
|
|||||||
scale: Float = 1f,
|
scale: Float = 1f,
|
||||||
color: RGBAColor = RGBAColor.WHITE,
|
color: RGBAColor = RGBAColor.WHITE,
|
||||||
drawShadow: Boolean = false,
|
drawShadow: Boolean = false,
|
||||||
displayMode: Font.DisplayMode = Font.DisplayMode.NORMAL,
|
displayMode: Boolean = false,
|
||||||
packedLightCoords: Int = 15728880,
|
packedLightCoords: Int = 15728880,
|
||||||
effectColor: Int = 0,
|
effectColor: Int = 0,
|
||||||
shadowColor: RGBAColor = RGBAColor.BLACK,
|
shadowColor: RGBAColor = RGBAColor.BLACK,
|
||||||
@ -287,7 +287,7 @@ fun Font.draw(
|
|||||||
scale: Float = 1f,
|
scale: Float = 1f,
|
||||||
color: RGBAColor = RGBAColor.WHITE,
|
color: RGBAColor = RGBAColor.WHITE,
|
||||||
drawShadow: Boolean = false,
|
drawShadow: Boolean = false,
|
||||||
displayMode: Font.DisplayMode = Font.DisplayMode.NORMAL,
|
displayMode: Boolean = false,
|
||||||
packedLightCoords: Int = 15728880,
|
packedLightCoords: Int = 15728880,
|
||||||
effectColor: Int = 0,
|
effectColor: Int = 0,
|
||||||
shadowColor: RGBAColor = RGBAColor.BLACK,
|
shadowColor: RGBAColor = RGBAColor.BLACK,
|
||||||
@ -335,7 +335,7 @@ fun Font.draw(
|
|||||||
scale: Float = 1f,
|
scale: Float = 1f,
|
||||||
color: RGBAColor = RGBAColor.WHITE,
|
color: RGBAColor = RGBAColor.WHITE,
|
||||||
drawShadow: Boolean = false,
|
drawShadow: Boolean = false,
|
||||||
displayMode: Font.DisplayMode = Font.DisplayMode.NORMAL,
|
displayMode: Boolean = false,
|
||||||
packedLightCoords: Int = 15728880,
|
packedLightCoords: Int = 15728880,
|
||||||
effectColor: Int = 0,
|
effectColor: Int = 0,
|
||||||
shadowColor: RGBAColor = RGBAColor.BLACK,
|
shadowColor: RGBAColor = RGBAColor.BLACK,
|
||||||
|
@ -35,7 +35,7 @@ class MGUIGraphics(val pose: PoseStack) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun renderFakeItem(itemStack: ItemStack, x: Int, y: Int) {
|
fun renderFakeItem(itemStack: ItemStack, x: Int, y: Int) {
|
||||||
minecraft.itemRenderer.renderGuiItem(pose, itemStack, x, y)
|
minecraft.itemRenderer.renderGuiItem(itemStack, x, y)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun drawLine(
|
fun drawLine(
|
||||||
@ -130,7 +130,9 @@ class MGUIGraphics(val pose: PoseStack) {
|
|||||||
|
|
||||||
for (i in mapped.indices) {
|
for (i in mapped.indices) {
|
||||||
val line = mapped[i]
|
val line = mapped[i]
|
||||||
line.renderImage(preEvent.font, x, yCurrent, pose, minecraft.itemRenderer)
|
line.renderImage(preEvent.font, x, yCurrent, pose, minecraft.itemRenderer, 0 /* blit offset, i love you, go commit self-murder */)
|
||||||
|
/* because your existence servers ZERO FUCKING PURPOSE */
|
||||||
|
/* Z-BUFFER IN MY GUI PIECE OF SHIT */
|
||||||
yCurrent += line.height + if (i == 0) 2 else 0
|
yCurrent += line.height + if (i == 0) 2 else 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,9 +3,9 @@ package ru.dbotthepony.mc.otm.client.render.blockentity
|
|||||||
import com.mojang.blaze3d.vertex.PoseStack
|
import com.mojang.blaze3d.vertex.PoseStack
|
||||||
import com.mojang.math.Axis
|
import com.mojang.math.Axis
|
||||||
import net.minecraft.client.renderer.MultiBufferSource
|
import net.minecraft.client.renderer.MultiBufferSource
|
||||||
|
import net.minecraft.client.renderer.block.model.ItemTransforms
|
||||||
import net.minecraft.client.renderer.blockentity.BlockEntityRenderer
|
import net.minecraft.client.renderer.blockentity.BlockEntityRenderer
|
||||||
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider
|
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider
|
||||||
import net.minecraft.world.item.ItemDisplayContext
|
|
||||||
import ru.dbotthepony.mc.otm.block.entity.matter.MatterReconstructorBlockEntity
|
import ru.dbotthepony.mc.otm.block.entity.matter.MatterReconstructorBlockEntity
|
||||||
import ru.dbotthepony.mc.otm.client.render.DynamicBufferSource
|
import ru.dbotthepony.mc.otm.client.render.DynamicBufferSource
|
||||||
|
|
||||||
@ -32,7 +32,7 @@ class MatterReconstructorRenderer(private val context: BlockEntityRendererProvid
|
|||||||
pose.mulPose(Axis.XP.rotationDegrees(90f))
|
pose.mulPose(Axis.XP.rotationDegrees(90f))
|
||||||
pose.mulPose(Axis.ZP.rotationDegrees(tile.blockRotation.back.toYRot()))
|
pose.mulPose(Axis.ZP.rotationDegrees(tile.blockRotation.back.toYRot()))
|
||||||
|
|
||||||
context.itemRenderer.renderStatic(item, ItemDisplayContext.FIXED, packedLight, packedOverlay, pose, DynamicBufferSource.WORLD, tile.level, tile.blockPos.asLong().toInt())
|
context.itemRenderer.renderStatic(item, ItemTransforms.TransformType.FIXED, packedLight, packedOverlay, pose, DynamicBufferSource.WORLD, tile.blockPos.asLong().toInt())
|
||||||
|
|
||||||
pose.popPose()
|
pose.popPose()
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,6 @@ import net.minecraft.client.renderer.block.model.ItemTransforms
|
|||||||
import net.minecraft.client.renderer.blockentity.BlockEntityRenderer
|
import net.minecraft.client.renderer.blockentity.BlockEntityRenderer
|
||||||
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider
|
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider
|
||||||
import net.minecraft.core.particles.DustParticleOptions
|
import net.minecraft.core.particles.DustParticleOptions
|
||||||
import net.minecraft.world.item.ItemDisplayContext
|
|
||||||
import net.minecraft.world.level.levelgen.XoroshiroRandomSource
|
import net.minecraft.world.level.levelgen.XoroshiroRandomSource
|
||||||
import org.joml.Vector3f
|
import org.joml.Vector3f
|
||||||
import org.lwjgl.opengl.GL14.glBlendColor
|
import org.lwjgl.opengl.GL14.glBlendColor
|
||||||
@ -80,7 +79,7 @@ class MatterReplicatorRenderer(private val context: BlockEntityRendererProvider.
|
|||||||
|
|
||||||
context.itemRenderer.render(
|
context.itemRenderer.render(
|
||||||
item,
|
item,
|
||||||
ItemDisplayContext.NONE,
|
ItemTransforms.TransformType.NONE,
|
||||||
false,
|
false,
|
||||||
pose,
|
pose,
|
||||||
source,
|
source,
|
||||||
|
@ -5,9 +5,9 @@ import com.mojang.blaze3d.systems.RenderSystem
|
|||||||
import com.mojang.blaze3d.vertex.PoseStack
|
import com.mojang.blaze3d.vertex.PoseStack
|
||||||
import com.mojang.math.Axis
|
import com.mojang.math.Axis
|
||||||
import net.minecraft.client.renderer.MultiBufferSource
|
import net.minecraft.client.renderer.MultiBufferSource
|
||||||
|
import net.minecraft.client.renderer.block.model.ItemTransforms
|
||||||
import net.minecraft.client.renderer.blockentity.BlockEntityRenderer
|
import net.minecraft.client.renderer.blockentity.BlockEntityRenderer
|
||||||
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider
|
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider
|
||||||
import net.minecraft.world.item.ItemDisplayContext
|
|
||||||
import ru.dbotthepony.mc.otm.block.entity.matter.MatterScannerBlockEntity
|
import ru.dbotthepony.mc.otm.block.entity.matter.MatterScannerBlockEntity
|
||||||
import ru.dbotthepony.mc.otm.client.render.DynamicBufferSource
|
import ru.dbotthepony.mc.otm.client.render.DynamicBufferSource
|
||||||
import ru.dbotthepony.mc.otm.client.render.lockBlendFunc
|
import ru.dbotthepony.mc.otm.client.render.lockBlendFunc
|
||||||
@ -41,12 +41,11 @@ class MatterScannerRenderer(private val context: BlockEntityRendererProvider.Con
|
|||||||
|
|
||||||
context.itemRenderer.renderStatic(
|
context.itemRenderer.renderStatic(
|
||||||
item,
|
item,
|
||||||
ItemDisplayContext.FIXED,
|
ItemTransforms.TransformType.FIXED,
|
||||||
packedLight,
|
packedLight,
|
||||||
packedOverlay,
|
packedOverlay,
|
||||||
pose,
|
pose,
|
||||||
source,
|
source,
|
||||||
tile.level,
|
|
||||||
tile.blockPos.asLong().toInt()
|
tile.blockPos.asLong().toInt()
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -12,7 +12,6 @@ import net.minecraft.network.chat.Component
|
|||||||
import net.minecraft.world.entity.player.Inventory
|
import net.minecraft.world.entity.player.Inventory
|
||||||
import net.minecraft.world.inventory.Slot
|
import net.minecraft.world.inventory.Slot
|
||||||
import net.minecraft.world.item.Item
|
import net.minecraft.world.item.Item
|
||||||
import net.minecraft.world.item.ItemDisplayContext
|
|
||||||
import net.minecraft.world.item.ItemStack
|
import net.minecraft.world.item.ItemStack
|
||||||
import net.minecraftforge.client.event.ContainerScreenEvent.Render.Background
|
import net.minecraftforge.client.event.ContainerScreenEvent.Render.Background
|
||||||
import net.minecraftforge.client.event.ContainerScreenEvent.Render.Foreground
|
import net.minecraftforge.client.event.ContainerScreenEvent.Render.Foreground
|
||||||
@ -23,7 +22,6 @@ import ru.dbotthepony.mc.otm.client.render.MGUIGraphics
|
|||||||
import ru.dbotthepony.mc.otm.client.moveMousePosScaled
|
import ru.dbotthepony.mc.otm.client.moveMousePosScaled
|
||||||
import ru.dbotthepony.mc.otm.client.render.WidgetLocation
|
import ru.dbotthepony.mc.otm.client.render.WidgetLocation
|
||||||
import ru.dbotthepony.mc.otm.client.render.Widgets18
|
import ru.dbotthepony.mc.otm.client.render.Widgets18
|
||||||
import ru.dbotthepony.mc.otm.client.render.translation
|
|
||||||
import ru.dbotthepony.mc.otm.client.screen.panels.*
|
import ru.dbotthepony.mc.otm.client.screen.panels.*
|
||||||
import ru.dbotthepony.mc.otm.client.screen.panels.button.DeviceControls
|
import ru.dbotthepony.mc.otm.client.screen.panels.button.DeviceControls
|
||||||
import ru.dbotthepony.mc.otm.client.screen.panels.slot.AbstractSlotPanel
|
import ru.dbotthepony.mc.otm.client.screen.panels.slot.AbstractSlotPanel
|
||||||
@ -46,8 +44,6 @@ import ru.dbotthepony.mc.otm.client.screen.widget.WidePowerGaugePanel
|
|||||||
import ru.dbotthepony.mc.otm.client.screen.widget.WideProfiledPowerGaugePanel
|
import ru.dbotthepony.mc.otm.client.screen.widget.WideProfiledPowerGaugePanel
|
||||||
import ru.dbotthepony.mc.otm.config.ClientConfig
|
import ru.dbotthepony.mc.otm.config.ClientConfig
|
||||||
import ru.dbotthepony.mc.otm.core.TranslatableComponent
|
import ru.dbotthepony.mc.otm.core.TranslatableComponent
|
||||||
import ru.dbotthepony.mc.otm.core.math.component1
|
|
||||||
import ru.dbotthepony.mc.otm.core.math.component2
|
|
||||||
import ru.dbotthepony.mc.otm.core.math.integerDivisionDown
|
import ru.dbotthepony.mc.otm.core.math.integerDivisionDown
|
||||||
import ru.dbotthepony.mc.otm.menu.MatteryMenu
|
import ru.dbotthepony.mc.otm.menu.MatteryMenu
|
||||||
import ru.dbotthepony.mc.otm.menu.MatterySlot
|
import ru.dbotthepony.mc.otm.menu.MatterySlot
|
||||||
@ -89,20 +85,37 @@ abstract class MatteryScreen<T : MatteryMenu>(menu: T, inventory: Inventory, tit
|
|||||||
val quickCraftingType: Int get() = super.quickCraftingType
|
val quickCraftingType: Int get() = super.quickCraftingType
|
||||||
val isQuickCrafting: Boolean get() = super.isQuickCrafting
|
val isQuickCrafting: Boolean get() = super.isQuickCrafting
|
||||||
|
|
||||||
fun renderItemStack(graphics: MGUIGraphics, itemstack: ItemStack, countOverride: String? = null) {
|
fun renderItemStack(absoluteX: Float, absoluteY: Float, itemstack: ItemStack, countOverride: String? = null) {
|
||||||
if (!itemstack.isEmpty) {
|
if (!itemstack.isEmpty) {
|
||||||
RenderSystem.enableDepthTest()
|
RenderSystem.enableDepthTest()
|
||||||
itemRenderer.renderGuiItem(graphics.pose, itemstack, 1, 1)
|
|
||||||
RenderSystem.depthFunc(GL11.GL_ALWAYS)
|
|
||||||
|
|
||||||
itemRenderer.renderGuiItemDecorations(
|
val systemPoseStack = RenderSystem.getModelViewStack()
|
||||||
graphics.pose,
|
|
||||||
super.font,
|
systemPoseStack.pushPose()
|
||||||
|
systemPoseStack.translate(absoluteX + 1f, absoluteY + 1f, 0f)
|
||||||
|
RenderSystem.applyModelViewMatrix()
|
||||||
|
RenderSystem.depthFunc(GL11.GL_LESS)
|
||||||
|
|
||||||
|
// Thanks Mojang
|
||||||
|
// Very cool
|
||||||
|
// (for int x, int y, which are then cast into doubles anyway)
|
||||||
|
itemRenderer.blitOffset = 1f // Z pos
|
||||||
|
|
||||||
|
itemRenderer.renderAndDecorateItem(
|
||||||
|
requireNotNull(ru.dbotthepony.mc.otm.client.minecraft.player) { "yo, dude, what the fuck" },
|
||||||
itemstack,
|
itemstack,
|
||||||
1,
|
0,
|
||||||
1,
|
0,
|
||||||
countOverride
|
(absoluteX + absoluteY * 1000f).toInt()
|
||||||
)
|
)
|
||||||
|
|
||||||
|
RenderSystem.depthFunc(GL11.GL_ALWAYS)
|
||||||
|
itemRenderer.renderGuiItemDecorations(super.font, itemstack, 0, 0, countOverride)
|
||||||
|
itemRenderer.blitOffset = 0f
|
||||||
|
|
||||||
|
// too big accumulations can lead to Z near clipping issues
|
||||||
|
systemPoseStack.popPose()
|
||||||
|
RenderSystem.applyModelViewMatrix()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -695,7 +708,7 @@ 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(itemstack, mouseX - 8, mouseY - i2, overrideCount)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (menu.carried.isEmpty) {
|
if (menu.carried.isEmpty) {
|
||||||
|
@ -5,11 +5,8 @@ import com.mojang.blaze3d.platform.InputConstants
|
|||||||
import com.mojang.blaze3d.systems.RenderSystem
|
import com.mojang.blaze3d.systems.RenderSystem
|
||||||
import it.unimi.dsi.fastutil.ints.IntAVLTreeSet
|
import it.unimi.dsi.fastutil.ints.IntAVLTreeSet
|
||||||
import it.unimi.dsi.fastutil.objects.ReferenceArraySet
|
import it.unimi.dsi.fastutil.objects.ReferenceArraySet
|
||||||
import net.minecraft.client.gui.ComponentPath
|
|
||||||
import net.minecraft.client.gui.Font
|
import net.minecraft.client.gui.Font
|
||||||
import net.minecraft.client.gui.components.events.GuiEventListener
|
import net.minecraft.client.gui.components.events.GuiEventListener
|
||||||
import net.minecraft.client.gui.navigation.FocusNavigationEvent
|
|
||||||
import net.minecraft.client.gui.navigation.ScreenRectangle
|
|
||||||
import net.minecraft.client.gui.screens.Screen
|
import net.minecraft.client.gui.screens.Screen
|
||||||
import net.minecraft.client.renderer.Rect2i
|
import net.minecraft.client.renderer.Rect2i
|
||||||
import net.minecraft.network.chat.Component
|
import net.minecraft.network.chat.Component
|
||||||
@ -78,17 +75,15 @@ open class EditablePanel<out S : Screen> @JvmOverloads constructor(
|
|||||||
) : Comparable<EditablePanel<*>> {
|
) : Comparable<EditablePanel<*>> {
|
||||||
// layout engine does not support navigation using keyboard
|
// layout engine does not support navigation using keyboard
|
||||||
val listener: GuiEventListener = object : GuiEventListener {
|
val listener: GuiEventListener = object : GuiEventListener {
|
||||||
override fun setFocused(p_265728_: Boolean) {
|
override fun changeFocus(p_265728_: Boolean): Boolean {
|
||||||
if (p_265728_) {
|
if (p_265728_) {
|
||||||
if (isVisible())
|
if (isVisible())
|
||||||
requestFocus()
|
requestFocus()
|
||||||
} else {
|
} else {
|
||||||
killFocus()
|
killFocus()
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
override fun isFocused(): Boolean {
|
return true
|
||||||
return isEverFocused()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun mouseMoved(p_94758_: Double, p_94759_: Double) {
|
override fun mouseMoved(p_94758_: Double, p_94759_: Double) {
|
||||||
@ -123,22 +118,9 @@ open class EditablePanel<out S : Screen> @JvmOverloads constructor(
|
|||||||
return this@EditablePanel.charTyped(p_94732_, p_94733_)
|
return this@EditablePanel.charTyped(p_94732_, p_94733_)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun nextFocusPath(p_265234_: FocusNavigationEvent): ComponentPath? {
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun isMouseOver(p_94748_: Double, p_94749_: Double): Boolean {
|
override fun isMouseOver(p_94748_: Double, p_94749_: Double): Boolean {
|
||||||
return this@EditablePanel.isMouseOver(p_94748_, p_94749_)
|
return this@EditablePanel.isMouseOver(p_94748_, p_94749_)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getCurrentFocusPath(): ComponentPath? {
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getRectangle(): ScreenRectangle {
|
|
||||||
val rect = calculateAbsoluteRectangle()
|
|
||||||
return ScreenRectangle(rect.x.toInt(), rect.y.toInt(), rect.width.toInt(), rect.height.toInt())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -170,15 +170,14 @@ class EntityRendererPanel<out S : Screen> @JvmOverloads constructor(
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
val renderX = width.toInt() / 2
|
val renderX = absoluteX.toInt() + width.toInt() / 2
|
||||||
val renderY = (height * 0.9f).toInt()
|
val renderY = absoluteY.toInt() + (height * 0.9f).toInt()
|
||||||
|
|
||||||
InventoryScreen.renderEntityInInventoryFollowsMouse(
|
InventoryScreen.renderEntityInInventory(
|
||||||
graphics.pose,
|
|
||||||
renderX,
|
renderX,
|
||||||
renderY,
|
renderY,
|
||||||
renderScale,
|
renderScale,
|
||||||
absoluteX.toInt() + renderX - mouseX,
|
renderX - mouseX,
|
||||||
absoluteY + height * 0.15f - mouseY,
|
absoluteY + height * 0.15f - mouseY,
|
||||||
entity
|
entity
|
||||||
)
|
)
|
||||||
|
@ -12,22 +12,22 @@ import ru.dbotthepony.mc.otm.OverdriveThatMatters
|
|||||||
import ru.dbotthepony.mc.otm.registry.MItemTags
|
import ru.dbotthepony.mc.otm.registry.MItemTags
|
||||||
|
|
||||||
private object SimpleTritaniumArmorMaterial : ArmorMaterial {
|
private object SimpleTritaniumArmorMaterial : ArmorMaterial {
|
||||||
override fun getDurabilityForType(p_40410_: ArmorItem.Type): Int {
|
override fun getDurabilityForSlot(p_40410_: EquipmentSlot): Int {
|
||||||
return when (p_40410_) {
|
return when (p_40410_) {
|
||||||
ArmorItem.Type.HELMET -> 380
|
EquipmentSlot.HEAD -> 380
|
||||||
ArmorItem.Type.CHESTPLATE -> 590
|
EquipmentSlot.CHEST -> 590
|
||||||
ArmorItem.Type.LEGGINGS -> 500
|
EquipmentSlot.LEGS -> 500
|
||||||
ArmorItem.Type.BOOTS -> 420
|
EquipmentSlot.FEET -> 420
|
||||||
else -> throw IllegalArgumentException("yo dude what the fuck $p_40410_")
|
else -> throw IllegalArgumentException("yo dude what the fuck $p_40410_")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getDefenseForType(p_40411_: ArmorItem.Type): Int {
|
override fun getDefenseForSlot(p_40411_: EquipmentSlot): Int {
|
||||||
return when (p_40411_) {
|
return when (p_40411_) {
|
||||||
ArmorItem.Type.HELMET -> 2
|
EquipmentSlot.HEAD -> 2
|
||||||
ArmorItem.Type.CHESTPLATE -> 6
|
EquipmentSlot.CHEST -> 6
|
||||||
ArmorItem.Type.LEGGINGS -> 7
|
EquipmentSlot.LEGS -> 7
|
||||||
ArmorItem.Type.BOOTS -> 2
|
EquipmentSlot.FEET -> 2
|
||||||
else -> throw IllegalArgumentException("yo dude what the fuck $p_40411_")
|
else -> throw IllegalArgumentException("yo dude what the fuck $p_40411_")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -43,7 +43,7 @@ private object SimpleTritaniumArmorMaterial : ArmorMaterial {
|
|||||||
override fun getKnockbackResistance() = 0f
|
override fun getKnockbackResistance() = 0f
|
||||||
}
|
}
|
||||||
|
|
||||||
class SimpleTritaniumArmorItem(slot: Type) : ArmorItem(SimpleTritaniumArmorMaterial, slot, Properties().stacksTo(1)) {
|
class SimpleTritaniumArmorItem(slot: EquipmentSlot) : ArmorItem(SimpleTritaniumArmorMaterial, slot, Properties().stacksTo(1)) {
|
||||||
override fun getArmorTexture(stack: ItemStack, entity: Entity?, slot: EquipmentSlot, type: String?): String? {
|
override fun getArmorTexture(stack: ItemStack, entity: Entity?, slot: EquipmentSlot, type: String?): String? {
|
||||||
if (type != "overlay" || slot == EquipmentSlot.FEET)
|
if (type != "overlay" || slot == EquipmentSlot.FEET)
|
||||||
return when (slot) {
|
return when (slot) {
|
||||||
|
@ -3,7 +3,7 @@ package ru.dbotthepony.mc.otm.item.armor
|
|||||||
import net.minecraft.client.model.HumanoidModel
|
import net.minecraft.client.model.HumanoidModel
|
||||||
import net.minecraft.sounds.SoundEvent
|
import net.minecraft.sounds.SoundEvent
|
||||||
import net.minecraft.sounds.SoundEvents
|
import net.minecraft.sounds.SoundEvents
|
||||||
import net.minecraft.world.damagesource.DamageTypes
|
import net.minecraft.world.damagesource.DamageSource
|
||||||
import net.minecraft.world.entity.Entity
|
import net.minecraft.world.entity.Entity
|
||||||
import net.minecraft.world.entity.EquipmentSlot
|
import net.minecraft.world.entity.EquipmentSlot
|
||||||
import net.minecraft.world.entity.LivingEntity
|
import net.minecraft.world.entity.LivingEntity
|
||||||
@ -19,21 +19,23 @@ import ru.dbotthepony.mc.otm.registry.MItems
|
|||||||
import java.util.function.Consumer
|
import java.util.function.Consumer
|
||||||
|
|
||||||
private object TritaniumArmorMaterial : ArmorMaterial {
|
private object TritaniumArmorMaterial : ArmorMaterial {
|
||||||
override fun getDurabilityForType(p_40410_: ArmorItem.Type): Int {
|
override fun getDurabilityForSlot(p_40410_: EquipmentSlot): Int {
|
||||||
return when (p_40410_) {
|
return when (p_40410_) {
|
||||||
ArmorItem.Type.HELMET -> 520
|
EquipmentSlot.HEAD -> 520
|
||||||
ArmorItem.Type.CHESTPLATE -> 920
|
EquipmentSlot.CHEST -> 920
|
||||||
ArmorItem.Type.LEGGINGS -> 650
|
EquipmentSlot.LEGS -> 650
|
||||||
ArmorItem.Type.BOOTS -> 540
|
EquipmentSlot.FEET -> 540
|
||||||
|
else -> throw IllegalArgumentException(p_40410_.toString())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getDefenseForType(p_40411_: ArmorItem.Type): Int {
|
override fun getDefenseForSlot(p_40411_: EquipmentSlot): Int {
|
||||||
return when (p_40411_) {
|
return when (p_40411_) {
|
||||||
ArmorItem.Type.HELMET -> 4
|
EquipmentSlot.HEAD -> 4
|
||||||
ArmorItem.Type.CHESTPLATE -> 9
|
EquipmentSlot.CHEST -> 9
|
||||||
ArmorItem.Type.LEGGINGS -> 7
|
EquipmentSlot.LEGS -> 7
|
||||||
ArmorItem.Type.BOOTS -> 3
|
EquipmentSlot.FEET -> 3
|
||||||
|
else -> throw IllegalArgumentException(p_40411_.toString())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,7 +65,7 @@ private object TritaniumArmorRenderProperties : IClientItemExtensions {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class TritaniumArmorItem(slot: Type) : DyeableArmorItem(TritaniumArmorMaterial, slot, Properties().stacksTo(1).rarity(Rarity.RARE)) {
|
class TritaniumArmorItem(slot: EquipmentSlot) : DyeableArmorItem(TritaniumArmorMaterial, slot, Properties().stacksTo(1).rarity(Rarity.RARE)) {
|
||||||
override fun initializeClient(consumer: Consumer<IClientItemExtensions>) {
|
override fun initializeClient(consumer: Consumer<IClientItemExtensions>) {
|
||||||
super.initializeClient(consumer)
|
super.initializeClient(consumer)
|
||||||
consumer.accept(TritaniumArmorRenderProperties)
|
consumer.accept(TritaniumArmorRenderProperties)
|
||||||
@ -87,7 +89,7 @@ class TritaniumArmorItem(slot: Type) : DyeableArmorItem(TritaniumArmorMaterial,
|
|||||||
const val TEXTURE_LOCATION_OVERLAY = "${OverdriveThatMatters.MOD_ID}:textures/models/armor/tritanium_armor_overlay.png"
|
const val TEXTURE_LOCATION_OVERLAY = "${OverdriveThatMatters.MOD_ID}:textures/models/armor/tritanium_armor_overlay.png"
|
||||||
|
|
||||||
fun onHurt(event: LivingAttackEvent) {
|
fun onHurt(event: LivingAttackEvent) {
|
||||||
if (event.source.typeHolder().`is`(DamageTypes.SWEET_BERRY_BUSH) || event.source.msgId == "sweetBerryBush") {
|
if (event.source == DamageSource.SWEET_BERRY_BUSH || event.source.msgId == "sweetBerryBush") {
|
||||||
if (
|
if (
|
||||||
event.entity.getItemBySlot(EquipmentSlot.FEET).let { !it.isEmpty && it.item == MItems.TRITANIUM_BOOTS } &&
|
event.entity.getItemBySlot(EquipmentSlot.FEET).let { !it.isEmpty && it.item == MItems.TRITANIUM_BOOTS } &&
|
||||||
event.entity.getItemBySlot(EquipmentSlot.LEGS).let { !it.isEmpty && it.item == MItems.TRITANIUM_PANTS }
|
event.entity.getItemBySlot(EquipmentSlot.LEGS).let { !it.isEmpty && it.item == MItems.TRITANIUM_PANTS }
|
||||||
|
@ -18,8 +18,6 @@ import ru.dbotthepony.mc.otm.config.ServerConfig
|
|||||||
import ru.dbotthepony.mc.otm.capability.matteryPlayer
|
import ru.dbotthepony.mc.otm.capability.matteryPlayer
|
||||||
import ru.dbotthepony.mc.otm.client.minecraft
|
import ru.dbotthepony.mc.otm.client.minecraft
|
||||||
import ru.dbotthepony.mc.otm.core.TranslatableComponent
|
import ru.dbotthepony.mc.otm.core.TranslatableComponent
|
||||||
import ru.dbotthepony.mc.otm.core.isExplosion
|
|
||||||
import ru.dbotthepony.mc.otm.core.isFire
|
|
||||||
import ru.dbotthepony.mc.otm.registry.MItems
|
import ru.dbotthepony.mc.otm.registry.MItems
|
||||||
import ru.dbotthepony.mc.otm.runIfClient
|
import ru.dbotthepony.mc.otm.runIfClient
|
||||||
import ru.dbotthepony.mc.otm.triggers.ExopackSlotsExpandedTrigger
|
import ru.dbotthepony.mc.otm.triggers.ExopackSlotsExpandedTrigger
|
||||||
|
@ -3,13 +3,13 @@ package ru.dbotthepony.mc.otm.item.weapon
|
|||||||
import com.mojang.blaze3d.systems.RenderSystem
|
import com.mojang.blaze3d.systems.RenderSystem
|
||||||
import net.minecraft.client.Minecraft
|
import net.minecraft.client.Minecraft
|
||||||
import net.minecraft.client.model.HumanoidModel
|
import net.minecraft.client.model.HumanoidModel
|
||||||
|
import net.minecraft.client.renderer.block.model.ItemTransforms
|
||||||
import net.minecraft.nbt.CompoundTag
|
import net.minecraft.nbt.CompoundTag
|
||||||
import net.minecraft.network.FriendlyByteBuf
|
import net.minecraft.network.FriendlyByteBuf
|
||||||
import net.minecraft.server.level.ServerPlayer
|
import net.minecraft.server.level.ServerPlayer
|
||||||
import net.minecraft.world.entity.Entity
|
import net.minecraft.world.entity.Entity
|
||||||
import net.minecraft.world.entity.player.Player
|
import net.minecraft.world.entity.player.Player
|
||||||
import net.minecraft.world.item.Item
|
import net.minecraft.world.item.Item
|
||||||
import net.minecraft.world.item.ItemDisplayContext
|
|
||||||
import net.minecraft.world.item.ItemStack
|
import net.minecraft.world.item.ItemStack
|
||||||
import net.minecraft.world.item.Rarity
|
import net.minecraft.world.item.Rarity
|
||||||
import net.minecraft.world.level.block.state.BlockState
|
import net.minecraft.world.level.block.state.BlockState
|
||||||
@ -429,7 +429,7 @@ abstract class AbstractWeaponItem<D : WeaponDataTable>(val tables: KClass<D>, pr
|
|||||||
itemInHandRenderer.renderItem(
|
itemInHandRenderer.renderItem(
|
||||||
player,
|
player,
|
||||||
stack,
|
stack,
|
||||||
ItemDisplayContext.FIRST_PERSON_RIGHT_HAND,
|
ItemTransforms.TransformType.FIRST_PERSON_RIGHT_HAND,
|
||||||
false,
|
false,
|
||||||
pose,
|
pose,
|
||||||
event.multiBufferSource,
|
event.multiBufferSource,
|
||||||
|
@ -112,10 +112,10 @@ class ComputeAction(
|
|||||||
try {
|
try {
|
||||||
DataResult.success(Pair(Constant(Decimal(it.substring(1).trim()), it.substring(1).trim().toDouble(), fn, fn), ops.empty()))
|
DataResult.success(Pair(Constant(Decimal(it.substring(1).trim()), it.substring(1).trim().toDouble(), fn, fn), ops.empty()))
|
||||||
} catch (err: NumberFormatException) {
|
} catch (err: NumberFormatException) {
|
||||||
DataResult.error { "Not a number: ${it.substring(1).trim()} (input string: $it)" }
|
DataResult.error("Not a number: ${it.substring(1).trim()} (input string: $it)")
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
DataResult.error { "Input string does not match expected operand: expected $symbol, got ${it[0]} (for input $it)" }
|
DataResult.error("Input string does not match expected operand: expected $symbol, got ${it[0]} (for input $it)")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -135,7 +135,7 @@ class ComputeAction(
|
|||||||
try {
|
try {
|
||||||
DataResult.success(Pair(Constant(Decimal(it.toString()), it.toDouble(), IMatterFunction.PLUS, IMatterFunction.PLUS), ops.empty()))
|
DataResult.success(Pair(Constant(Decimal(it.toString()), it.toDouble(), IMatterFunction.PLUS, IMatterFunction.PLUS), ops.empty()))
|
||||||
} catch (err: NumberFormatException) {
|
} catch (err: NumberFormatException) {
|
||||||
DataResult.error { "Not a number: $it" }
|
DataResult.error("Not a number: $it")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -146,7 +146,7 @@ class ComputeAction(
|
|||||||
try {
|
try {
|
||||||
DataResult.success(Pair(Constant(Decimal(it), it.toDouble(), IMatterFunction.PLUS, IMatterFunction.PLUS), ops.empty()))
|
DataResult.success(Pair(Constant(Decimal(it), it.toDouble(), IMatterFunction.PLUS, IMatterFunction.PLUS), ops.empty()))
|
||||||
} catch (err: NumberFormatException) {
|
} catch (err: NumberFormatException) {
|
||||||
DataResult.error { "Not a number: $it" }
|
DataResult.error("Not a number: $it")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -297,12 +297,6 @@ abstract class MatteryMenu(
|
|||||||
open inner class EquipmentSlot(container: Container, index: Int, val type: net.minecraft.world.entity.EquipmentSlot) : InventorySlot(container, index) {
|
open inner class EquipmentSlot(container: Container, index: Int, val type: net.minecraft.world.entity.EquipmentSlot) : InventorySlot(container, index) {
|
||||||
constructor(type: net.minecraft.world.entity.EquipmentSlot) : this(inventory, 34 + type.ordinal, type)
|
constructor(type: net.minecraft.world.entity.EquipmentSlot) : this(inventory, 34 + type.ordinal, type)
|
||||||
|
|
||||||
override fun setByPlayer(newItem: ItemStack) {
|
|
||||||
val oldItem = item
|
|
||||||
inventory.player.onEquipItem(type, oldItem, newItem)
|
|
||||||
super.setByPlayer(newItem)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun mayPlace(itemStack: ItemStack): Boolean {
|
override fun mayPlace(itemStack: ItemStack): Boolean {
|
||||||
return super.mayPlace(itemStack) && itemStack.canEquip(type, inventory.player)
|
return super.mayPlace(itemStack) && itemStack.canEquip(type, inventory.player)
|
||||||
}
|
}
|
||||||
@ -327,12 +321,6 @@ abstract class MatteryMenu(
|
|||||||
autoCreateInventoryFrame = autoFrame
|
autoCreateInventoryFrame = autoFrame
|
||||||
|
|
||||||
offhandSlot = object : InventorySlot(inventory, 40) {
|
offhandSlot = object : InventorySlot(inventory, 40) {
|
||||||
override fun setByPlayer(newItem: ItemStack) {
|
|
||||||
val oldItem = this.item
|
|
||||||
inventory.player.onEquipItem(net.minecraft.world.entity.EquipmentSlot.OFFHAND, oldItem, newItem)
|
|
||||||
super.setByPlayer(newItem)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getNoItemIcon(): Pair<ResourceLocation, ResourceLocation> {
|
override fun getNoItemIcon(): Pair<ResourceLocation, ResourceLocation> {
|
||||||
return Pair.of(InventoryMenu.BLOCK_ATLAS, InventoryMenu.EMPTY_ARMOR_SLOT_SHIELD)
|
return Pair.of(InventoryMenu.BLOCK_ATLAS, InventoryMenu.EMPTY_ARMOR_SLOT_SHIELD)
|
||||||
}
|
}
|
||||||
@ -602,7 +590,7 @@ abstract class MatteryMenu(
|
|||||||
val copy = source.item.copy()
|
val copy = source.item.copy()
|
||||||
|
|
||||||
if (remainder.isEmpty) {
|
if (remainder.isEmpty) {
|
||||||
source.setByPlayer(ItemStack.EMPTY)
|
source.set(ItemStack.EMPTY)
|
||||||
source.onTake(player, copy)
|
source.onTake(player, copy)
|
||||||
} else {
|
} else {
|
||||||
copy.count = source.item.count - remainder.count
|
copy.count = source.item.count - remainder.count
|
||||||
@ -662,7 +650,7 @@ abstract class MatteryMenu(
|
|||||||
val newCount = copy.count.coerceAtMost(limit)
|
val newCount = copy.count.coerceAtMost(limit)
|
||||||
|
|
||||||
if (!simulate) {
|
if (!simulate) {
|
||||||
slot.setByPlayer(copy.copy().also { it.count = newCount })
|
slot.set(copy.copy().also { it.count = newCount })
|
||||||
slot.setChanged()
|
slot.setChanged()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,7 +141,7 @@ class PainterMenu(
|
|||||||
if (recipe == null || !recipe.value.canCraft(dyeStoredDirect) || !recipe.value.matches(inputContainer, inventory.player.level)) {
|
if (recipe == null || !recipe.value.canCraft(dyeStoredDirect) || !recipe.value.matches(inputContainer, inventory.player.level)) {
|
||||||
outputContainer.clearContent()
|
outputContainer.clearContent()
|
||||||
} else {
|
} else {
|
||||||
outputContainer[0] = recipe.value.assemble(inputContainer, inventory.player.level.registryAccess())
|
outputContainer[0] = recipe.value.assemble(inputContainer)
|
||||||
lastRecipe = recipe
|
lastRecipe = recipe
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,7 @@ class ExplosiveHammerPrimingRecipe(val payload: Ingredient, private val id: Reso
|
|||||||
result.any { payload.test(it) }
|
result.any { payload.test(it) }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun assemble(pContainer: CraftingContainer, registry: RegistryAccess): ItemStack {
|
override fun assemble(pContainer: CraftingContainer): ItemStack {
|
||||||
val hammer = pContainer.stream().filter { it.isNotEmpty && it.item is ExplosiveHammerItem }.findAny()
|
val hammer = pContainer.stream().filter { it.isNotEmpty && it.item is ExplosiveHammerItem }.findAny()
|
||||||
if (hammer.isEmpty) return ItemStack.EMPTY
|
if (hammer.isEmpty) return ItemStack.EMPTY
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ class ExplosiveHammerPrimingRecipe(val payload: Ingredient, private val id: Reso
|
|||||||
return pWidth * pHeight >= 3
|
return pWidth * pHeight >= 3
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getResultItem(registry: RegistryAccess): ItemStack {
|
override fun getResultItem(): ItemStack {
|
||||||
return ItemStack.EMPTY
|
return ItemStack.EMPTY
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ open class MatterEntanglerRecipe(
|
|||||||
return ingredients.preemptiveTest(container)
|
return ingredients.preemptiveTest(container)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun assemble(container: CraftingContainer, registry: RegistryAccess): ItemStack {
|
override fun assemble(container: CraftingContainer): ItemStack {
|
||||||
return result.copy().also {
|
return result.copy().also {
|
||||||
it.tagNotNull[uuidKey] = fixedUuid.getOrElse { UUID.randomUUID() }
|
it.tagNotNull[uuidKey] = fixedUuid.getOrElse { UUID.randomUUID() }
|
||||||
}
|
}
|
||||||
@ -75,7 +75,7 @@ open class MatterEntanglerRecipe(
|
|||||||
return width >= ingredients.width && height >= ingredients.height
|
return width >= ingredients.width && height >= ingredients.height
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getResultItem(registry: RegistryAccess): ItemStack {
|
override fun getResultItem(): ItemStack {
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -111,8 +111,8 @@ open class MatterEntanglerRecipe(
|
|||||||
fun matter() = Matter(this)
|
fun matter() = Matter(this)
|
||||||
|
|
||||||
open class Energy(val parent: MatterEntanglerRecipe) : IMatterEntanglerRecipe by parent {
|
open class Energy(val parent: MatterEntanglerRecipe) : IMatterEntanglerRecipe by parent {
|
||||||
override fun assemble(container: CraftingContainer, registry: RegistryAccess): ItemStack {
|
override fun assemble(container: CraftingContainer): ItemStack {
|
||||||
return parent.assemble(container, registry).also { result ->
|
return parent.assemble(container).also { result ->
|
||||||
container.iterator().map { it.matteryEnergy }.filterNotNull().forEach {
|
container.iterator().map { it.matteryEnergy }.filterNotNull().forEach {
|
||||||
result.matteryEnergy!!.batteryLevel += it.batteryLevel
|
result.matteryEnergy!!.batteryLevel += it.batteryLevel
|
||||||
}
|
}
|
||||||
@ -129,8 +129,8 @@ open class MatterEntanglerRecipe(
|
|||||||
}
|
}
|
||||||
|
|
||||||
open class Matter(val parent: MatterEntanglerRecipe) : IMatterEntanglerRecipe by parent {
|
open class Matter(val parent: MatterEntanglerRecipe) : IMatterEntanglerRecipe by parent {
|
||||||
override fun assemble(container: CraftingContainer, registry: RegistryAccess): ItemStack {
|
override fun assemble(container: CraftingContainer): ItemStack {
|
||||||
return parent.assemble(container, registry).also { result ->
|
return parent.assemble(container).also { result ->
|
||||||
container.iterator().map { it.matter }.filterNotNull().forEach {
|
container.iterator().map { it.matter }.filterNotNull().forEach {
|
||||||
result.matter!!.storedMatter += it.storedMatter
|
result.matter!!.storedMatter += it.storedMatter
|
||||||
}
|
}
|
||||||
|
@ -42,8 +42,8 @@ class UpgradeRecipe(
|
|||||||
return parent.recipe.canCraftInDimensions(p_43999_, p_44000_)
|
return parent.recipe.canCraftInDimensions(p_43999_, p_44000_)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getResultItem(p_267052_: RegistryAccess): ItemStack {
|
override fun getResultItem(): ItemStack {
|
||||||
return parent.recipe.getResultItem(p_267052_)
|
return parent.recipe.resultItem
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getRemainingItems(p_44004_: CraftingContainer): NonNullList<ItemStack> {
|
override fun getRemainingItems(p_44004_: CraftingContainer): NonNullList<ItemStack> {
|
||||||
@ -58,10 +58,6 @@ class UpgradeRecipe(
|
|||||||
return parent.recipe.isSpecial
|
return parent.recipe.isSpecial
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun showNotification(): Boolean {
|
|
||||||
return parent.recipe.showNotification()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getGroup(): String {
|
override fun getGroup(): String {
|
||||||
return parent.recipe.group
|
return parent.recipe.group
|
||||||
}
|
}
|
||||||
@ -184,8 +180,8 @@ class UpgradeRecipe(
|
|||||||
|
|
||||||
val copyPaths: ImmutableList<Op> = copyPaths.collect(ImmutableList.toImmutableList())
|
val copyPaths: ImmutableList<Op> = copyPaths.collect(ImmutableList.toImmutableList())
|
||||||
|
|
||||||
override fun assemble(pInv: CraftingContainer, registryAccess: RegistryAccess): ItemStack {
|
override fun assemble(pInv: CraftingContainer): ItemStack {
|
||||||
val result = parent.recipe.assemble(pInv, registryAccess)
|
val result = parent.recipe.assemble(pInv)
|
||||||
|
|
||||||
if (result.isEmpty) {
|
if (result.isEmpty) {
|
||||||
return result
|
return result
|
||||||
|
@ -280,7 +280,7 @@ object MCreativeTabs {
|
|||||||
it.icon { ItemStack(BATTERY_CREATIVE, 1) }
|
it.icon { ItemStack(BATTERY_CREATIVE, 1) }
|
||||||
it.title(TranslatableComponent("itemGroup.otm"))
|
it.title(TranslatableComponent("itemGroup.otm"))
|
||||||
|
|
||||||
it.displayItems { _, consumer ->
|
it.displayItems { _, consumer, hasPerms ->
|
||||||
addMainCreativeTabItems(consumer)
|
addMainCreativeTabItems(consumer)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -289,7 +289,7 @@ object MCreativeTabs {
|
|||||||
it.icon { ItemStack(MRegistry.VENT.item, 1) }
|
it.icon { ItemStack(MRegistry.VENT.item, 1) }
|
||||||
it.title(TranslatableComponent("itemGroup.otm_decorative"))
|
it.title(TranslatableComponent("itemGroup.otm_decorative"))
|
||||||
|
|
||||||
it.displayItems { _, consumer ->
|
it.displayItems { _, consumer, hasPerms ->
|
||||||
addDecorativeTabItems(consumer)
|
addDecorativeTabItems(consumer)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,24 +1,18 @@
|
|||||||
package ru.dbotthepony.mc.otm.registry
|
package ru.dbotthepony.mc.otm.registry
|
||||||
|
|
||||||
import net.minecraft.core.registries.Registries
|
import net.minecraft.world.damagesource.DamageSource
|
||||||
import net.minecraft.resources.ResourceKey
|
|
||||||
import net.minecraft.resources.ResourceLocation
|
|
||||||
import net.minecraft.world.damagesource.DamageType
|
|
||||||
import ru.dbotthepony.mc.otm.OverdriveThatMatters
|
|
||||||
|
|
||||||
object MDamageTypes {
|
object MDamageTypes {
|
||||||
private fun register(name: String): ResourceKey<DamageType> = ResourceKey.create(Registries.DAMAGE_TYPE, ResourceLocation(OverdriveThatMatters.MOD_ID, name))
|
val BECOME_ANDROID = DamageSource("become_android")
|
||||||
|
val BECOME_HUMANE = DamageSource("become_humane")
|
||||||
val BECOME_ANDROID = register("become_android")
|
val EVENT_HORIZON = DamageSource("event_horizon")
|
||||||
val BECOME_HUMANE = register("become_humane")
|
val HAWKING_RADIATION = DamageSource("hawking_radiation")
|
||||||
val EVENT_HORIZON = register("event_horizon")
|
val EXOPACK_PROBE = DamageSource("exopack_probe")
|
||||||
val HAWKING_RADIATION = register("hawking_radiation")
|
val EMP = DamageSource("emp")
|
||||||
val EXOPACK_PROBE = register("exopack_probe")
|
val SHOCKWAVE = DamageSource("shockwave")
|
||||||
val EMP = register("emp")
|
val PLASMA = DamageSource("plasma")
|
||||||
val SHOCKWAVE = register("shockwave")
|
val COSMIC_RAYS = DamageSource("cosmic_rays")
|
||||||
val PLASMA = register("plasma")
|
val EXPLOSIVE_HAMMER = DamageSource("explosive_hammer")
|
||||||
val COSMIC_RAYS = register("cosmic_rays")
|
val HAMMER_NAIL = DamageSource("hammer_nail")
|
||||||
val EXPLOSIVE_HAMMER = register("explosive_hammer")
|
val ANDROID_DISCHARGE = DamageSource("android_discharge")
|
||||||
val HAMMER_NAIL = register("hammer_nail")
|
|
||||||
val ANDROID_DISCHARGE = register("android_discharge")
|
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ package ru.dbotthepony.mc.otm.registry
|
|||||||
import net.minecraft.ChatFormatting
|
import net.minecraft.ChatFormatting
|
||||||
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.EquipmentSlot
|
||||||
import net.minecraft.world.food.FoodProperties
|
import net.minecraft.world.food.FoodProperties
|
||||||
import net.minecraft.world.item.*
|
import net.minecraft.world.item.*
|
||||||
import net.minecraft.world.item.crafting.Ingredient
|
import net.minecraft.world.item.crafting.Ingredient
|
||||||
@ -341,15 +342,15 @@ object MItems {
|
|||||||
::TRITANIUM_SHEARS,
|
::TRITANIUM_SHEARS,
|
||||||
)
|
)
|
||||||
|
|
||||||
val TRITANIUM_HELMET: TritaniumArmorItem by registry.register(MNames.TRITANIUM_HELMET) { TritaniumArmorItem(ArmorItem.Type.HELMET) }
|
val TRITANIUM_HELMET: TritaniumArmorItem by registry.register(MNames.TRITANIUM_HELMET) { TritaniumArmorItem(EquipmentSlot.HEAD) }
|
||||||
val TRITANIUM_CHESTPLATE: TritaniumArmorItem by registry.register(MNames.TRITANIUM_CHESTPLATE) { TritaniumArmorItem(ArmorItem.Type.CHESTPLATE) }
|
val TRITANIUM_CHESTPLATE: TritaniumArmorItem by registry.register(MNames.TRITANIUM_CHESTPLATE) { TritaniumArmorItem(EquipmentSlot.CHEST) }
|
||||||
val TRITANIUM_PANTS: TritaniumArmorItem by registry.register(MNames.TRITANIUM_PANTS) { TritaniumArmorItem(ArmorItem.Type.LEGGINGS) }
|
val TRITANIUM_PANTS: TritaniumArmorItem by registry.register(MNames.TRITANIUM_PANTS) { TritaniumArmorItem(EquipmentSlot.LEGS) }
|
||||||
val TRITANIUM_BOOTS: TritaniumArmorItem by registry.register(MNames.TRITANIUM_BOOTS) { TritaniumArmorItem(ArmorItem.Type.BOOTS) }
|
val TRITANIUM_BOOTS: TritaniumArmorItem by registry.register(MNames.TRITANIUM_BOOTS) { TritaniumArmorItem(EquipmentSlot.FEET) }
|
||||||
|
|
||||||
val SIMPLE_TRITANIUM_HELMET: SimpleTritaniumArmorItem by registry.register(MNames.SIMPLE_TRITANIUM_HELMET) { SimpleTritaniumArmorItem(ArmorItem.Type.HELMET) }
|
val SIMPLE_TRITANIUM_HELMET: SimpleTritaniumArmorItem by registry.register(MNames.SIMPLE_TRITANIUM_HELMET) { SimpleTritaniumArmorItem(EquipmentSlot.HEAD) }
|
||||||
val SIMPLE_TRITANIUM_CHESTPLATE: SimpleTritaniumArmorItem by registry.register(MNames.SIMPLE_TRITANIUM_CHESTPLATE) { SimpleTritaniumArmorItem(ArmorItem.Type.CHESTPLATE) }
|
val SIMPLE_TRITANIUM_CHESTPLATE: SimpleTritaniumArmorItem by registry.register(MNames.SIMPLE_TRITANIUM_CHESTPLATE) { SimpleTritaniumArmorItem(EquipmentSlot.CHEST) }
|
||||||
val SIMPLE_TRITANIUM_PANTS: SimpleTritaniumArmorItem by registry.register(MNames.SIMPLE_TRITANIUM_PANTS) { SimpleTritaniumArmorItem(ArmorItem.Type.LEGGINGS) }
|
val SIMPLE_TRITANIUM_PANTS: SimpleTritaniumArmorItem by registry.register(MNames.SIMPLE_TRITANIUM_PANTS) { SimpleTritaniumArmorItem(EquipmentSlot.LEGS) }
|
||||||
val SIMPLE_TRITANIUM_BOOTS: SimpleTritaniumArmorItem by registry.register(MNames.SIMPLE_TRITANIUM_BOOTS) { SimpleTritaniumArmorItem(ArmorItem.Type.BOOTS) }
|
val SIMPLE_TRITANIUM_BOOTS: SimpleTritaniumArmorItem by registry.register(MNames.SIMPLE_TRITANIUM_BOOTS) { SimpleTritaniumArmorItem(EquipmentSlot.FEET) }
|
||||||
|
|
||||||
val TRITANIUM_ARMOR = SupplierList(
|
val TRITANIUM_ARMOR = SupplierList(
|
||||||
::TRITANIUM_HELMET,
|
::TRITANIUM_HELMET,
|
||||||
|
@ -77,41 +77,41 @@ import ru.dbotthepony.mc.otm.menu.tech.TwinPlatePressMenu
|
|||||||
object MMenus {
|
object MMenus {
|
||||||
private val registry = DeferredRegister.create(ForgeRegistries.MENU_TYPES, OverdriveThatMatters.MOD_ID)
|
private val registry = DeferredRegister.create(ForgeRegistries.MENU_TYPES, OverdriveThatMatters.MOD_ID)
|
||||||
|
|
||||||
val ANDROID_STATION: MenuType<AndroidStationMenu> by registry.register(MNames.ANDROID_STATION) { MenuType(::AndroidStationMenu, FeatureFlags.VANILLA_SET) }
|
val ANDROID_STATION: MenuType<AndroidStationMenu> by registry.register(MNames.ANDROID_STATION) { MenuType(::AndroidStationMenu) }
|
||||||
val ANDROID_CHARGER: MenuType<AndroidChargerMenu> by registry.register(MNames.ANDROID_CHARGER) { MenuType({ a, b -> AndroidChargerMenu(a, b, null as AndroidChargerBlockEntity?) }, FeatureFlags.VANILLA_SET) }
|
val ANDROID_CHARGER: MenuType<AndroidChargerMenu> by registry.register(MNames.ANDROID_CHARGER) { MenuType({ a, b -> AndroidChargerMenu(a, b, null as AndroidChargerBlockEntity?) }) }
|
||||||
val BATTERY_BANK: MenuType<BatteryBankMenu> by registry.register(MNames.BATTERY_BANK) { MenuType(::BatteryBankMenu, FeatureFlags.VANILLA_SET) }
|
val BATTERY_BANK: MenuType<BatteryBankMenu> by registry.register(MNames.BATTERY_BANK) { MenuType(::BatteryBankMenu) }
|
||||||
val MATTER_DECOMPOSER: MenuType<MatterDecomposerMenu> by registry.register(MNames.MATTER_DECOMPOSER) { MenuType(::MatterDecomposerMenu, FeatureFlags.VANILLA_SET) }
|
val MATTER_DECOMPOSER: MenuType<MatterDecomposerMenu> by registry.register(MNames.MATTER_DECOMPOSER) { MenuType(::MatterDecomposerMenu) }
|
||||||
val MATTER_CAPACITOR_BANK: MenuType<MatterCapacitorBankMenu> by registry.register(MNames.MATTER_CAPACITOR_BANK) { MenuType(::MatterCapacitorBankMenu, FeatureFlags.VANILLA_SET) }
|
val MATTER_CAPACITOR_BANK: MenuType<MatterCapacitorBankMenu> by registry.register(MNames.MATTER_CAPACITOR_BANK) { MenuType(::MatterCapacitorBankMenu) }
|
||||||
val PATTERN_STORAGE: MenuType<PatternStorageMenu> by registry.register(MNames.PATTERN_STORAGE) { MenuType(::PatternStorageMenu, FeatureFlags.VANILLA_SET) }
|
val PATTERN_STORAGE: MenuType<PatternStorageMenu> by registry.register(MNames.PATTERN_STORAGE) { MenuType(::PatternStorageMenu) }
|
||||||
val MATTER_SCANNER: MenuType<MatterScannerMenu> by registry.register(MNames.MATTER_SCANNER) { MenuType(::MatterScannerMenu, FeatureFlags.VANILLA_SET) }
|
val MATTER_SCANNER: MenuType<MatterScannerMenu> by registry.register(MNames.MATTER_SCANNER) { MenuType(::MatterScannerMenu) }
|
||||||
val MATTER_PANEL: MenuType<MatterPanelMenu> by registry.register(MNames.MATTER_PANEL) { MenuType(::MatterPanelMenu, FeatureFlags.VANILLA_SET) }
|
val MATTER_PANEL: MenuType<MatterPanelMenu> by registry.register(MNames.MATTER_PANEL) { MenuType(::MatterPanelMenu) }
|
||||||
val MATTER_REPLICATOR: MenuType<MatterReplicatorMenu> by registry.register(MNames.MATTER_REPLICATOR) { MenuType(::MatterReplicatorMenu, FeatureFlags.VANILLA_SET) }
|
val MATTER_REPLICATOR: MenuType<MatterReplicatorMenu> by registry.register(MNames.MATTER_REPLICATOR) { MenuType(::MatterReplicatorMenu) }
|
||||||
val MATTER_BOTTLER: MenuType<MatterBottlerMenu> by registry.register(MNames.MATTER_BOTTLER) { MenuType(::MatterBottlerMenu, FeatureFlags.VANILLA_SET) }
|
val MATTER_BOTTLER: MenuType<MatterBottlerMenu> by registry.register(MNames.MATTER_BOTTLER) { MenuType(::MatterBottlerMenu) }
|
||||||
val DRIVE_VIEWER: MenuType<DriveViewerMenu> by registry.register(MNames.DRIVE_VIEWER) { MenuType(::DriveViewerMenu, FeatureFlags.VANILLA_SET) }
|
val DRIVE_VIEWER: MenuType<DriveViewerMenu> by registry.register(MNames.DRIVE_VIEWER) { MenuType(::DriveViewerMenu) }
|
||||||
val CARGO_CRATE: MenuType<CargoCrateMenu> by registry.register(MNames.CARGO_CRATE) { MenuType(::CargoCrateMenu, FeatureFlags.VANILLA_SET) }
|
val CARGO_CRATE: MenuType<CargoCrateMenu> by registry.register(MNames.CARGO_CRATE) { MenuType(::CargoCrateMenu) }
|
||||||
val MINECART_CARGO_CRATE: MenuType<MinecartCargoCrateMenu> by registry.register(MNames.MINECART_CARGO_CRATE) { MenuType(::MinecartCargoCrateMenu, FeatureFlags.VANILLA_SET) }
|
val MINECART_CARGO_CRATE: MenuType<MinecartCargoCrateMenu> by registry.register(MNames.MINECART_CARGO_CRATE) { MenuType(::MinecartCargoCrateMenu) }
|
||||||
val DRIVE_RACK: MenuType<DriveRackMenu> by registry.register(MNames.DRIVE_RACK) { MenuType(::DriveRackMenu, FeatureFlags.VANILLA_SET) }
|
val DRIVE_RACK: MenuType<DriveRackMenu> by registry.register(MNames.DRIVE_RACK) { MenuType(::DriveRackMenu) }
|
||||||
val ITEM_MONITOR: MenuType<ItemMonitorMenu> by registry.register(MNames.ITEM_MONITOR) { MenuType(::ItemMonitorMenu, FeatureFlags.VANILLA_SET) }
|
val ITEM_MONITOR: MenuType<ItemMonitorMenu> by registry.register(MNames.ITEM_MONITOR) { MenuType(::ItemMonitorMenu) }
|
||||||
val ENERGY_COUNTER: MenuType<EnergyCounterMenu> by registry.register(MNames.ENERGY_COUNTER) { MenuType(::EnergyCounterMenu, FeatureFlags.VANILLA_SET) }
|
val ENERGY_COUNTER: MenuType<EnergyCounterMenu> by registry.register(MNames.ENERGY_COUNTER) { MenuType(::EnergyCounterMenu) }
|
||||||
val CHEMICAL_GENERATOR: MenuType<ChemicalGeneratorMenu> by registry.register(MNames.CHEMICAL_GENERATOR) { MenuType(::ChemicalGeneratorMenu, FeatureFlags.VANILLA_SET) }
|
val CHEMICAL_GENERATOR: MenuType<ChemicalGeneratorMenu> by registry.register(MNames.CHEMICAL_GENERATOR) { MenuType(::ChemicalGeneratorMenu) }
|
||||||
val PLATE_PRESS: MenuType<PlatePressMenu> by registry.register(MNames.PLATE_PRESS) { MenuType(::PlatePressMenu, FeatureFlags.VANILLA_SET) }
|
val PLATE_PRESS: MenuType<PlatePressMenu> by registry.register(MNames.PLATE_PRESS) { MenuType(::PlatePressMenu) }
|
||||||
val POWERED_FURNACE: MenuType<PoweredFurnaceMenu> by registry.register(MNames.POWERED_FURNACE) { MenuType(PoweredFurnaceMenu::furnace, FeatureFlags.VANILLA_SET) }
|
val POWERED_FURNACE: MenuType<PoweredFurnaceMenu> by registry.register(MNames.POWERED_FURNACE) { MenuType(PoweredFurnaceMenu::furnace) }
|
||||||
val POWERED_BLAST_FURNACE: MenuType<PoweredFurnaceMenu> by registry.register(MNames.POWERED_BLAST_FURNACE) { MenuType(PoweredFurnaceMenu::blasting, FeatureFlags.VANILLA_SET) }
|
val POWERED_BLAST_FURNACE: MenuType<PoweredFurnaceMenu> by registry.register(MNames.POWERED_BLAST_FURNACE) { MenuType(PoweredFurnaceMenu::blasting) }
|
||||||
val POWERED_SMOKER: MenuType<PoweredFurnaceMenu> by registry.register(MNames.POWERED_SMOKER) { MenuType(PoweredFurnaceMenu::smoking, FeatureFlags.VANILLA_SET) }
|
val POWERED_SMOKER: MenuType<PoweredFurnaceMenu> by registry.register(MNames.POWERED_SMOKER) { MenuType(PoweredFurnaceMenu::smoking) }
|
||||||
val TWIN_PLATE_PRESS: MenuType<TwinPlatePressMenu> by registry.register(MNames.TWIN_PLATE_PRESS) { MenuType(::TwinPlatePressMenu, FeatureFlags.VANILLA_SET) }
|
val TWIN_PLATE_PRESS: MenuType<TwinPlatePressMenu> by registry.register(MNames.TWIN_PLATE_PRESS) { MenuType(::TwinPlatePressMenu) }
|
||||||
val MATTER_RECYCLER: MenuType<MatterRecyclerMenu> by registry.register(MNames.MATTER_RECYCLER) { MenuType(::MatterRecyclerMenu, FeatureFlags.VANILLA_SET) }
|
val MATTER_RECYCLER: MenuType<MatterRecyclerMenu> by registry.register(MNames.MATTER_RECYCLER) { MenuType(::MatterRecyclerMenu) }
|
||||||
val ENERGY_SERVO: MenuType<EnergyServoMenu> by registry.register(MNames.ENERGY_SERVO) { MenuType(::EnergyServoMenu, FeatureFlags.VANILLA_SET) }
|
val ENERGY_SERVO: MenuType<EnergyServoMenu> by registry.register(MNames.ENERGY_SERVO) { MenuType(::EnergyServoMenu) }
|
||||||
val HOLO_SIGN: MenuType<HoloSignMenu> by registry.register(MNames.HOLO_SIGN) { MenuType(::HoloSignMenu, FeatureFlags.VANILLA_SET) }
|
val HOLO_SIGN: MenuType<HoloSignMenu> by registry.register(MNames.HOLO_SIGN) { MenuType(::HoloSignMenu) }
|
||||||
val COBBLESTONE_GENERATOR: MenuType<CobblerMenu> by registry.register(MNames.COBBLESTONE_GENERATOR) { MenuType(::CobblerMenu, FeatureFlags.VANILLA_SET) }
|
val COBBLESTONE_GENERATOR: MenuType<CobblerMenu> by registry.register(MNames.COBBLESTONE_GENERATOR) { MenuType(::CobblerMenu) }
|
||||||
val ESSENCE_STORAGE: MenuType<EssenceStorageMenu> by registry.register(MNames.ESSENCE_STORAGE) { MenuType(::EssenceStorageMenu, FeatureFlags.VANILLA_SET) }
|
val ESSENCE_STORAGE: MenuType<EssenceStorageMenu> by registry.register(MNames.ESSENCE_STORAGE) { MenuType(::EssenceStorageMenu) }
|
||||||
val ITEM_REPAIER: MenuType<MatterReconstructorMenu> by registry.register(MNames.MATTER_RECONSTRUCTOR) { MenuType(::MatterReconstructorMenu, FeatureFlags.VANILLA_SET) }
|
val ITEM_REPAIER: MenuType<MatterReconstructorMenu> by registry.register(MNames.MATTER_RECONSTRUCTOR) { MenuType(::MatterReconstructorMenu) }
|
||||||
val FLUID_TANK: MenuType<FluidTankMenu> by registry.register(MNames.FLUID_TANK) { MenuType(::FluidTankMenu, FeatureFlags.VANILLA_SET) }
|
val FLUID_TANK: MenuType<FluidTankMenu> by registry.register(MNames.FLUID_TANK) { MenuType(::FluidTankMenu) }
|
||||||
val PAINTER: MenuType<PainterMenu> by registry.register(MNames.PAINTER) { MenuType(::PainterMenu, FeatureFlags.VANILLA_SET) }
|
val PAINTER: MenuType<PainterMenu> by registry.register(MNames.PAINTER) { MenuType(::PainterMenu) }
|
||||||
val MATTER_ENTANGLER: MenuType<MatterEntanglerMenu> by registry.register(MNames.MATTER_ENTANGLER) { MenuType(::MatterEntanglerMenu, FeatureFlags.VANILLA_SET) }
|
val MATTER_ENTANGLER: MenuType<MatterEntanglerMenu> by registry.register(MNames.MATTER_ENTANGLER) { MenuType(::MatterEntanglerMenu) }
|
||||||
|
|
||||||
val STORAGE_BUS: MenuType<StorageBusMenu> by registry.register(MNames.STORAGE_BUS) { MenuType(::StorageBusMenu, FeatureFlags.VANILLA_SET) }
|
val STORAGE_BUS: MenuType<StorageBusMenu> by registry.register(MNames.STORAGE_BUS) { MenuType(::StorageBusMenu) }
|
||||||
val STORAGE_IMPORTER_EXPORTER: MenuType<StorageImporterExporterMenu> by registry.register(MNames.STORAGE_IMPORTER) { MenuType(::StorageImporterExporterMenu, FeatureFlags.VANILLA_SET) }
|
val STORAGE_IMPORTER_EXPORTER: MenuType<StorageImporterExporterMenu> by registry.register(MNames.STORAGE_IMPORTER) { MenuType(::StorageImporterExporterMenu) }
|
||||||
val STORAGE_POWER_SUPPLIER: MenuType<StoragePowerSupplierMenu> by registry.register(MNames.STORAGE_POWER_SUPPLIER) { MenuType(::StoragePowerSupplierMenu, FeatureFlags.VANILLA_SET) }
|
val STORAGE_POWER_SUPPLIER: MenuType<StoragePowerSupplierMenu> by registry.register(MNames.STORAGE_POWER_SUPPLIER) { MenuType(::StoragePowerSupplierMenu) }
|
||||||
|
|
||||||
internal fun register(bus: IEventBus) {
|
internal fun register(bus: IEventBus) {
|
||||||
registry.register(bus)
|
registry.register(bus)
|
||||||
|
@ -364,16 +364,8 @@ object MRegistry {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun registerItemDecorators(event: RegisterItemDecorationsEvent) {
|
private fun registerItemDecorators(event: RegisterItemDecorationsEvent) {
|
||||||
event.register(Items.SHIELD, object : IItemDecorator {
|
event.register(Items.SHIELD) { font, stack, xOffset, yOffset, blitOffset -> MatteryGUI.renderShieldCooldownOverlay(PoseStack(), font, stack, xOffset, yOffset) }
|
||||||
override fun render(poseStack: PoseStack, font: Font, stack: ItemStack, xOffset: Int, yOffset: Int): Boolean {
|
|
||||||
return MatteryGUI.renderShieldCooldownOverlay(poseStack, font, stack, xOffset, yOffset)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
event.register(MItems.TRITANIUM_SHIELD, object : IItemDecorator {
|
event.register(MItems.TRITANIUM_SHIELD) { font, stack, xOffset, yOffset, blitOffset -> MatteryGUI.renderShieldCooldownOverlay(PoseStack(), font, stack, xOffset, yOffset) }
|
||||||
override fun render(poseStack: PoseStack, font: Font, stack: ItemStack, xOffset: Int, yOffset: Int): Boolean {
|
|
||||||
return MatteryGUI.renderShieldCooldownOverlay(poseStack, font, stack, xOffset, yOffset)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -106,16 +106,16 @@ abstract class MCriterionTrigger<T : MCriterionTrigger<T>.AbstractInstance>(priv
|
|||||||
@JvmStatic
|
@JvmStatic
|
||||||
protected val predicateCodec: Codec<ContextAwarePredicate> = object : Codec<ContextAwarePredicate> {
|
protected val predicateCodec: Codec<ContextAwarePredicate> = object : Codec<ContextAwarePredicate> {
|
||||||
override fun <T : Any?> encode(input: ContextAwarePredicate, ops: DynamicOps<T>, prefix: T): DataResult<T> {
|
override fun <T : Any?> encode(input: ContextAwarePredicate, ops: DynamicOps<T>, prefix: T): DataResult<T> {
|
||||||
return DataResult.success(JsonOps.INSTANCE.convertTo(ops, input.toJson(serializationContext.get().lastOrNull() ?: return DataResult.error { "Not serializing trigger instance" })))
|
return DataResult.success(JsonOps.INSTANCE.convertTo(ops, input.toJson(serializationContext.get().lastOrNull() ?: return DataResult.error("Not serializing trigger instance"))))
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun <T : Any?> decode(ops: DynamicOps<T>, input: T): DataResult<Pair<ContextAwarePredicate, T>> {
|
override fun <T : Any?> decode(ops: DynamicOps<T>, input: T): DataResult<Pair<ContextAwarePredicate, T>> {
|
||||||
val context = deserializationContext.get().lastOrNull() ?: return DataResult.error { "Not current deserializing trigger instance" }
|
val context = deserializationContext.get().lastOrNull() ?: return DataResult.error("Not current deserializing trigger instance")
|
||||||
|
|
||||||
return try {
|
return try {
|
||||||
DataResult.success(Pair.of(EntityPredicate.Composite.fromJson(JsonObject().also { it["a"] = ops.convertTo(JsonOps.INSTANCE, input) }, "a", context), ops.empty()))
|
DataResult.success(Pair.of(EntityPredicate.Composite.fromJson(JsonObject().also { it["a"] = ops.convertTo(JsonOps.INSTANCE, input) }, "a", context), ops.empty()))
|
||||||
} catch (err: Exception) {
|
} catch (err: Exception) {
|
||||||
DataResult.error { "Failed to deserialize ContextAwarePredicate: " + err.message }
|
DataResult.error("Failed to deserialize ContextAwarePredicate: " + err.message)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ public net.minecraft.client.gui.screens.inventory.AbstractContainerScreen f_9772
|
|||||||
public net.minecraft.client.gui.screens.inventory.AbstractContainerScreen f_97722_ # lastClickButton
|
public net.minecraft.client.gui.screens.inventory.AbstractContainerScreen f_97722_ # lastClickButton
|
||||||
public net.minecraft.client.gui.screens.inventory.AbstractContainerScreen f_97723_ # doubleclick
|
public net.minecraft.client.gui.screens.inventory.AbstractContainerScreen f_97723_ # doubleclick
|
||||||
public net.minecraft.client.gui.screens.inventory.AbstractContainerScreen f_97724_ # lastQuickMoved
|
public net.minecraft.client.gui.screens.inventory.AbstractContainerScreen f_97724_ # lastQuickMoved
|
||||||
public net.minecraft.client.gui.screens.inventory.AbstractContainerScreen m_274323_(Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/world/item/ItemStack;IILjava/lang/String;)V # renderFloatingItem
|
public net.minecraft.client.gui.screens.inventory.AbstractContainerScreen m_97782_(Lnet/minecraft/world/item/ItemStack;IILjava/lang/String;)V # renderFloatingItem
|
||||||
|
|
||||||
public net.minecraft.client.gui.GuiComponent m_168740_(Lcom/mojang/blaze3d/vertex/PoseStack;IIIIIII)V # fillGradient
|
public net.minecraft.client.gui.GuiComponent m_168740_(Lcom/mojang/blaze3d/vertex/PoseStack;IIIIIII)V # fillGradient
|
||||||
public net.minecraft.client.gui.GuiComponent m_93123_(Lorg/joml/Matrix4f;Lcom/mojang/blaze3d/vertex/BufferBuilder;IIIIIII)V # fillGradient
|
public net.minecraft.client.gui.GuiComponent m_93123_(Lorg/joml/Matrix4f;Lcom/mojang/blaze3d/vertex/BufferBuilder;IIIIIII)V # fillGradient
|
||||||
|
Loading…
Reference in New Issue
Block a user