diff --git a/src/main/kotlin/io/github/lucaargolo/kibe/KibeModClient.kt b/src/main/kotlin/io/github/lucaargolo/kibe/KibeModClient.kt index 6d694ff..5c3b4d9 100644 --- a/src/main/kotlin/io/github/lucaargolo/kibe/KibeModClient.kt +++ b/src/main/kotlin/io/github/lucaargolo/kibe/KibeModClient.kt @@ -35,7 +35,6 @@ import net.fabricmc.fabric.api.client.rendering.v1.EntityModelLayerRegistry import net.fabricmc.fabric.api.client.rendering.v1.TooltipComponentCallback import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderContext import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderEvents -import net.fabricmc.fabric.api.event.client.ClientSpriteRegistryCallback import net.fabricmc.fabric.api.transfer.v1.fluid.FluidVariant import net.minecraft.client.MinecraftClient import net.minecraft.client.particle.FlameParticle @@ -45,6 +44,7 @@ import net.minecraft.client.util.SpriteIdentifier import net.minecraft.client.util.math.MatrixStack import net.minecraft.network.PacketByteBuf import net.minecraft.resource.ResourceManager +import net.minecraft.screen.PlayerScreenHandler import net.minecraft.util.Identifier import net.minecraft.util.hit.BlockHitResult import net.minecraft.util.math.BlockPos diff --git a/src/main/kotlin/io/github/lucaargolo/kibe/blocks/chunkloader/ChunkLoaderScreen.kt b/src/main/kotlin/io/github/lucaargolo/kibe/blocks/chunkloader/ChunkLoaderScreen.kt index 82ab2de..077b297 100644 --- a/src/main/kotlin/io/github/lucaargolo/kibe/blocks/chunkloader/ChunkLoaderScreen.kt +++ b/src/main/kotlin/io/github/lucaargolo/kibe/blocks/chunkloader/ChunkLoaderScreen.kt @@ -83,7 +83,7 @@ class ChunkLoaderScreen(be: ChunkLoaderBlockEntity): Screen(Text.translatable("s val toggle = Text.translatable("tooltip.kibe.check_for_owner") context.matrices.push() context.matrices.scale(0.5f, 0.5f, 0.5f) - context.drawText(textRenderer, toggle, (x+16)*2f, (y+20f)*2f, 4210752) + context.drawText(textRenderer, toggle, (x+16)*2, (y+20)*2, 4210752, false) context.matrices.pop() } @@ -103,8 +103,7 @@ class ChunkLoaderScreen(be: ChunkLoaderBlockEntity): Screen(Text.translatable("s context.fill(x+7+((it.first+2)*16), y+28+((it.second+2)*16), x+7+((it.first+2)*16)+16, y+28+((it.second+2)*16)+16, -2147418368) } if(entity.checkForOwner) { - RenderSystem.setShaderTexture(0, texture) - drawTexture(matrices, x+7, y+18, 94, 0, 7, 7) + context.drawTexture(texture, x+7, y+18, 94, 0, 7, 7) } if(mouseX in (x+7 until x+87) && mouseY in (y+28 until y+109)) { val chunkX = (mouseX-(x+7))/16 @@ -115,7 +114,7 @@ class ChunkLoaderScreen(be: ChunkLoaderBlockEntity): Screen(Text.translatable("s tooltip.add(Text.translatable("tooltip.kibe.forced").append(Text.translatable(if(entity.enabledChunks.contains(Pair(chunkX-2, chunkZ-2))) "tooltip.kibe.enabled" else "tooltip.kibe.disabled"))) context.drawTooltip(textRenderer, tooltip, mouseX, mouseY) }else if(mouseX in (x+7 until x+14) && mouseY in (y+18 until y+25)) { - DrawableHelper.fill(matrices, x+7, y+18, x+14, y+25, -2130706433) + context.fill(x+7, y+18, x+14, y+25, -2130706433) val tooltip = mutableListOf() tooltip.add(Text.translatable("tooltip.kibe.check_for_owner_status", if (entity.checkForOwner) Text.translatable("tooltip.kibe.enabled") else Text.translatable("tooltip.kibe.disabled"))) if(notOwner) { @@ -123,7 +122,7 @@ class ChunkLoaderScreen(be: ChunkLoaderBlockEntity): Screen(Text.translatable("s }else { tooltip.add(Text.translatable("tooltip.kibe.lore.check_for_owner")) } - renderTooltip(matrices, tooltip, mouseX, mouseY) + context.drawTooltip(textRenderer, tooltip, mouseX, mouseY) }else{ notOwner = false } diff --git a/src/main/kotlin/io/github/lucaargolo/kibe/blocks/miscellaneous/Igniter.kt b/src/main/kotlin/io/github/lucaargolo/kibe/blocks/miscellaneous/Igniter.kt index 1759fe6..6a7529a 100644 --- a/src/main/kotlin/io/github/lucaargolo/kibe/blocks/miscellaneous/Igniter.kt +++ b/src/main/kotlin/io/github/lucaargolo/kibe/blocks/miscellaneous/Igniter.kt @@ -1,6 +1,6 @@ package io.github.lucaargolo.kibe.blocks.miscellaneous -import io.github.lucaargolo.kibe.utils.FakePlayerEntity +import net.fabricmc.fabric.api.entity.FakePlayer import net.fabricmc.fabric.api.`object`.builder.v1.block.FabricBlockSettings import net.minecraft.block.Block import net.minecraft.block.BlockState @@ -58,7 +58,7 @@ class Igniter: Block(FabricBlockSettings.copyOf(Blocks.COBBLESTONE)) { override fun scheduledTick(state: BlockState, world: ServerWorld, pos: BlockPos, random: Random) { val facing = state[Properties.FACING] - val fakePlayer = FakePlayerEntity(world) + val fakePlayer = FakePlayer.get(world) fakePlayer.setStackInHand(Hand.MAIN_HAND, Items.FLINT_AND_STEEL.defaultStack) var facingPos = pos.offset(facing) val facingState = world.getBlockState(facingPos) diff --git a/src/main/kotlin/io/github/lucaargolo/kibe/blocks/miscellaneous/Spikes.kt b/src/main/kotlin/io/github/lucaargolo/kibe/blocks/miscellaneous/Spikes.kt index f479f0e..f111816 100644 --- a/src/main/kotlin/io/github/lucaargolo/kibe/blocks/miscellaneous/Spikes.kt +++ b/src/main/kotlin/io/github/lucaargolo/kibe/blocks/miscellaneous/Spikes.kt @@ -43,11 +43,11 @@ class Spikes(private val type: Type, settings: Settings): Block(settings) { } override fun rotate(state: BlockState, rotation: BlockRotation): BlockState { - return state.with(DispenserBlock.FACING, rotation.rotate(state[DispenserBlock.FACING])) + return state.with(Properties.FACING, rotation.rotate(state[Properties.FACING])) } override fun mirror(state: BlockState, mirror: BlockMirror): BlockState { - return state.rotate(mirror.getRotation(state[DispenserBlock.FACING])) + return state.rotate(mirror.getRotation(state[Properties.FACING])) } override fun onEntityCollision(state: BlockState, world: World, pos: BlockPos, entity: Entity) { diff --git a/src/main/kotlin/io/github/lucaargolo/kibe/items/ItemCompendium.kt b/src/main/kotlin/io/github/lucaargolo/kibe/items/ItemCompendium.kt index c885f61..2ee9636 100644 --- a/src/main/kotlin/io/github/lucaargolo/kibe/items/ItemCompendium.kt +++ b/src/main/kotlin/io/github/lucaargolo/kibe/items/ItemCompendium.kt @@ -29,8 +29,8 @@ import net.fabricmc.fabric.api.client.model.ModelVariantProvider import net.fabricmc.fabric.api.screenhandler.v1.ExtendedScreenHandlerType import net.minecraft.client.gui.screen.ingame.HandledScreen import net.minecraft.client.gui.screen.ingame.HandledScreens +import net.minecraft.client.item.ClampedModelPredicateProvider import net.minecraft.client.item.ModelPredicateProviderRegistry -import net.minecraft.client.item.UnclampedModelPredicateProvider import net.minecraft.client.render.model.* import net.minecraft.client.texture.Sprite import net.minecraft.client.util.SpriteIdentifier @@ -86,7 +86,7 @@ interface Identified { val identifier: Identifier } -interface IdentifiedModelPredicateProvider : UnclampedModelPredicateProvider, Identified +interface IdentifiedModelPredicateProvider : ClampedModelPredicateProvider, Identified class ItemInfo ( val identifier: Identifier, diff --git a/src/main/kotlin/io/github/lucaargolo/kibe/items/cooler/CoolerTooltipComponent.kt b/src/main/kotlin/io/github/lucaargolo/kibe/items/cooler/CoolerTooltipComponent.kt index ea858f9..6f63054 100644 --- a/src/main/kotlin/io/github/lucaargolo/kibe/items/cooler/CoolerTooltipComponent.kt +++ b/src/main/kotlin/io/github/lucaargolo/kibe/items/cooler/CoolerTooltipComponent.kt @@ -1,18 +1,17 @@ package io.github.lucaargolo.kibe.items.cooler import net.minecraft.client.font.TextRenderer +import net.minecraft.client.gui.DrawContext import net.minecraft.client.gui.tooltip.BundleTooltipComponent import net.minecraft.client.item.BundleTooltipData -import net.minecraft.client.render.item.ItemRenderer -import net.minecraft.client.util.math.MatrixStack class CoolerTooltipComponent(data: BundleTooltipData) : BundleTooltipComponent(data) { - override fun drawSlot(x: Int, y: Int, index: Int, shouldBlock: Boolean, textRenderer: TextRenderer, matrices: MatrixStack, itemRenderer: ItemRenderer, z: Int) { + override fun drawSlot(x: Int, y: Int, index: Int, shouldBlock: Boolean, context: DrawContext, textRenderer: TextRenderer) { val itemStack = inventory[index] - draw(matrices, x, y, z, Sprite.SLOT) - itemRenderer.renderInGuiWithOverrides(itemStack, x + 1, y + 1, index) - itemRenderer.renderGuiItemOverlay(textRenderer, itemStack, x + 1, y + 1) + draw(context, x, y, Sprite.SLOT) + context.drawItem(itemStack, x + 1, y + 1, index) + context.drawItemInSlot(textRenderer, itemStack, x + 1, y + 1) } override fun getColumns() = 1 diff --git a/src/main/kotlin/io/github/lucaargolo/kibe/items/miscellaneous/Lasso.kt b/src/main/kotlin/io/github/lucaargolo/kibe/items/miscellaneous/Lasso.kt index f15ab3f..e16dce4 100644 --- a/src/main/kotlin/io/github/lucaargolo/kibe/items/miscellaneous/Lasso.kt +++ b/src/main/kotlin/io/github/lucaargolo/kibe/items/miscellaneous/Lasso.kt @@ -32,7 +32,7 @@ abstract class Lasso(settings: Settings): Item(settings) { override fun useOnEntity(stack: ItemStack, user: PlayerEntity, entity: LivingEntity, hand: Hand): ActionResult { if (stack.nbt == null || !stack.orCreateNbt.contains("Entity")) { - if (entity is MobEntity && canStoreEntity(entity.type) && MOD_CONFIG.miscellaneousModule.lassoDenyList.contains(Registry.ENTITY_TYPE.getId(entity.type).toString())) { + if (entity is MobEntity && canStoreEntity(entity.type) && MOD_CONFIG.miscellaneousModule.lassoDenyList.contains(Registries.ENTITY_TYPE.getId(entity.type).toString())) { if(!user.world.isClient) { if (entity.isLeashed) entity.detachLeash(true, true) entity.fallDistance = 0f diff --git a/src/main/resources/kibe.accesswidener b/src/main/resources/kibe.accesswidener index 78fdc99..9567b02 100644 --- a/src/main/resources/kibe.accesswidener +++ b/src/main/resources/kibe.accesswidener @@ -1,7 +1,7 @@ accessWidener v1 named extendable method net/minecraft/client/gui/tooltip/BundleTooltipComponent getColumns ()I extendable method net/minecraft/client/gui/tooltip/BundleTooltipComponent getRows ()I -extendable method net/minecraft/client/gui/tooltip/BundleTooltipComponent drawSlot (IIIZLnet/minecraft/client/font/TextRenderer;Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/item/ItemRenderer;I)V -extendable method net/minecraft/client/gui/tooltip/BundleTooltipComponent draw (Lnet/minecraft/client/util/math/MatrixStack;IIILnet/minecraft/client/gui/tooltip/BundleTooltipComponent$Sprite;)V +extendable method net/minecraft/client/gui/tooltip/BundleTooltipComponent drawSlot (IIIZLnet/minecraft/client/gui/DrawContext;Lnet/minecraft/client/font/TextRenderer;)V +extendable method net/minecraft/client/gui/tooltip/BundleTooltipComponent draw (Lnet/minecraft/client/gui/DrawContext;IILnet/minecraft/client/gui/tooltip/BundleTooltipComponent$Sprite;)V accessible field net/minecraft/client/gui/tooltip/BundleTooltipComponent inventory Lnet/minecraft/util/collection/DefaultedList; accessible class net/minecraft/client/gui/tooltip/BundleTooltipComponent$Sprite \ No newline at end of file