Some backporting

This commit is contained in:
DBotThePony 2024-01-01 17:18:57 +07:00
parent 45dd3e5c4b
commit 0a5ae54614
Signed by: DBot
GPG Key ID: DCC23B5715498507
8 changed files with 14 additions and 33 deletions

View File

@ -3,12 +3,12 @@ package ru.dbotthepony.mc.otm.client.render.blockentity
import com.mojang.blaze3d.vertex.* import com.mojang.blaze3d.vertex.*
import com.mojang.math.Axis import com.mojang.math.Axis
import net.minecraft.client.renderer.* import net.minecraft.client.renderer.*
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.client.renderer.entity.ItemRenderer import net.minecraft.client.renderer.entity.ItemRenderer
import net.minecraft.world.inventory.InventoryMenu import net.minecraft.world.inventory.InventoryMenu
import net.minecraft.world.item.BlockItem import net.minecraft.world.item.BlockItem
import net.minecraft.world.item.ItemDisplayContext
import net.minecraft.world.item.ItemStack import net.minecraft.world.item.ItemStack
import net.minecraft.world.level.block.HalfTransparentBlock import net.minecraft.world.level.block.HalfTransparentBlock
import net.minecraft.world.level.block.StainedGlassPaneBlock import net.minecraft.world.level.block.StainedGlassPaneBlock
@ -38,7 +38,7 @@ class FluidTankRenderer(private val context: BlockEntityRendererProvider.Context
object FluidTankItemRenderer : BlockEntityWithoutLevelRenderer(minecraft.blockEntityRenderDispatcher, minecraft.entityModels) { object FluidTankItemRenderer : BlockEntityWithoutLevelRenderer(minecraft.blockEntityRenderDispatcher, minecraft.entityModels) {
override fun renderByItem( override fun renderByItem(
stack: ItemStack, stack: ItemStack,
displayContext: ItemDisplayContext, displayContext: ItemTransforms.TransformType,
poseStack: PoseStack, poseStack: PoseStack,
bufferSource: MultiBufferSource, bufferSource: MultiBufferSource,
packedLight: Int, packedLight: Int,
@ -51,7 +51,7 @@ class FluidTankRenderer(private val context: BlockEntityRendererProvider.Context
} }
val hasFoil = stack.hasFoil() val hasFoil = stack.hasFoil()
val fabulous = displayContext == ItemDisplayContext.GUI val fabulous = displayContext == ItemTransforms.TransformType.GUI
|| displayContext.firstPerson() || displayContext.firstPerson()
|| (stack.item is BlockItem && ((stack.item as BlockItem).block is HalfTransparentBlock || (stack.item as BlockItem).block is StainedGlassPaneBlock)) || (stack.item is BlockItem && ((stack.item as BlockItem).block is HalfTransparentBlock || (stack.item as BlockItem).block is StainedGlassPaneBlock))

View File

@ -63,10 +63,6 @@ class DynamicallyProxiedContainer(private val toProxy: Supplier<Container>) : IC
return toProxy.get().canPlaceItem(slot, itemStack) return toProxy.get().canPlaceItem(slot, itemStack)
} }
override fun canTakeItem(container: Container, slot: Int, itemStack: ItemStack): Boolean {
return toProxy.get().canTakeItem(container, slot, itemStack)
}
override fun countItem(item: Item): Int { override fun countItem(item: Item): Int {
return toProxy.get().countItem(item) return toProxy.get().countItem(item)
} }

View File

@ -26,10 +26,6 @@ interface IContainer : Container {
return super.canPlaceItem(slot, itemStack) return super.canPlaceItem(slot, itemStack)
} }
override fun canTakeItem(container: Container, slot: Int, itemStack: ItemStack): Boolean {
return super.canTakeItem(container, slot, itemStack)
}
override fun countItem(item: Item): Int { override fun countItem(item: Item): Int {
return super.countItem(item) return super.countItem(item)
} }
@ -74,10 +70,6 @@ interface IContainer : Container {
return container.canPlaceItem(slot, itemStack) return container.canPlaceItem(slot, itemStack)
} }
override fun canTakeItem(container: Container, slot: Int, itemStack: ItemStack): Boolean {
return container.canTakeItem(container, slot, itemStack)
}
override fun countItem(item: Item): Int { override fun countItem(item: Item): Int {
return container.countItem(item) return container.countItem(item)
} }

View File

