More backporting

This commit is contained in:
DBotThePony 2024-01-01 21:07:43 +07:00
parent df15bd2f69
commit 2a117a540e
Signed by: DBot
GPG Key ID: DCC23B5715498507
34 changed files with 183 additions and 215 deletions

View File

@ -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.core.genericPositions
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.Vector
import ru.dbotthepony.mc.otm.core.math.asVector

View File

@ -1,20 +1,12 @@
package ru.dbotthepony.mc.otm.android.feature
import net.minecraft.ChatFormatting
import net.minecraft.resources.ResourceLocation
import net.minecraft.server.level.ServerPlayer
import net.minecraftforge.event.entity.living.LivingAttackEvent
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.AndroidResearchManager
import ru.dbotthepony.mc.otm.capability.MatteryPlayerCapability
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.MNames
import ru.dbotthepony.mc.otm.triggers.FallDampenersSaveTrigger
class FallDampenersFeature(capability: MatteryPlayerCapability) : AndroidFeature(AndroidFeatures.FALL_DAMPENERS, capability) {

View File

@ -4,12 +4,9 @@ import net.minecraft.nbt.CompoundTag
import net.minecraft.resources.ResourceLocation
import net.minecraft.server.level.ServerPlayer
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.AndroidResearchManager
import ru.dbotthepony.mc.otm.capability.MatteryPlayerCapability
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.registry.AndroidFeatures
import ru.dbotthepony.mc.otm.registry.StatNames

View File

@ -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.ResearchIcons
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.getExplosionResistance
import ru.dbotthepony.mc.otm.core.math.RGBAColor

View File

@ -151,7 +151,7 @@ class MatterEntanglerBlockEntity(blockPos: BlockPos, blockState: BlockState) : M
.values
.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.setChanged()

View File

@ -292,7 +292,7 @@ class ItemMonitorBlockEntity(blockPos: BlockPos, blockState: BlockState) : Matte
override fun getItem(slot: Int): ItemStack {
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 {
@ -305,7 +305,7 @@ class ItemMonitorBlockEntity(blockPos: BlockPos, blockState: BlockState) : Matte
try {
ForgeHooks.setCraftingPlayer(craftingPlayer)
if (craftingRecipe.getResultItem(level.registryAccess()).count != amount) {
if (craftingRecipe.resultItem.count != amount) {
return ItemStack.EMPTY
}
} finally {
@ -331,7 +331,7 @@ class ItemMonitorBlockEntity(blockPos: BlockPos, blockState: BlockState) : Matte
try {
residue = craftingRecipe.getRemainingItems(craftingGrid)
result = craftingRecipe.getResultItem(level.registryAccess())
result = craftingRecipe.resultItem
} finally {
ForgeHooks.setCraftingPlayer(null)
}
@ -398,7 +398,7 @@ class ItemMonitorBlockEntity(blockPos: BlockPos, blockState: BlockState) : Matte
}
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_")
}
}

View File

@ -93,7 +93,7 @@ class PlatePressBlockEntity(
return JobContainer.success(
ItemJob(
recipe.getResultItem(level.registryAccess()).copyWithCount(toProcess),
recipe.getResultItem().copyWithCount(toProcess),
recipe.workTime * MachinesConfig.PLATE_PRESS.workTimeMultiplier,
MachinesConfig.PLATE_PRESS.energyConsumption * toProcess,
experience = recipe.experience.sample(level.random) * toProcess))

View File

@ -136,7 +136,7 @@ class PoweredFurnaceBlockEntity(
}
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)
inputs[id][0].shrink(toProcess)

View File

@ -4,12 +4,12 @@ import net.minecraft.nbt.CompoundTag
import net.minecraft.server.level.ServerPlayer
import net.minecraft.world.entity.player.Player
import net.minecraft.world.item.ItemStack
import net.minecraft.world.ticks.ContainerSingleItem
import net.minecraftforge.common.capabilities.ForgeCapabilities
import net.minecraftforge.common.util.INBTSerializable
import ru.dbotthepony.mc.otm.capability.FlowDirection
import ru.dbotthepony.mc.otm.capability.extractEnergy
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.getDecimal
import ru.dbotthepony.mc.otm.core.nbt.getItemStack
@ -27,7 +27,7 @@ class BatteryBackedEnergyStorage(
maxCharge: Decimal,
val isAndroid: Boolean,
val onChange: Runnable? = null
) : IMatteryEnergyStorage, INBTSerializable<CompoundTag?>, ContainerSingleItem {
) : IMatteryEnergyStorage, INBTSerializable<CompoundTag?>, IContainer {
override val energyFlow: FlowDirection
get() = FlowDirection.INPUT
@ -61,6 +61,22 @@ class BatteryBackedEnergyStorage(
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() {
}

View File

@ -17,7 +17,7 @@ private fun buffer() = buffer
private fun Font.drawInBatch(
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,
rounding: GravityRounding, width: FloatSupplier
): Int {
@ -120,7 +120,7 @@ private fun Font.drawInternal(
scale: Float,
color: RGBAColor,
drawShadow: Boolean,
displayMode: Font.DisplayMode,
displayMode: Boolean,
packedLightCoords: Int,
effectColor: Int,
shadowColor: RGBAColor,
@ -239,7 +239,7 @@ fun Font.draw(
scale: Float = 1f,
color: RGBAColor = RGBAColor.WHITE,
drawShadow: Boolean = false,
displayMode: Font.DisplayMode = Font.DisplayMode.NORMAL,
displayMode: Boolean = false,
packedLightCoords: Int = 15728880,
effectColor: Int = 0,
shadowColor: RGBAColor = RGBAColor.BLACK,
@ -287,7 +287,7 @@ fun Font.draw(
scale: Float = 1f,
color: RGBAColor = RGBAColor.WHITE,
drawShadow: Boolean = false,
displayMode: Font.DisplayMode = Font.DisplayMode.NORMAL,
displayMode: Boolean = false,
packedLightCoords: Int = 15728880,
effectColor: Int = 0,
shadowColor: RGBAColor = RGBAColor.BLACK,
@ -335,7 +335,7 @@ fun Font.draw(
scale: Float = 1f,
color: RGBAColor = RGBAColor.WHITE,
drawShadow: Boolean = false,
displayMode: Font.DisplayMode = Font.DisplayMode.NORMAL,
displayMode: Boolean = false,
packedLightCoords: Int = 15728880,
effectColor: Int = 0,
shadowColor: RGBAColor = RGBAColor.BLACK,

View File

@ -35,7 +35,7 @@ class MGUIGraphics(val pose: PoseStack) {
}
fun renderFakeItem(itemStack: ItemStack, x: Int, y: Int) {
minecraft.itemRenderer.renderGuiItem(pose, itemStack, x, y)
minecraft.itemRenderer.renderGuiItem(itemStack, x, y)
}
fun drawLine(
@ -130,7 +130,9 @@ class MGUIGraphics(val pose: PoseStack) {
for (i in mapped.indices) {
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
}

View File

@ -3,9 +3,9 @@ package ru.dbotthepony.mc.otm.client.render.blockentity
import com.mojang.blaze3d.vertex.PoseStack
import com.mojang.math.Axis
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.BlockEntityRendererProvider
import net.minecraft.world.item.ItemDisplayContext
import ru.dbotthepony.mc.otm.block.entity.matter.MatterReconstructorBlockEntity
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.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()
}

View File

@ -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.BlockEntityRendererProvider
import net.minecraft.core.particles.DustParticleOptions
import net.minecraft.world.item.ItemDisplayContext
import net.minecraft.world.level.levelgen.XoroshiroRandomSource
import org.joml.Vector3f
import org.lwjgl.opengl.GL14.glBlendColor
@ -80,7 +79,7 @@ class MatterReplicatorRenderer(private val context: BlockEntityRendererProvider.
context.itemRenderer.render(
item,
ItemDisplayContext.NONE,
ItemTransforms.TransformType.NONE,
false,
pose,
source,

View File

@ -5,9 +5,9 @@ import com.mojang.blaze3d.systems.RenderSystem
import com.mojang.blaze3d.vertex.PoseStack
import com.mojang.math.Axis
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.BlockEntityRendererProvider
import net.minecraft.world.item.ItemDisplayContext
import ru.dbotthepony.mc.otm.block.entity.matter.MatterScannerBlockEntity
import ru.dbotthepony.mc.otm.client.render.DynamicBufferSource
import ru.dbotthepony.mc.otm.client.render.lockBlendFunc
@ -41,12 +41,11 @@ class MatterScannerRenderer(private val context: BlockEntityRendererProvider.Con
context.itemRenderer.renderStatic(
item,
ItemDisplayContext.FIXED,
ItemTransforms.TransformType.FIXED,
packedLight,
packedOverlay,
pose,
source,
tile.level,
tile.blockPos.asLong().toInt()
)

View File

@ -12,7 +12,6 @@ import net.minecraft.network.chat.Component
import net.minecraft.world.entity.player.Inventory
import net.minecraft.world.inventory.Slot
import net.minecraft.world.item.Item
import net.minecraft.world.item.ItemDisplayContext
import net.minecraft.world.item.ItemStack
import net.minecraftforge.client.event.ContainerScreenEvent.Render.Background
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.render.WidgetLocation
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.button.DeviceControls
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.config.ClientConfig
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.menu.MatteryMenu
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 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) {
RenderSystem.enableDepthTest()
itemRenderer.renderGuiItem(graphics.pose, itemstack, 1, 1)
RenderSystem.depthFunc(GL11.GL_ALWAYS)
itemRenderer.renderGuiItemDecorations(
graphics.pose,
super.font,
val systemPoseStack = RenderSystem.getModelViewStack()
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,
1,
1,
countOverride
0,
0,
(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")
renderFloatingItem(poseStack, itemstack, mouseX - 8, mouseY - i2, overrideCount)
renderFloatingItem(itemstack, mouseX - 8, mouseY - i2, overrideCount)
}
if (menu.carried.isEmpty) {

View File

@ -5,11 +5,8 @@ import com.mojang.blaze3d.platform.InputConstants
import com.mojang.blaze3d.systems.RenderSystem
import it.unimi.dsi.fastutil.ints.IntAVLTreeSet
import it.unimi.dsi.fastutil.objects.ReferenceArraySet
import net.minecraft.client.gui.ComponentPath
import net.minecraft.client.gui.Font
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.renderer.Rect2i
import net.minecraft.network.chat.Component
@ -78,17 +75,15 @@ open class EditablePanel<out S : Screen> @JvmOverloads constructor(
) : Comparable<EditablePanel<*>> {
// layout engine does not support navigation using keyboard
val listener: GuiEventListener = object : GuiEventListener {
override fun setFocused(p_265728_: Boolean) {
override fun changeFocus(p_265728_: Boolean): Boolean {
if (p_265728_) {
if (isVisible())
requestFocus()
} else {
killFocus()
}
}
override fun isFocused(): Boolean {
return isEverFocused()
return true
}
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_)
}
override fun nextFocusPath(p_265234_: FocusNavigationEvent): ComponentPath? {
return null
}
override fun isMouseOver(p_94748_: Double, p_94749_: Double): Boolean {
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())
}
}
/**

View File

@ -170,15 +170,14 @@ class EntityRendererPanel<out S : Screen> @JvmOverloads constructor(
return
}
val renderX = width.toInt() / 2
val renderY = (height * 0.9f).toInt()
val renderX = absoluteX.toInt() + width.toInt() / 2
val renderY = absoluteY.toInt() + (height * 0.9f).toInt()
InventoryScreen.renderEntityInInventoryFollowsMouse(
graphics.pose,
InventoryScreen.renderEntityInInventory(
renderX,
renderY,
renderScale,
absoluteX.toInt() + renderX - mouseX,
renderX - mouseX,
absoluteY + height * 0.15f - mouseY,
entity
)

View File

@ -12,22 +12,22 @@ import ru.dbotthepony.mc.otm.OverdriveThatMatters
import ru.dbotthepony.mc.otm.registry.MItemTags
private object SimpleTritaniumArmorMaterial : ArmorMaterial {
override fun getDurabilityForType(p_40410_: ArmorItem.Type): Int {
override fun getDurabilityForSlot(p_40410_: EquipmentSlot): Int {
return when (p_40410_) {
ArmorItem.Type.HELMET -> 380
ArmorItem.Type.CHESTPLATE -> 590
ArmorItem.Type.LEGGINGS -> 500
ArmorItem.Type.BOOTS -> 420
EquipmentSlot.HEAD -> 380
EquipmentSlot.CHEST -> 590
EquipmentSlot.LEGS -> 500
EquipmentSlot.FEET -> 420
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_) {
ArmorItem.Type.HELMET -> 2
ArmorItem.Type.CHESTPLATE -> 6
ArmorItem.Type.LEGGINGS -> 7
ArmorItem.Type.BOOTS -> 2
EquipmentSlot.HEAD -> 2
EquipmentSlot.CHEST -> 6
EquipmentSlot.LEGS -> 7
EquipmentSlot.FEET -> 2
else -> throw IllegalArgumentException("yo dude what the fuck $p_40411_")
}
}
@ -43,7 +43,7 @@ private object SimpleTritaniumArmorMaterial : ArmorMaterial {
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? {
if (type != "overlay" || slot == EquipmentSlot.FEET)
return when (slot) {

View File

@ -3,7 +3,7 @@ package ru.dbotthepony.mc.otm.item.armor
import net.minecraft.client.model.HumanoidModel
import net.minecraft.sounds.SoundEvent
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.EquipmentSlot
import net.minecraft.world.entity.LivingEntity
@ -19,21 +19,23 @@ import ru.dbotthepony.mc.otm.registry.MItems
import java.util.function.Consumer
private object TritaniumArmorMaterial : ArmorMaterial {
override fun getDurabilityForType(p_40410_: ArmorItem.Type): Int {
override fun getDurabilityForSlot(p_40410_: EquipmentSlot): Int {
return when (p_40410_) {
ArmorItem.Type.HELMET -> 520
ArmorItem.Type.CHESTPLATE -> 920
ArmorItem.Type.LEGGINGS -> 650
ArmorItem.Type.BOOTS -> 540
EquipmentSlot.HEAD -> 520
EquipmentSlot.CHEST -> 920
EquipmentSlot.LEGS -> 650
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_) {
ArmorItem.Type.HELMET -> 4
ArmorItem.Type.CHESTPLATE -> 9
ArmorItem.Type.LEGGINGS -> 7
ArmorItem.Type.BOOTS -> 3
EquipmentSlot.HEAD -> 4
EquipmentSlot.CHEST -> 9
EquipmentSlot.LEGS -> 7
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>) {
super.initializeClient(consumer)
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"
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 (
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 }

View File

@ -18,8 +18,6 @@ import ru.dbotthepony.mc.otm.config.ServerConfig
import ru.dbotthepony.mc.otm.capability.matteryPlayer
import ru.dbotthepony.mc.otm.client.minecraft
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.runIfClient
import ru.dbotthepony.mc.otm.triggers.ExopackSlotsExpandedTrigger

View File

@ -3,13 +3,13 @@ package ru.dbotthepony.mc.otm.item.weapon
import com.mojang.blaze3d.systems.RenderSystem
import net.minecraft.client.Minecraft
import net.minecraft.client.model.HumanoidModel
import net.minecraft.client.renderer.block.model.ItemTransforms
import net.minecraft.nbt.CompoundTag
import net.minecraft.network.FriendlyByteBuf
import net.minecraft.server.level.ServerPlayer
import net.minecraft.world.entity.Entity
import net.minecraft.world.entity.player.Player
import net.minecraft.world.item.Item
import net.minecraft.world.item.ItemDisplayContext
import net.minecraft.world.item.ItemStack
import net.minecraft.world.item.Rarity
import net.minecraft.world.level.block.state.BlockState
@ -429,7 +429,7 @@ abstract class AbstractWeaponItem<D : WeaponDataTable>(val tables: KClass<D>, pr
itemInHandRenderer.renderItem(
player,
stack,
ItemDisplayContext.FIRST_PERSON_RIGHT_HAND,
ItemTransforms.TransformType.FIRST_PERSON_RIGHT_HAND,
false,
pose,
event.multiBufferSource,

View File

@ -112,10 +112,10 @@ class ComputeAction(
try {
DataResult.success(Pair(Constant(Decimal(it.substring(1).trim()), it.substring(1).trim().toDouble(), fn, fn), ops.empty()))
} 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 {
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 {
DataResult.success(Pair(Constant(Decimal(it.toString()), it.toDouble(), IMatterFunction.PLUS, IMatterFunction.PLUS), ops.empty()))
} catch (err: NumberFormatException) {
DataResult.error { "Not a number: $it" }
DataResult.error("Not a number: $it")
}
}
@ -146,7 +146,7 @@ class ComputeAction(
try {
DataResult.success(Pair(Constant(Decimal(it), it.toDouble(), IMatterFunction.PLUS, IMatterFunction.PLUS), ops.empty()))
} catch (err: NumberFormatException) {
DataResult.error { "Not a number: $it" }
DataResult.error("Not a number: $it")
}
}
}

View File

@ -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) {
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 {
return super.mayPlace(itemStack) && itemStack.canEquip(type, inventory.player)
}
@ -327,12 +321,6 @@ abstract class MatteryMenu(
autoCreateInventoryFrame = autoFrame
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> {
return Pair.of(InventoryMenu.BLOCK_ATLAS, InventoryMenu.EMPTY_ARMOR_SLOT_SHIELD)
}
@ -602,7 +590,7 @@ abstract class MatteryMenu(
val copy = source.item.copy()
if (remainder.isEmpty) {
source.setByPlayer(ItemStack.EMPTY)
source.set(ItemStack.EMPTY)
source.onTake(player, copy)
} else {
copy.count = source.item.count - remainder.count
@ -662,7 +650,7 @@ abstract class MatteryMenu(
val newCount = copy.count.coerceAtMost(limit)
if (!simulate) {
slot.setByPlayer(copy.copy().also { it.count = newCount })
slot.set(copy.copy().also { it.count = newCount })
slot.setChanged()
}

View File

@ -141,7 +141,7 @@ class PainterMenu(
if (recipe == null || !recipe.value.canCraft(dyeStoredDirect) || !recipe.value.matches(inputContainer, inventory.player.level)) {
outputContainer.clearContent()
} else {
outputContainer[0] = recipe.value.assemble(inputContainer, inventory.player.level.registryAccess())
outputContainer[0] = recipe.value.assemble(inputContainer)
lastRecipe = recipe
}
}

View File

@ -40,7 +40,7 @@ class ExplosiveHammerPrimingRecipe(val payload: Ingredient, private val id: Reso
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()
if (hammer.isEmpty) return ItemStack.EMPTY
@ -53,7 +53,7 @@ class ExplosiveHammerPrimingRecipe(val payload: Ingredient, private val id: Reso
return pWidth * pHeight >= 3
}
override fun getResultItem(registry: RegistryAccess): ItemStack {
override fun getResultItem(): ItemStack {
return ItemStack.EMPTY
}

View File

@ -65,7 +65,7 @@ open class MatterEntanglerRecipe(
return ingredients.preemptiveTest(container)
}
override fun assemble(container: CraftingContainer, registry: RegistryAccess): ItemStack {
override fun assemble(container: CraftingContainer): ItemStack {
return result.copy().also {
it.tagNotNull[uuidKey] = fixedUuid.getOrElse { UUID.randomUUID() }
}
@ -75,7 +75,7 @@ open class MatterEntanglerRecipe(
return width >= ingredients.width && height >= ingredients.height
}
override fun getResultItem(registry: RegistryAccess): ItemStack {
override fun getResultItem(): ItemStack {
return result
}
@ -111,8 +111,8 @@ open class MatterEntanglerRecipe(
fun matter() = Matter(this)
open class Energy(val parent: MatterEntanglerRecipe) : IMatterEntanglerRecipe by parent {
override fun assemble(container: CraftingContainer, registry: RegistryAccess): ItemStack {
return parent.assemble(container, registry).also { result ->
override fun assemble(container: CraftingContainer): ItemStack {
return parent.assemble(container).also { result ->
container.iterator().map { it.matteryEnergy }.filterNotNull().forEach {
result.matteryEnergy!!.batteryLevel += it.batteryLevel
}
@ -129,8 +129,8 @@ open class MatterEntanglerRecipe(
}
open class Matter(val parent: MatterEntanglerRecipe) : IMatterEntanglerRecipe by parent {
override fun assemble(container: CraftingContainer, registry: RegistryAccess): ItemStack {
return parent.assemble(container, registry).also { result ->
override fun assemble(container: CraftingContainer): ItemStack {
return parent.assemble(container).also { result ->
container.iterator().map { it.matter }.filterNotNull().forEach {
result.matter!!.storedMatter += it.storedMatter
}

View File

@ -42,8 +42,8 @@ class UpgradeRecipe(
return parent.recipe.canCraftInDimensions(p_43999_, p_44000_)
}
override fun getResultItem(p_267052_: RegistryAccess): ItemStack {
return parent.recipe.getResultItem(p_267052_)
override fun getResultItem(): ItemStack {
return parent.recipe.resultItem
}
override fun getRemainingItems(p_44004_: CraftingContainer): NonNullList<ItemStack> {
@ -58,10 +58,6 @@ class UpgradeRecipe(
return parent.recipe.isSpecial
}
override fun showNotification(): Boolean {
return parent.recipe.showNotification()
}
override fun getGroup(): String {
return parent.recipe.group
}
@ -184,8 +180,8 @@ class UpgradeRecipe(
val copyPaths: ImmutableList<Op> = copyPaths.collect(ImmutableList.toImmutableList())
override fun assemble(pInv: CraftingContainer, registryAccess: RegistryAccess): ItemStack {
val result = parent.recipe.assemble(pInv, registryAccess)
override fun assemble(pInv: CraftingContainer): ItemStack {
val result = parent.recipe.assemble(pInv)
if (result.isEmpty) {
return result

View File

@ -280,7 +280,7 @@ object MCreativeTabs {
it.icon { ItemStack(BATTERY_CREATIVE, 1) }
it.title(TranslatableComponent("itemGroup.otm"))
it.displayItems { _, consumer ->
it.displayItems { _, consumer, hasPerms ->
addMainCreativeTabItems(consumer)
}
}
@ -289,7 +289,7 @@ object MCreativeTabs {
it.icon { ItemStack(MRegistry.VENT.item, 1) }
it.title(TranslatableComponent("itemGroup.otm_decorative"))
it.displayItems { _, consumer ->
it.displayItems { _, consumer, hasPerms ->
addDecorativeTabItems(consumer)
}
}

View File

@ -1,24 +1,18 @@
package ru.dbotthepony.mc.otm.registry
import net.minecraft.core.registries.Registries
import net.minecraft.resources.ResourceKey
import net.minecraft.resources.ResourceLocation
import net.minecraft.world.damagesource.DamageType
import ru.dbotthepony.mc.otm.OverdriveThatMatters
import net.minecraft.world.damagesource.DamageSource
object MDamageTypes {
private fun register(name: String): ResourceKey<DamageType> = ResourceKey.create(Registries.DAMAGE_TYPE, ResourceLocation(OverdriveThatMatters.MOD_ID, name))
val BECOME_ANDROID = register("become_android")
val BECOME_HUMANE = register("become_humane")
val EVENT_HORIZON = register("event_horizon")
val HAWKING_RADIATION = register("hawking_radiation")
val EXOPACK_PROBE = register("exopack_probe")
val EMP = register("emp")
val SHOCKWAVE = register("shockwave")
val PLASMA = register("plasma")
val COSMIC_RAYS = register("cosmic_rays")
val EXPLOSIVE_HAMMER = register("explosive_hammer")
val HAMMER_NAIL = register("hammer_nail")
val ANDROID_DISCHARGE = register("android_discharge")
val BECOME_ANDROID = DamageSource("become_android")
val BECOME_HUMANE = DamageSource("become_humane")
val EVENT_HORIZON = DamageSource("event_horizon")
val HAWKING_RADIATION = DamageSource("hawking_radiation")
val EXOPACK_PROBE = DamageSource("exopack_probe")
val EMP = DamageSource("emp")
val SHOCKWAVE = DamageSource("shockwave")
val PLASMA = DamageSource("plasma")
val COSMIC_RAYS = DamageSource("cosmic_rays")
val EXPLOSIVE_HAMMER = DamageSource("explosive_hammer")
val HAMMER_NAIL = DamageSource("hammer_nail")
val ANDROID_DISCHARGE = DamageSource("android_discharge")
}

View File

@ -4,6 +4,7 @@ package ru.dbotthepony.mc.otm.registry
import net.minecraft.ChatFormatting
import net.minecraft.network.chat.Component
import net.minecraft.resources.ResourceLocation
import net.minecraft.world.entity.EquipmentSlot
import net.minecraft.world.food.FoodProperties
import net.minecraft.world.item.*
import net.minecraft.world.item.crafting.Ingredient
@ -341,15 +342,15 @@ object MItems {
::TRITANIUM_SHEARS,
)
val TRITANIUM_HELMET: TritaniumArmorItem by registry.register(MNames.TRITANIUM_HELMET) { TritaniumArmorItem(ArmorItem.Type.HELMET) }
val TRITANIUM_CHESTPLATE: TritaniumArmorItem by registry.register(MNames.TRITANIUM_CHESTPLATE) { TritaniumArmorItem(ArmorItem.Type.CHESTPLATE) }
val TRITANIUM_PANTS: TritaniumArmorItem by registry.register(MNames.TRITANIUM_PANTS) { TritaniumArmorItem(ArmorItem.Type.LEGGINGS) }
val TRITANIUM_BOOTS: TritaniumArmorItem by registry.register(MNames.TRITANIUM_BOOTS) { TritaniumArmorItem(ArmorItem.Type.BOOTS) }
val TRITANIUM_HELMET: TritaniumArmorItem by registry.register(MNames.TRITANIUM_HELMET) { TritaniumArmorItem(EquipmentSlot.HEAD) }
val TRITANIUM_CHESTPLATE: TritaniumArmorItem by registry.register(MNames.TRITANIUM_CHESTPLATE) { TritaniumArmorItem(EquipmentSlot.CHEST) }
val TRITANIUM_PANTS: TritaniumArmorItem by registry.register(MNames.TRITANIUM_PANTS) { TritaniumArmorItem(EquipmentSlot.LEGS) }
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_CHESTPLATE: SimpleTritaniumArmorItem by registry.register(MNames.SIMPLE_TRITANIUM_CHESTPLATE) { SimpleTritaniumArmorItem(ArmorItem.Type.CHESTPLATE) }
val SIMPLE_TRITANIUM_PANTS: SimpleTritaniumArmorItem by registry.register(MNames.SIMPLE_TRITANIUM_PANTS) { SimpleTritaniumArmorItem(ArmorItem.Type.LEGGINGS) }
val SIMPLE_TRITANIUM_BOOTS: SimpleTritaniumArmorItem by registry.register(MNames.SIMPLE_TRITANIUM_BOOTS) { SimpleTritaniumArmorItem(ArmorItem.Type.BOOTS) }
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(EquipmentSlot.CHEST) }
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(EquipmentSlot.FEET) }
val TRITANIUM_ARMOR = SupplierList(
::TRITANIUM_HELMET,

View File

@ -77,41 +77,41 @@ import ru.dbotthepony.mc.otm.menu.tech.TwinPlatePressMenu
object MMenus {
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_CHARGER: MenuType<AndroidChargerMenu> by registry.register(MNames.ANDROID_CHARGER) { MenuType({ a, b -> AndroidChargerMenu(a, b, null as AndroidChargerBlockEntity?) }, FeatureFlags.VANILLA_SET) }
val BATTERY_BANK: MenuType<BatteryBankMenu> by registry.register(MNames.BATTERY_BANK) { MenuType(::BatteryBankMenu, FeatureFlags.VANILLA_SET) }
val MATTER_DECOMPOSER: MenuType<MatterDecomposerMenu> by registry.register(MNames.MATTER_DECOMPOSER) { MenuType(::MatterDecomposerMenu, FeatureFlags.VANILLA_SET) }
val MATTER_CAPACITOR_BANK: MenuType<MatterCapacitorBankMenu> by registry.register(MNames.MATTER_CAPACITOR_BANK) { MenuType(::MatterCapacitorBankMenu, FeatureFlags.VANILLA_SET) }
val PATTERN_STORAGE: MenuType<PatternStorageMenu> by registry.register(MNames.PATTERN_STORAGE) { MenuType(::PatternStorageMenu, FeatureFlags.VANILLA_SET) }
val MATTER_SCANNER: MenuType<MatterScannerMenu> by registry.register(MNames.MATTER_SCANNER) { MenuType(::MatterScannerMenu, FeatureFlags.VANILLA_SET) }
val MATTER_PANEL: MenuType<MatterPanelMenu> by registry.register(MNames.MATTER_PANEL) { MenuType(::MatterPanelMenu, FeatureFlags.VANILLA_SET) }
val MATTER_REPLICATOR: MenuType<MatterReplicatorMenu> by registry.register(MNames.MATTER_REPLICATOR) { MenuType(::MatterReplicatorMenu, FeatureFlags.VANILLA_SET) }
val MATTER_BOTTLER: MenuType<MatterBottlerMenu> by registry.register(MNames.MATTER_BOTTLER) { MenuType(::MatterBottlerMenu, FeatureFlags.VANILLA_SET) }
val DRIVE_VIEWER: MenuType<DriveViewerMenu> by registry.register(MNames.DRIVE_VIEWER) { MenuType(::DriveViewerMenu, FeatureFlags.VANILLA_SET) }
val CARGO_CRATE: MenuType<CargoCrateMenu> by registry.register(MNames.CARGO_CRATE) { MenuType(::CargoCrateMenu, FeatureFlags.VANILLA_SET) }
val MINECART_CARGO_CRATE: MenuType<MinecartCargoCrateMenu> by registry.register(MNames.MINECART_CARGO_CRATE) { MenuType(::MinecartCargoCrateMenu, FeatureFlags.VANILLA_SET) }
val DRIVE_RACK: MenuType<DriveRackMenu> by registry.register(MNames.DRIVE_RACK) { MenuType(::DriveRackMenu, FeatureFlags.VANILLA_SET) }
val ITEM_MONITOR: MenuType<ItemMonitorMenu> by registry.register(MNames.ITEM_MONITOR) { MenuType(::ItemMonitorMenu, FeatureFlags.VANILLA_SET) }
val ENERGY_COUNTER: MenuType<EnergyCounterMenu> by registry.register(MNames.ENERGY_COUNTER) { MenuType(::EnergyCounterMenu, FeatureFlags.VANILLA_SET) }
val CHEMICAL_GENERATOR: MenuType<ChemicalGeneratorMenu> by registry.register(MNames.CHEMICAL_GENERATOR) { MenuType(::ChemicalGeneratorMenu, FeatureFlags.VANILLA_SET) }
val PLATE_PRESS: MenuType<PlatePressMenu> by registry.register(MNames.PLATE_PRESS) { MenuType(::PlatePressMenu, FeatureFlags.VANILLA_SET) }
val POWERED_FURNACE: MenuType<PoweredFurnaceMenu> by registry.register(MNames.POWERED_FURNACE) { MenuType(PoweredFurnaceMenu::furnace, FeatureFlags.VANILLA_SET) }
val POWERED_BLAST_FURNACE: MenuType<PoweredFurnaceMenu> by registry.register(MNames.POWERED_BLAST_FURNACE) { MenuType(PoweredFurnaceMenu::blasting, FeatureFlags.VANILLA_SET) }
val POWERED_SMOKER: MenuType<PoweredFurnaceMenu> by registry.register(MNames.POWERED_SMOKER) { MenuType(PoweredFurnaceMenu::smoking, FeatureFlags.VANILLA_SET) }
val TWIN_PLATE_PRESS: MenuType<TwinPlatePressMenu> by registry.register(MNames.TWIN_PLATE_PRESS) { MenuType(::TwinPlatePressMenu, FeatureFlags.VANILLA_SET) }
val MATTER_RECYCLER: MenuType<MatterRecyclerMenu> by registry.register(MNames.MATTER_RECYCLER) { MenuType(::MatterRecyclerMenu, FeatureFlags.VANILLA_SET) }
val ENERGY_SERVO: MenuType<EnergyServoMenu> by registry.register(MNames.ENERGY_SERVO) { MenuType(::EnergyServoMenu, FeatureFlags.VANILLA_SET) }
val HOLO_SIGN: MenuType<HoloSignMenu> by registry.register(MNames.HOLO_SIGN) { MenuType(::HoloSignMenu, FeatureFlags.VANILLA_SET) }
val COBBLESTONE_GENERATOR: MenuType<CobblerMenu> by registry.register(MNames.COBBLESTONE_GENERATOR) { MenuType(::CobblerMenu, FeatureFlags.VANILLA_SET) }
val ESSENCE_STORAGE: MenuType<EssenceStorageMenu> by registry.register(MNames.ESSENCE_STORAGE) { MenuType(::EssenceStorageMenu, FeatureFlags.VANILLA_SET) }
val ITEM_REPAIER: MenuType<MatterReconstructorMenu> by registry.register(MNames.MATTER_RECONSTRUCTOR) { MenuType(::MatterReconstructorMenu, FeatureFlags.VANILLA_SET) }
val FLUID_TANK: MenuType<FluidTankMenu> by registry.register(MNames.FLUID_TANK) { MenuType(::FluidTankMenu, FeatureFlags.VANILLA_SET) }
val PAINTER: MenuType<PainterMenu> by registry.register(MNames.PAINTER) { MenuType(::PainterMenu, FeatureFlags.VANILLA_SET) }
val MATTER_ENTANGLER: MenuType<MatterEntanglerMenu> by registry.register(MNames.MATTER_ENTANGLER) { MenuType(::MatterEntanglerMenu, 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?) }) }
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) }
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) }
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) }
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) }
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) }
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) }
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) }
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) }
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) }
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) }
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) }
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) }
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) }
val FLUID_TANK: MenuType<FluidTankMenu> by registry.register(MNames.FLUID_TANK) { MenuType(::FluidTankMenu) }
val PAINTER: MenuType<PainterMenu> by registry.register(MNames.PAINTER) { MenuType(::PainterMenu) }
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_IMPORTER_EXPORTER: MenuType<StorageImporterExporterMenu> by registry.register(MNames.STORAGE_IMPORTER) { MenuType(::StorageImporterExporterMenu, FeatureFlags.VANILLA_SET) }
val STORAGE_POWER_SUPPLIER: MenuType<StoragePowerSupplierMenu> by registry.register(MNames.STORAGE_POWER_SUPPLIER) { MenuType(::StoragePowerSupplierMenu, 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) }
val STORAGE_POWER_SUPPLIER: MenuType<StoragePowerSupplierMenu> by registry.register(MNames.STORAGE_POWER_SUPPLIER) { MenuType(::StoragePowerSupplierMenu) }
internal fun register(bus: IEventBus) {
registry.register(bus)

View File

@ -364,16 +364,8 @@ object MRegistry {
}
private fun registerItemDecorators(event: RegisterItemDecorationsEvent) {
event.register(Items.SHIELD, object : IItemDecorator {
override fun render(poseStack: PoseStack, font: Font, stack: ItemStack, xOffset: Int, yOffset: Int): Boolean {
return MatteryGUI.renderShieldCooldownOverlay(poseStack, font, stack, xOffset, yOffset)
}
})
event.register(Items.SHIELD) { font, stack, xOffset, yOffset, blitOffset -> MatteryGUI.renderShieldCooldownOverlay(PoseStack(), font, stack, xOffset, yOffset) }
event.register(MItems.TRITANIUM_SHIELD, object : IItemDecorator {
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) { font, stack, xOffset, yOffset, blitOffset -> MatteryGUI.renderShieldCooldownOverlay(PoseStack(), font, stack, xOffset, yOffset) }
}
}

View File

@ -106,16 +106,16 @@ abstract class MCriterionTrigger<T : MCriterionTrigger<T>.AbstractInstance>(priv
@JvmStatic
protected val predicateCodec: Codec<ContextAwarePredicate> = object : Codec<ContextAwarePredicate> {
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>> {
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 {
DataResult.success(Pair.of(EntityPredicate.Composite.fromJson(JsonObject().also { it["a"] = ops.convertTo(JsonOps.INSTANCE, input) }, "a", context), ops.empty()))
} catch (err: Exception) {
DataResult.error { "Failed to deserialize ContextAwarePredicate: " + err.message }
DataResult.error("Failed to deserialize ContextAwarePredicate: " + err.message)
}
}
}

View File

@ -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_97723_ # doubleclick
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_93123_(Lorg/joml/Matrix4f;Lcom/mojang/blaze3d/vertex/BufferBuilder;IIIIIII)V # fillGradient