@ -10,6 +10,7 @@ import com.google.common.collect.ImmutableSet
import com.google.gson.JsonElement import com.google.gson.JsonElement
import com.google.gson.JsonObject import com.google.gson.JsonObject
import com.google.gson.JsonPrimitive import com.google.gson.JsonPrimitive
import com.mojang.serialization.DataResult
import it.unimi.dsi.fastutil.objects.ObjectComparators import it.unimi.dsi.fastutil.objects.ObjectComparators
import net.minecraft.core.BlockPos import net.minecraft.core.BlockPos
import net.minecraft.nbt.CompoundTag import net.minecraft.nbt.CompoundTag

View File

@ -26,8 +26,8 @@ class EnergyContainerRecipe(val parent: ShapedRecipe) : CraftingRecipe, IShapedR
return parent.canCraftInDimensions(p_43999_, p_44000_) return parent.canCraftInDimensions(p_43999_, p_44000_)
} }
override fun getResultItem(p_267052_: RegistryAccess): ItemStack { override fun getResultItem(): ItemStack {
return parent.getResultItem(p_267052_) return parent.getResultItem()
} }
override fun category(): CraftingBookCategory { override fun category(): CraftingBookCategory {
@ -46,10 +46,6 @@ class EnergyContainerRecipe(val parent: ShapedRecipe) : CraftingRecipe, IShapedR
return parent.isSpecial return parent.isSpecial
} }
override fun showNotification(): Boolean {
return parent.showNotification()
}
override fun getGroup(): String { override fun getGroup(): String {
return parent.group return parent.group
} }
@ -66,8 +62,8 @@ class EnergyContainerRecipe(val parent: ShapedRecipe) : CraftingRecipe, IShapedR
return parent.type return parent.type
} }
override fun assemble(container: CraftingContainer, registryAccess: RegistryAccess): ItemStack { override fun assemble(container: CraftingContainer): ItemStack {
val itemStack = parent.assemble(container, registryAccess) val itemStack = parent.assemble(container)
val battery = container.stream() val battery = container.stream()
.filter { !it.isEmpty } .filter { !it.isEmpty }

View File

@ -23,10 +23,6 @@ interface IMatteryRecipe<C : Container> : Recipe<C> {
return super.isSpecial() return super.isSpecial()
} }
override fun showNotification(): Boolean {
return super.showNotification()
}
override fun getGroup(): String { override fun getGroup(): String {
return super.getGroup() return super.getGroup()
} }

View File

@ -135,7 +135,7 @@ class PainterRecipe(
return NonNullList.of(Ingredient.EMPTY, input) return NonNullList.of(Ingredient.EMPTY, input)
} }
override fun assemble(p_44001_: Container, p_267165_: RegistryAccess): ItemStack { override fun assemble(p_44001_: Container): ItemStack {
return output.copy().also { o -> return output.copy().also { o ->
p_44001_[0].tag?.let { p_44001_[0].tag?.let {
if (o.tag == null) { if (o.tag == null) {
@ -149,7 +149,7 @@ class PainterRecipe(
} }
} }
override fun getResultItem(p_267052_: RegistryAccess): ItemStack { override fun getResultItem(): ItemStack {
return output return output
} }
@ -194,7 +194,7 @@ class PainterArmorDyeRecipe(
return !isIncomplete && value.item is DyeableArmorItem return !isIncomplete && value.item is DyeableArmorItem
} }
override fun assemble(container: Container, registry: RegistryAccess): ItemStack { override fun assemble(container: Container): ItemStack {
var output = container[0].copy() var output = container[0].copy()
dyes.forEach { entry -> dyes.forEach { entry ->
@ -208,7 +208,7 @@ class PainterArmorDyeRecipe(
return output return output
} }
override fun getResultItem(registry: RegistryAccess): ItemStack = ItemStack.EMPTY override fun getResultItem(): ItemStack = ItemStack.EMPTY
override fun getSerializer(): RecipeSerializer<*> = SERIALIZER override fun getSerializer(): RecipeSerializer<*> = SERIALIZER

View File

@ -70,9 +70,9 @@ class PlatePressRecipe(
return input.isActuallyEmpty || output.isActuallyEmpty return input.isActuallyEmpty || output.isActuallyEmpty
} }
override fun assemble(p_44001_: Container, registry: RegistryAccess): ItemStack = outputStack.copy() override fun assemble(p_44001_: Container): ItemStack = outputStack.copy()
override fun canCraftInDimensions(p_43999_: Int, p_44000_: Int) = true override fun canCraftInDimensions(p_43999_: Int, p_44000_: Int) = true
override fun getResultItem(registry: RegistryAccess): ItemStack = outputStack override fun getResultItem(): ItemStack = outputStack
override fun getSerializer(): RecipeSerializer<*> { override fun getSerializer(): RecipeSerializer<*> {
return SERIALIZER return SERIALIZER