From b541b145e33da5251031b94fb7a8d47c1556d1c9 Mon Sep 17 00:00:00 2001 From: IThundxr Date: Wed, 15 Nov 2023 19:16:57 -0500 Subject: [PATCH] More Porting again --- .../oddities/inventory/EnchantmentMatrix.java | 16 ++-- .../network/message/DoubleDoorMessage.java | 7 +- .../automation/block/FeedingTroughBlock.java | 21 ++---- .../block/be/EnderWatcherBlockEntity.java | 7 +- .../block/be/FeedingTroughBlockEntity.java | 25 +++---- .../automation/module/EnderWatcherModule.java | 11 ++- .../render/entity/GlassItemFrameRenderer.java | 38 ++++------ .../building/entity/GlassItemFrame.java | 27 +++---- .../client/module/ElytraIndicatorModule.java | 9 ++- .../client/tooltip/EnchantedBookTooltips.java | 26 +++---- .../module/EnchantmentPredicatesModule.java | 13 ++-- .../mobs/ai/DeliverFetchedItemGoal.java | 4 +- .../quark/content/mobs/ai/FetchArrowGoal.java | 2 +- .../forgotten/ForgottenSheathedItemLayer.java | 16 ++-- .../mobs/client/model/FoxhoundModel.java | 8 +- .../content/tools/entity/rang/Echorang.java | 4 +- .../tweaks/client/emote/EmoteState.java | 8 +- .../render/entity/DyedItemFrameRenderer.java | 75 +++++++++---------- .../client/screen/widgets/EmoteButton.java | 33 ++++---- .../tweaks/module/DiamondRepairModule.java | 21 +++--- .../tweaks/module/DragonScalesModule.java | 8 +- .../module/DyeableItemFramesModule.java | 39 +++++----- .../tweaks/module/EnhancedLaddersModule.java | 15 ++-- .../module/ZombieVillagersOnNormalModule.java | 2 +- .../integration/claim/FlanIntegration.java | 23 +++--- .../zeta/client/event/play/ZScreen.java | 9 +-- .../zeta/registry/DyeablesRegistry.java | 24 +++--- .../client/event/player/ForgeZScreen.java | 9 +-- 28 files changed, 231 insertions(+), 269 deletions(-) diff --git a/src/main/java/org/violetmoon/quark/addons/oddities/inventory/EnchantmentMatrix.java b/src/main/java/org/violetmoon/quark/addons/oddities/inventory/EnchantmentMatrix.java index 8ec6c8fab6..1b2f7ca989 100644 --- a/src/main/java/org/violetmoon/quark/addons/oddities/inventory/EnchantmentMatrix.java +++ b/src/main/java/org/violetmoon/quark/addons/oddities/inventory/EnchantmentMatrix.java @@ -1,6 +1,6 @@ package org.violetmoon.quark.addons.oddities.inventory; -import net.minecraft.core.Registry; +import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.ListTag; import net.minecraft.resources.ResourceLocation; @@ -13,12 +13,10 @@ import net.minecraft.world.item.Items; import net.minecraft.world.item.enchantment.Enchantment; import net.minecraft.world.item.enchantment.EnchantmentInstance; - -import javax.annotation.Nonnull; - import org.violetmoon.quark.addons.oddities.module.MatrixEnchantingModule; import org.violetmoon.quark.content.experimental.module.EnchantmentsBegoneModule; +import javax.annotation.Nonnull; import java.awt.*; import java.util.List; import java.util.*; @@ -145,8 +143,8 @@ private EnchantmentDataWrapper generateRandomEnchantment(Map marked = pieces.values().stream().filter(p -> p.marked).collect(Collectors.toList()); List validEnchants = new ArrayList<>(); - Registry.ENCHANTMENT.forEach(enchantment -> { - String id = Registry.ENCHANTMENT.getKey(enchantment).toString(); + BuiltInRegistries.ENCHANTMENT.forEach(enchantment -> { + String id = BuiltInRegistries.ENCHANTMENT.getKey(enchantment).toString(); boolean isValid = true; if(enchantment.isTreasureOnly()){ isValid = MatrixEnchantingModule.allowTreasures || @@ -414,7 +412,7 @@ public Piece(EnchantmentDataWrapper wrapper, int type) { this.influence = wrapper.influence; this.type = type; - Random rng = new Random(Objects.toString(Registry.ENCHANTMENT.getKey(enchant)).hashCode()); + Random rng = new Random(Objects.toString(BuiltInRegistries.ENCHANTMENT.getKey(enchant)).hashCode()); float h = rng.nextFloat(); float s = rng.nextFloat() * 0.2F + 0.8F; float b = rng.nextFloat() * 0.25F + 0.75F; @@ -457,7 +455,7 @@ public void writeToNBT(CompoundTag cmp) { cmp.putInt(TAG_COLOR, color); cmp.putInt(TAG_TYPE, type); if (enchant != null) - cmp.putString(TAG_ENCHANTMENT, Objects.toString(Registry.ENCHANTMENT.getKey(enchant))); + cmp.putString(TAG_ENCHANTMENT, Objects.toString(BuiltInRegistries.ENCHANTMENT.getKey(enchant))); cmp.putInt(TAG_LEVEL, level); cmp.putInt(TAG_X, x); cmp.putInt(TAG_Y, y); @@ -473,7 +471,7 @@ public void writeToNBT(CompoundTag cmp) { public void readFromNBT(CompoundTag cmp) { color = cmp.getInt(TAG_COLOR); type = cmp.getInt(TAG_TYPE); - enchant = Registry.ENCHANTMENT.get(new ResourceLocation(cmp.getString(TAG_ENCHANTMENT))); + enchant = BuiltInRegistries.ENCHANTMENT.get(new ResourceLocation(cmp.getString(TAG_ENCHANTMENT))); level = cmp.getInt(TAG_LEVEL); x = cmp.getInt(TAG_X); y = cmp.getInt(TAG_Y); diff --git a/src/main/java/org/violetmoon/quark/base/network/message/DoubleDoorMessage.java b/src/main/java/org/violetmoon/quark/base/network/message/DoubleDoorMessage.java index 80bb2e0495..db08fc4197 100644 --- a/src/main/java/org/violetmoon/quark/base/network/message/DoubleDoorMessage.java +++ b/src/main/java/org/violetmoon/quark/base/network/message/DoubleDoorMessage.java @@ -3,14 +3,13 @@ import net.minecraft.core.BlockPos; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.level.Level; - -import java.io.Serial; - import org.violetmoon.quark.base.Quark; import org.violetmoon.quark.content.tweaks.module.DoubleDoorOpeningModule; import org.violetmoon.zeta.network.IZetaMessage; import org.violetmoon.zeta.network.IZetaNetworkEventContext; +import java.io.Serial; + public class DoubleDoorMessage implements IZetaMessage { @Serial @@ -25,7 +24,7 @@ public DoubleDoorMessage(BlockPos pos) { } private Level extractWorld(ServerPlayer entity) { - return entity == null ? null : entity.level; + return entity == null ? null : entity.getCommandSenderWorld(); } @Override diff --git a/src/main/java/org/violetmoon/quark/content/automation/block/FeedingTroughBlock.java b/src/main/java/org/violetmoon/quark/content/automation/block/FeedingTroughBlock.java index 9f3dde63ce..a5d0effded 100644 --- a/src/main/java/org/violetmoon/quark/content/automation/block/FeedingTroughBlock.java +++ b/src/main/java/org/violetmoon/quark/content/automation/block/FeedingTroughBlock.java @@ -1,15 +1,11 @@ package org.violetmoon.quark.content.automation.block; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - import net.minecraft.core.BlockPos; import net.minecraft.sounds.SoundEvents; import net.minecraft.world.Containers; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.MenuProvider; -import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.animal.Animal; import net.minecraft.world.entity.player.Player; @@ -28,17 +24,16 @@ import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.properties.BooleanProperty; import net.minecraft.world.phys.BlockHitResult; -import net.minecraft.world.phys.shapes.BooleanOp; -import net.minecraft.world.phys.shapes.CollisionContext; -import net.minecraft.world.phys.shapes.EntityCollisionContext; -import net.minecraft.world.phys.shapes.Shapes; -import net.minecraft.world.phys.shapes.VoxelShape; +import net.minecraft.world.phys.shapes.*; import net.minecraftforge.common.util.ForgeSoundType; import org.violetmoon.quark.content.automation.block.be.FeedingTroughBlockEntity; import org.violetmoon.quark.content.automation.module.FeedingTroughModule; import org.violetmoon.zeta.block.ZetaBlock; import org.violetmoon.zeta.module.ZetaModule; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + /** * @author WireSegal * Created at 9:39 AM on 9/20/19. @@ -94,11 +89,11 @@ public SoundType getSoundTypeZeta(BlockState state, LevelReader world, BlockPos } @Override - public void fallOn(Level world, @Nonnull BlockState state, @Nonnull BlockPos pos, @Nonnull Entity entity, float distance) { - if (world.getBlockState(pos).getValue(FULL)) - entity.causeFallDamage(distance, 0.2F, DamageSource.FALL); + public void fallOn(Level level, @Nonnull BlockState state, @Nonnull BlockPos pos, @Nonnull Entity entity, float distance) { + if (level.getBlockState(pos).getValue(FULL)) + entity.causeFallDamage(distance, 0.2F, level.damageSources().fall()); else - super.fallOn(world, state, pos, entity, distance); + super.fallOn(level, state, pos, entity, distance); } @Override diff --git a/src/main/java/org/violetmoon/quark/content/automation/block/be/EnderWatcherBlockEntity.java b/src/main/java/org/violetmoon/quark/content/automation/block/be/EnderWatcherBlockEntity.java index 0e1e0a96d4..2785758fe9 100644 --- a/src/main/java/org/violetmoon/quark/content/automation/block/be/EnderWatcherBlockEntity.java +++ b/src/main/java/org/violetmoon/quark/content/automation/block/be/EnderWatcherBlockEntity.java @@ -1,6 +1,5 @@ package org.violetmoon.quark.content.automation.block.be; -import com.mojang.math.Vector3f; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.particles.DustParticleOptions; @@ -18,14 +17,14 @@ import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.HitResult; import net.minecraft.world.phys.Vec3; - -import java.util.List; - +import org.joml.Vector3f; import org.violetmoon.quark.base.Quark; import org.violetmoon.quark.content.automation.block.EnderWatcherBlock; import org.violetmoon.quark.content.automation.module.EnderWatcherModule; import org.violetmoon.zeta.block.be.ZetaBlockEntity; +import java.util.List; + public class EnderWatcherBlockEntity extends ZetaBlockEntity { public EnderWatcherBlockEntity(BlockPos pos, BlockState state) { diff --git a/src/main/java/org/violetmoon/quark/content/automation/block/be/FeedingTroughBlockEntity.java b/src/main/java/org/violetmoon/quark/content/automation/block/be/FeedingTroughBlockEntity.java index 78ceb907e5..5e9227a118 100644 --- a/src/main/java/org/violetmoon/quark/content/automation/block/be/FeedingTroughBlockEntity.java +++ b/src/main/java/org/violetmoon/quark/content/automation/block/be/FeedingTroughBlockEntity.java @@ -1,17 +1,6 @@ package org.violetmoon.quark.content.automation.block.be; -import java.util.List; -import java.util.Random; -import java.util.UUID; - -import javax.annotation.Nonnull; - -import org.violetmoon.quark.base.handler.MiscUtil; -import org.violetmoon.quark.content.automation.block.FeedingTroughBlock; -import org.violetmoon.quark.content.automation.module.FeedingTroughModule; - import com.mojang.authlib.GameProfile; - import net.minecraft.core.BlockPos; import net.minecraft.core.NonNullList; import net.minecraft.core.particles.ItemParticleOption; @@ -36,6 +25,14 @@ import net.minecraft.world.phys.Vec3; import net.minecraftforge.common.util.FakePlayer; import net.minecraftforge.common.util.FakePlayerFactory; +import org.violetmoon.quark.base.handler.MiscUtil; +import org.violetmoon.quark.content.automation.block.FeedingTroughBlock; +import org.violetmoon.quark.content.automation.module.FeedingTroughModule; + +import javax.annotation.Nonnull; +import java.util.List; +import java.util.Random; +import java.util.UUID; /** * @author WireSegal @@ -140,11 +137,11 @@ public void setChanged() { private void addItemParticles(Entity entity, ItemStack stack, int count) { for(int i = 0; i < count; ++i) { - Vec3 direction = new Vec3((entity.level.random.nextFloat() - 0.5D) * 0.1D, Math.random() * 0.1D + 0.1D, 0.0D); + Vec3 direction = new Vec3((entity.getCommandSenderWorld().random.nextFloat() - 0.5D) * 0.1D, Math.random() * 0.1D + 0.1D, 0.0D); direction = direction.xRot(-entity.getXRot() * ((float)Math.PI / 180F)); direction = direction.yRot(-entity.getYRot() * ((float)Math.PI / 180F)); - double yVelocity = (-entity.level.random.nextFloat()) * 0.6D - 0.3D; - Vec3 position = new Vec3((entity.level.random.nextFloat() - 0.5D) * 0.3D, yVelocity, 0.6D); + double yVelocity = (-entity.getCommandSenderWorld().random.nextFloat()) * 0.6D - 0.3D; + Vec3 position = new Vec3((entity.getCommandSenderWorld().random.nextFloat() - 0.5D) * 0.3D, yVelocity, 0.6D); Vec3 entityPos = entity.position(); position = position.xRot(-entity.getXRot() * ((float)Math.PI / 180F)); position = position.yRot(-entity.getYRot() * ((float)Math.PI / 180F)); diff --git a/src/main/java/org/violetmoon/quark/content/automation/module/EnderWatcherModule.java b/src/main/java/org/violetmoon/quark/content/automation/module/EnderWatcherModule.java index a8711e7d1c..81fbaa001c 100644 --- a/src/main/java/org/violetmoon/quark/content/automation/module/EnderWatcherModule.java +++ b/src/main/java/org/violetmoon/quark/content/automation/module/EnderWatcherModule.java @@ -1,19 +1,18 @@ package org.violetmoon.quark.content.automation.module; +import net.minecraft.core.registries.Registries; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.entity.BlockEntityType; import org.violetmoon.quark.base.Quark; -import org.violetmoon.zeta.advancement.ManualTrigger; import org.violetmoon.quark.content.automation.block.EnderWatcherBlock; import org.violetmoon.quark.content.automation.block.be.EnderWatcherBlockEntity; +import org.violetmoon.zeta.advancement.ManualTrigger; import org.violetmoon.zeta.event.bus.LoadEvent; import org.violetmoon.zeta.event.load.ZRegister; import org.violetmoon.zeta.module.ZetaLoadModule; import org.violetmoon.zeta.module.ZetaModule; import org.violetmoon.zeta.util.Hint; -import net.minecraft.core.Registry; -import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.block.entity.BlockEntityType; - @ZetaLoadModule(category = "automation") public class EnderWatcherModule extends ZetaModule { @@ -26,7 +25,7 @@ public class EnderWatcherModule extends ZetaModule { public final void register(ZRegister event) { ender_watcher = new EnderWatcherBlock(this); blockEntityType = BlockEntityType.Builder.of(EnderWatcherBlockEntity::new, ender_watcher).build(null); - Quark.ZETA.registry.register(blockEntityType, "ender_watcher", Registry.BLOCK_ENTITY_TYPE_REGISTRY); + Quark.ZETA.registry.register(blockEntityType, "ender_watcher", Registries.BLOCK_ENTITY_TYPE); watcherCenterTrigger = event.getAdvancementModifierRegistry().registerManualTrigger("watcher_center"); } diff --git a/src/main/java/org/violetmoon/quark/content/building/client/render/entity/GlassItemFrameRenderer.java b/src/main/java/org/violetmoon/quark/content/building/client/render/entity/GlassItemFrameRenderer.java index 1d48010bcc..5f274526f6 100644 --- a/src/main/java/org/violetmoon/quark/content/building/client/render/entity/GlassItemFrameRenderer.java +++ b/src/main/java/org/violetmoon/quark/content/building/client/render/entity/GlassItemFrameRenderer.java @@ -1,24 +1,14 @@ package org.violetmoon.quark.content.building.client.render.entity; -import java.util.List; - -import javax.annotation.Nonnull; - -import org.violetmoon.quark.base.Quark; -import org.violetmoon.quark.content.building.entity.GlassItemFrame; -import org.violetmoon.quark.content.building.module.GlassItemFrameModule; - import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.datafixers.util.Pair; -import com.mojang.math.Vector3f; - +import com.mojang.math.Axis; import net.minecraft.client.Minecraft; import net.minecraft.client.model.geom.ModelLayers; import net.minecraft.client.model.geom.ModelPart; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.Sheets; import net.minecraft.client.renderer.block.BlockRenderDispatcher; -import net.minecraft.client.renderer.block.model.ItemTransforms; import net.minecraft.client.renderer.blockentity.BannerRenderer; import net.minecraft.client.renderer.entity.EntityRenderer; import net.minecraft.client.renderer.entity.EntityRendererProvider; @@ -35,11 +25,7 @@ import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.EntityType; -import net.minecraft.world.item.BannerItem; -import net.minecraft.world.item.DyeColor; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.MapItem; -import net.minecraft.world.item.ShieldItem; +import net.minecraft.world.item.*; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.entity.BannerBlockEntity; import net.minecraft.world.level.block.entity.BannerPattern; @@ -47,6 +33,12 @@ import net.minecraft.world.phys.Vec3; import net.minecraftforge.client.event.RenderItemInFrameEvent; import net.minecraftforge.common.MinecraftForge; +import org.violetmoon.quark.base.Quark; +import org.violetmoon.quark.content.building.entity.GlassItemFrame; +import org.violetmoon.quark.content.building.module.GlassItemFrameModule; + +import javax.annotation.Nonnull; +import java.util.List; /** * @author WireSegal @@ -85,8 +77,8 @@ public void render(@Nonnull GlassItemFrame frame, float yaw, float partialTicks, Vec3 Vector3d = this.getRenderOffset(frame, partialTicks); matrix.translate(-Vector3d.x(), -Vector3d.y(), -Vector3d.z()); matrix.translate((double)direction.getStepX() * 0.46875D, (double)direction.getStepY() * 0.46875D, (double)direction.getStepZ() * 0.46875D); - matrix.mulPose(Vector3f.XP.rotationDegrees(frame.getXRot())); - matrix.mulPose(Vector3f.YP.rotationDegrees(180.0F - frame.getYRot())); + matrix.mulPose(Axis.XP.rotationDegrees(frame.getXRot())); + matrix.mulPose(Axis.YP.rotationDegrees(180.0F - frame.getYRot())); BlockRenderDispatcher blockrendererdispatcher = this.mc.getBlockRenderer(); ModelManager modelmanager = blockrendererdispatcher.getBlockModelShaper().getModelManager(); @@ -138,7 +130,7 @@ protected void renderNameTag(@Nonnull GlassItemFrame frame, @Nonnull Component t protected void renderItemStack(GlassItemFrame itemFrame, PoseStack matrix, MultiBufferSource buff, int light, ItemStack stack) { if (!stack.isEmpty()) { matrix.pushPose(); - MapItemSavedData mapdata = MapItem.getSavedData(stack, itemFrame.level); + MapItemSavedData mapdata = MapItem.getSavedData(stack, itemFrame.getCommandSenderWorld()); sign: if(itemFrame.isOnSign()) { @@ -156,17 +148,17 @@ protected void renderItemStack(GlassItemFrame itemFrame, PoseStack matrix, Multi matrix.translate(0, 0.35, 0.8); matrix.scale(0.4F, 0.4F, 0.4F); matrix.translate(0, 0, 0.5); - matrix.mulPose(Vector3f.YP.rotationDegrees(angle)); + matrix.mulPose(Axis.YP.rotationDegrees(angle)); matrix.translate(0, 0, -0.5); matrix.translate(0, 0, -0.085); } int rotation = mapdata != null ? itemFrame.getRotation() % 4 * 2 : itemFrame.getRotation(); - matrix.mulPose(Vector3f.ZP.rotationDegrees((float) rotation * 360.0F / 8.0F)); + matrix.mulPose(Axis.ZP.rotationDegrees((float) rotation * 360.0F / 8.0F)); if (!MinecraftForge.EVENT_BUS.post(new RenderItemInFrameEvent(itemFrame, defaultRenderer, matrix, buff, light))) { if (mapdata != null) { - matrix.mulPose(Vector3f.ZP.rotationDegrees(180.0F)); + matrix.mulPose(Axis.ZP.rotationDegrees(180.0F)); matrix.scale(0.0078125F, 0.0078125F, 0.0078125F); matrix.translate(-64.0F, -64.0F, 62.5F); // <- Use 62.5 instead of 64 to prevent z-fighting @@ -194,7 +186,7 @@ protected void renderItemStack(GlassItemFrame itemFrame, PoseStack matrix, Multi matrix.scale(s, s, s); } matrix.scale(0.5F, 0.5F, 0.5F); - this.itemRenderer.renderStatic(stack, ItemTransforms.TransformType.FIXED, light, OverlayTexture.NO_OVERLAY, matrix, buff, 0); + this.itemRenderer.renderStatic(stack, ItemDisplayContext.FIXED, light, OverlayTexture.NO_OVERLAY, matrix, buff, mc.level, 0); } } } diff --git a/src/main/java/org/violetmoon/quark/content/building/entity/GlassItemFrame.java b/src/main/java/org/violetmoon/quark/content/building/entity/GlassItemFrame.java index 3fcba214ef..ece2e170a9 100755 --- a/src/main/java/org/violetmoon/quark/content/building/entity/GlassItemFrame.java +++ b/src/main/java/org/violetmoon/quark/content/building/entity/GlassItemFrame.java @@ -6,6 +6,7 @@ import net.minecraft.nbt.CompoundTag; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.protocol.Packet; +import net.minecraft.network.protocol.game.ClientGamePacketListener; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; @@ -27,17 +28,13 @@ import net.minecraft.world.phys.HitResult; import net.minecraft.world.phys.Vec3; import net.minecraftforge.common.capabilities.ForgeCapabilities; -import net.minecraftforge.common.util.FakePlayer; import net.minecraftforge.common.util.FakePlayerFactory; import net.minecraftforge.entity.IEntityAdditionalSpawnData; import net.minecraftforge.network.NetworkHooks; +import org.violetmoon.quark.content.building.module.GlassItemFrameModule; import javax.annotation.Nonnull; import javax.annotation.Nullable; - -import org.violetmoon.quark.content.building.module.GlassItemFrameModule; - -import java.lang.ref.WeakReference; import java.util.UUID; public class GlassItemFrame extends ItemFrame implements IEntityAdditionalSpawnData { @@ -66,11 +63,11 @@ public InteractionResult interact(Player player, @Nonnull InteractionHand hand) ItemStack item = getItem(); if(!player.isShiftKeyDown() && !item.isEmpty() && !(item.getItem() instanceof BannerItem)) { BlockPos behind = getBehindPos(); - BlockEntity tile = level.getBlockEntity(behind); + BlockEntity tile = getCommandSenderWorld().getBlockEntity(behind); if(tile != null && tile.getCapability(ForgeCapabilities.ITEM_HANDLER).isPresent()) { - BlockState behindState = level.getBlockState(behind); - InteractionResult result = behindState.use(level, player, hand, new BlockHitResult(new Vec3(getX(), getY(), getZ()), direction, behind, true)); + BlockState behindState = getCommandSenderWorld().getBlockState(behind); + InteractionResult result = behindState.use(getCommandSenderWorld(), player, hand, new BlockHitResult(new Vec3(getX(), getY(), getZ()), direction, behind, true)); if(result.consumesAction()) return result; @@ -87,18 +84,18 @@ public void tick() { super.tick(); boolean shouldUpdateMaps = GlassItemFrameModule.glassItemFramesUpdateMapsEveryTick; //same update as normal frames - if(level.getGameTime() % 100 == 0) { + if(getCommandSenderWorld().getGameTime() % 100 == 0) { updateIsOnSign(); //not upating every tick otherwise lag shouldUpdateMaps = true; } - if(!level.isClientSide && GlassItemFrameModule.glassItemFramesUpdateMaps && shouldUpdateMaps) { + if(!getCommandSenderWorld().isClientSide && GlassItemFrameModule.glassItemFramesUpdateMaps && shouldUpdateMaps) { ItemStack stack = getItem(); - if(stack.getItem() instanceof MapItem map && level instanceof ServerLevel sworld) { + if(stack.getItem() instanceof MapItem map && getCommandSenderWorld() instanceof ServerLevel sworld) { ItemStack clone = stack.copy(); - MapItemSavedData data = MapItem.getSavedData(clone, level); + MapItemSavedData data = MapItem.getSavedData(clone, getCommandSenderWorld()); if(data != null && !data.locked) { var fakePlayer = FakePlayerFactory.get(sworld, DUMMY_PROFILE); @@ -106,7 +103,7 @@ public void tick() { fakePlayer.setPos(getX(), getY(), getZ()); fakePlayer.getInventory().setItem(0, clone); - map.update(level, fakePlayer, data); + map.update(getCommandSenderWorld(), fakePlayer, data); } } } @@ -115,7 +112,7 @@ public void tick() { private void updateIsOnSign() { onSignRotation = null; if(this.direction.getAxis() != Direction.Axis.Y){ - BlockState back = level.getBlockState(getBehindPos()); + BlockState back = getCommandSenderWorld().getBlockState(getBehindPos()); if(back.is(BlockTags.STANDING_SIGNS)){ onSignRotation = back.getValue(StandingSignBlock.ROTATION); } @@ -187,7 +184,7 @@ public void readAdditionalSaveData(@Nonnull CompoundTag cmp) { @Nonnull @Override - public Packet getAddEntityPacket() { + public Packet getAddEntityPacket() { return NetworkHooks.getEntitySpawningPacket(this); } diff --git a/src/main/java/org/violetmoon/quark/content/client/module/ElytraIndicatorModule.java b/src/main/java/org/violetmoon/quark/content/client/module/ElytraIndicatorModule.java index 69a55c5015..a2b85d91c3 100644 --- a/src/main/java/org/violetmoon/quark/content/client/module/ElytraIndicatorModule.java +++ b/src/main/java/org/violetmoon/quark/content/client/module/ElytraIndicatorModule.java @@ -1,5 +1,6 @@ package org.violetmoon.quark.content.client.module; +import net.minecraft.client.gui.GuiGraphics; import org.violetmoon.quark.base.handler.MiscUtil; import org.violetmoon.zeta.client.event.play.ZRenderGuiOverlay; import org.violetmoon.zeta.event.bus.PlayEvent; @@ -41,19 +42,19 @@ public void hudPre(ZRenderGuiOverlay.ArmorLevel.Pre event) { int armor = player.getArmorValue(); shift = (armor >= 20 ? 0 : 9); - PoseStack pose = event.getPoseStack(); + GuiGraphics guiGraphics = event.getGuiGraphics(); + PoseStack pose = guiGraphics.pose(); Window window = event.getWindow(); pose.translate(shift, 0, 0); pose.pushPose(); pose.translate(0, 0, 100); - RenderSystem.setShaderTexture(0, MiscUtil.GENERAL_ICONS); RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); int x = window.getGuiScaledWidth() / 2 - 100; int y = window.getGuiScaledHeight() - event.getLeftHeight(); - Screen.blit(pose, x, y, 184, 35, 9, 9, 256, 256); + guiGraphics.blit(MiscUtil.GENERAL_ICONS, x, y, 184, 35, 9, 9, 256, 256); pose.popPose(); } @@ -62,7 +63,7 @@ public void hudPre(ZRenderGuiOverlay.ArmorLevel.Pre event) { @PlayEvent public void hudPost(ZRenderGuiOverlay.ArmorLevel.Post event) { if(shift != 0) { - event.getPoseStack().translate(-shift, 0, 0); + event.getGuiGraphics().pose().translate(-shift, 0, 0); shift = 0; } } diff --git a/src/main/java/org/violetmoon/quark/content/client/tooltip/EnchantedBookTooltips.java b/src/main/java/org/violetmoon/quark/content/client/tooltip/EnchantedBookTooltips.java index 370c3d8149..8e24b40a84 100755 --- a/src/main/java/org/violetmoon/quark/content/client/tooltip/EnchantedBookTooltips.java +++ b/src/main/java/org/violetmoon/quark/content/client/tooltip/EnchantedBookTooltips.java @@ -1,11 +1,5 @@ package org.violetmoon.quark.content.client.tooltip; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import javax.annotation.Nonnull; - import com.google.common.collect.HashMultimap; import com.google.common.collect.Multimap; import com.mojang.blaze3d.systems.RenderSystem; @@ -13,9 +7,9 @@ import com.mojang.datafixers.util.Either; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Font; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.screens.inventory.tooltip.ClientTooltipComponent; -import net.minecraft.client.renderer.entity.ItemRenderer; -import net.minecraft.core.Registry; +import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.FormattedText; import net.minecraft.resources.ResourceLocation; @@ -26,6 +20,7 @@ import net.minecraft.world.item.enchantment.Enchantment; import net.minecraft.world.item.enchantment.EnchantmentHelper; import net.minecraft.world.item.enchantment.EnchantmentInstance; +import org.jetbrains.annotations.NotNull; import org.violetmoon.quark.base.Quark; import org.violetmoon.quark.content.client.module.ImprovedTooltipsModule; import org.violetmoon.quark.content.tools.item.AncientTomeItem; @@ -34,6 +29,11 @@ import org.violetmoon.zeta.module.IDisableable; import org.violetmoon.zeta.util.ItemNBTHelper; +import javax.annotation.Nonnull; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + public class EnchantedBookTooltips { private static List testItems = null; @@ -141,7 +141,7 @@ public static List getTestItems() { private static void computeTestItems() { testItems = ImprovedTooltipsModule.enchantingStacks.stream() .map(ResourceLocation::new) - .map(Registry.ITEM::get) + .map(BuiltInRegistries.ITEM::get) .filter(i -> i != Items.AIR) .map(ItemStack::new) .toList(); @@ -158,10 +158,10 @@ private static void computeAdditionalStacks() { String left = tokens[0]; String right = tokens[1]; - Registry.ENCHANTMENT.getOptional(new ResourceLocation(left)) + BuiltInRegistries.ENCHANTMENT.getOptional(new ResourceLocation(left)) .ifPresent(ench -> { for(String itemId : right.split(",")) { - Registry.ITEM.getOptional(new ResourceLocation(itemId)).ifPresent(item -> + BuiltInRegistries.ITEM.getOptional(new ResourceLocation(itemId)).ifPresent(item -> additionalStacks.put(ench, new ItemStack(item))); } }); @@ -172,7 +172,7 @@ public record EnchantedBookComponent(int width, int height, Enchantment enchantment, boolean tableOnly) implements ClientTooltipComponent, TooltipComponent { @Override - public void renderImage(@Nonnull Font font, int tooltipX, int tooltipY, @Nonnull PoseStack basePose, @Nonnull ItemRenderer itemRenderer, int something) { + public void renderImage(@Nonnull Font font, int tooltipX, int tooltipY, @NotNull GuiGraphics guiGraphics) { PoseStack modelviewPose = RenderSystem.getModelViewStack(); modelviewPose.pushPose(); @@ -182,7 +182,7 @@ public void renderImage(@Nonnull Font font, int tooltipX, int tooltipY, @Nonnull List items = getItemsForEnchantment(enchantment, tableOnly); int drawn = 0; for (ItemStack testStack : items) { - mc.getItemRenderer().renderGuiItem(testStack, 6 + (drawn % 10) * 18, (drawn / 10) * 20); + guiGraphics.renderItem(testStack, 6 + (drawn % 10) * 18, (drawn / 10) * 20); drawn++; } diff --git a/src/main/java/org/violetmoon/quark/content/experimental/module/EnchantmentPredicatesModule.java b/src/main/java/org/violetmoon/quark/content/experimental/module/EnchantmentPredicatesModule.java index 001107211f..d61c3b212e 100644 --- a/src/main/java/org/violetmoon/quark/content/experimental/module/EnchantmentPredicatesModule.java +++ b/src/main/java/org/violetmoon/quark/content/experimental/module/EnchantmentPredicatesModule.java @@ -3,14 +3,11 @@ import com.google.common.collect.Lists; import net.minecraft.client.renderer.item.ItemProperties; import net.minecraft.client.renderer.item.ItemPropertyFunction; -import net.minecraft.core.Registry; +import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.Item; import net.minecraft.world.item.enchantment.Enchantment; import net.minecraft.world.item.enchantment.EnchantmentHelper; - -import java.util.List; - import org.violetmoon.quark.base.Quark; import org.violetmoon.quark.base.config.Config; import org.violetmoon.zeta.client.event.load.ZClientSetup; @@ -19,6 +16,8 @@ import org.violetmoon.zeta.module.ZetaModule; import org.violetmoon.zeta.util.RegistryUtil; +import java.util.List; + @ZetaLoadModule(category = "experimental", enabledByDefault = false, description = "This feature generates Resource Pack Item Model predicates on the items defined in 'Items to Change'\n" + "for the Enchantments defined in 'Enchantments to Register'.\n\n" @@ -40,11 +39,11 @@ public static class Client extends EnchantmentPredicatesModule { public void clientSetup(ZClientSetup e) { if(enabled) { e.enqueueWork(() -> { - List items = RegistryUtil.massRegistryGet(itemsToChange, Registry.ITEM); - List enchants = RegistryUtil.massRegistryGet(enchantmentsToRegister, Registry.ENCHANTMENT); + List items = RegistryUtil.massRegistryGet(itemsToChange, BuiltInRegistries.ITEM); + List enchants = RegistryUtil.massRegistryGet(enchantmentsToRegister, BuiltInRegistries.ENCHANTMENT); for(Enchantment enchant : enchants) { - ResourceLocation enchantRes = Registry.ENCHANTMENT.getKey(enchant); + ResourceLocation enchantRes = BuiltInRegistries.ENCHANTMENT.getKey(enchant); ResourceLocation name = new ResourceLocation(Quark.MOD_ID + "_has_enchant_" + enchantRes.getNamespace() + "_" + enchantRes.getPath()); ItemPropertyFunction fun = (stack, level, entity, i) -> EnchantmentHelper.getTagEnchantmentLevel(enchant, stack); diff --git a/src/main/java/org/violetmoon/quark/content/mobs/ai/DeliverFetchedItemGoal.java b/src/main/java/org/violetmoon/quark/content/mobs/ai/DeliverFetchedItemGoal.java index a970aaaf82..7fe2d40750 100644 --- a/src/main/java/org/violetmoon/quark/content/mobs/ai/DeliverFetchedItemGoal.java +++ b/src/main/java/org/violetmoon/quark/content/mobs/ai/DeliverFetchedItemGoal.java @@ -20,9 +20,9 @@ public void tick() { timeTilNextJump--; if(timeTilNextJump <= 0) { - timeTilNextJump = shiba.level.random.nextInt(5) + 10; + timeTilNextJump = shiba.getCommandSenderWorld().random.nextInt(5) + 10; - if(shiba.isOnGround()) { + if(shiba.onGround()) { shiba.push(0, 0.3, 0); shiba.setJumping(true); } diff --git a/src/main/java/org/violetmoon/quark/content/mobs/ai/FetchArrowGoal.java b/src/main/java/org/violetmoon/quark/content/mobs/ai/FetchArrowGoal.java index 55d949198d..d108de3f42 100644 --- a/src/main/java/org/violetmoon/quark/content/mobs/ai/FetchArrowGoal.java +++ b/src/main/java/org/violetmoon/quark/content/mobs/ai/FetchArrowGoal.java @@ -48,7 +48,7 @@ public void tick() { if(timeTilNextJump <= 0) { timeTilNextJump = shiba.level.random.nextInt(5) + 10; - if(shiba.isOnGround()) { + if(shiba.onGround()) { shiba.push(0, 0.3, 0); shiba.setJumping(true); } diff --git a/src/main/java/org/violetmoon/quark/content/mobs/client/layer/forgotten/ForgottenSheathedItemLayer.java b/src/main/java/org/violetmoon/quark/content/mobs/client/layer/forgotten/ForgottenSheathedItemLayer.java index ae523e00b2..d5a4ea9b1b 100644 --- a/src/main/java/org/violetmoon/quark/content/mobs/client/layer/forgotten/ForgottenSheathedItemLayer.java +++ b/src/main/java/org/violetmoon/quark/content/mobs/client/layer/forgotten/ForgottenSheathedItemLayer.java @@ -1,19 +1,17 @@ package org.violetmoon.quark.content.mobs.client.layer.forgotten; -import javax.annotation.Nonnull; - -import org.violetmoon.quark.content.mobs.entity.Forgotten; - import com.mojang.blaze3d.vertex.PoseStack; -import com.mojang.math.Vector3f; - +import com.mojang.math.Axis; import net.minecraft.client.model.EntityModel; import net.minecraft.client.renderer.ItemInHandRenderer; import net.minecraft.client.renderer.MultiBufferSource; -import net.minecraft.client.renderer.block.model.ItemTransforms; import net.minecraft.client.renderer.entity.RenderLayerParent; import net.minecraft.client.renderer.entity.layers.RenderLayer; +import net.minecraft.world.item.ItemDisplayContext; import net.minecraft.world.item.ItemStack; +import org.violetmoon.quark.content.mobs.entity.Forgotten; + +import javax.annotation.Nonnull; public class ForgottenSheathedItemLayer> extends RenderLayer { @@ -31,8 +29,8 @@ public void render(PoseStack matrix, @Nonnull MultiBufferSource bufferIn, int pa matrix.pushPose(); matrix.translate(0.1, 0.2, 0.15); matrix.scale(0.75F, 0.75F, 0.75F); - matrix.mulPose(Vector3f.ZP.rotationDegrees(90)); - itemInHandRenderer.renderItem(entitylivingbaseIn, item, ItemTransforms.TransformType.NONE, true, matrix, bufferIn, packedLightIn); + matrix.mulPose(Axis.ZP.rotationDegrees(90)); + itemInHandRenderer.renderItem(entitylivingbaseIn, item, ItemDisplayContext.NONE, true, matrix, bufferIn, packedLightIn); matrix.popPose(); } } diff --git a/src/main/java/org/violetmoon/quark/content/mobs/client/model/FoxhoundModel.java b/src/main/java/org/violetmoon/quark/content/mobs/client/model/FoxhoundModel.java index b2e3258a09..0dd211bb1f 100755 --- a/src/main/java/org/violetmoon/quark/content/mobs/client/model/FoxhoundModel.java +++ b/src/main/java/org/violetmoon/quark/content/mobs/client/model/FoxhoundModel.java @@ -2,8 +2,7 @@ import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexConsumer; -import com.mojang.math.Vector3f; - +import com.mojang.math.Axis; import net.minecraft.client.model.EntityModel; import net.minecraft.client.model.geom.ModelPart; import net.minecraft.client.model.geom.PartPose; @@ -12,11 +11,10 @@ import net.minecraft.client.model.geom.builders.MeshDefinition; import net.minecraft.client.model.geom.builders.PartDefinition; import net.minecraft.util.Mth; +import org.violetmoon.quark.content.mobs.entity.Foxhound; import javax.annotation.Nonnull; -import org.violetmoon.quark.content.mobs.entity.Foxhound; - /** * ModelFoxhound - McVinnyq * Created using Tabula 7.0.0 @@ -198,7 +196,7 @@ public void setupAnim(Foxhound entity, float limbSwing, float limbSwingAmount, f public void renderToBuffer(PoseStack matrix, @Nonnull VertexConsumer vb, int packedLightIn, int packedOverlayIn, float red, float green, float blue, float alpha) { matrix.pushPose(); if(entity.isSleeping()) { - matrix.mulPose(Vector3f.XP.rotationDegrees(90F)); + matrix.mulPose(Axis.XP.rotationDegrees(90F)); matrix.translate(0, -1.5, -1.5); } diff --git a/src/main/java/org/violetmoon/quark/content/tools/entity/rang/Echorang.java b/src/main/java/org/violetmoon/quark/content/tools/entity/rang/Echorang.java index eca20efcea..464658a393 100644 --- a/src/main/java/org/violetmoon/quark/content/tools/entity/rang/Echorang.java +++ b/src/main/java/org/violetmoon/quark/content/tools/entity/rang/Echorang.java @@ -52,7 +52,7 @@ private DynamicGameEventListener makeListener() { @Override protected void emitParticles(Vec3 pos, Vec3 ourMotion) { if(Math.random() < 0.4) - this.level.addParticle(ParticleTypes.SCULK_SOUL, + this.getCommandSenderWorld().addParticle(ParticleTypes.SCULK_SOUL, pos.x - ourMotion.x * 0.25D + (Math.random() - 0.5) * 0.4, pos.y - ourMotion.y * 0.25D + (Math.random() - 0.5) * 0.4, pos.z - ourMotion.z * 0.25D + (Math.random() - 0.5) * 0.4, @@ -83,7 +83,7 @@ public boolean isValidVibration(GameEvent p_223878_, Context p_223879_) { @Override public boolean shouldListen(ServerLevel level, GameEventListener listener, BlockPos pos, GameEvent event, Context context) { - return !isReturning() && level.getWorldBorder().isWithinBounds(pos) && !isRemoved() && this.level == level; + return !isReturning() && level.getWorldBorder().isWithinBounds(pos) && !isRemoved() && this.getCommandSenderWorld() == level; } @Override diff --git a/src/main/java/org/violetmoon/quark/content/tweaks/client/emote/EmoteState.java b/src/main/java/org/violetmoon/quark/content/tweaks/client/emote/EmoteState.java index 5cda33cf81..5ea962dff2 100644 --- a/src/main/java/org/violetmoon/quark/content/tweaks/client/emote/EmoteState.java +++ b/src/main/java/org/violetmoon/quark/content/tweaks/client/emote/EmoteState.java @@ -11,8 +11,8 @@ package org.violetmoon.quark.content.tweaks.client.emote; import com.mojang.blaze3d.vertex.PoseStack; -import com.mojang.math.Vector3f; +import com.mojang.math.Axis; import net.minecraft.client.model.HumanoidModel; import net.minecraft.world.entity.player.Player; @@ -61,11 +61,11 @@ public void rotateAndOffset(PoseStack stack, Player player) { stack.translate(0, height / 2, 0); if (rotY != 0) - stack.mulPose(Vector3f.YP.rotation(rotY)); + stack.mulPose(Axis.YP.rotation(rotY)); if (rotX != 0) - stack.mulPose(Vector3f.XP.rotation(rotX)); + stack.mulPose(Axis.XP.rotation(rotX)); if (rotZ != 0) - stack.mulPose(Vector3f.ZP.rotation(rotZ)); + stack.mulPose(Axis.ZP.rotation(rotZ)); stack.translate(0, -height / 2, 0); } diff --git a/src/main/java/org/violetmoon/quark/content/tweaks/client/render/entity/DyedItemFrameRenderer.java b/src/main/java/org/violetmoon/quark/content/tweaks/client/render/entity/DyedItemFrameRenderer.java index ce5553c043..b1068ca155 100644 --- a/src/main/java/org/violetmoon/quark/content/tweaks/client/render/entity/DyedItemFrameRenderer.java +++ b/src/main/java/org/violetmoon/quark/content/tweaks/client/render/entity/DyedItemFrameRenderer.java @@ -1,16 +1,11 @@ package org.violetmoon.quark.content.tweaks.client.render.entity; -import org.violetmoon.quark.base.Quark; -import org.violetmoon.quark.content.tweaks.entity.DyedItemFrame; - import com.mojang.blaze3d.vertex.PoseStack; -import com.mojang.math.Vector3f; - +import com.mojang.math.Axis; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.Sheets; import net.minecraft.client.renderer.block.BlockRenderDispatcher; -import net.minecraft.client.renderer.block.model.ItemTransforms; import net.minecraft.client.renderer.entity.EntityRenderer; import net.minecraft.client.renderer.entity.EntityRendererProvider; import net.minecraft.client.renderer.entity.ItemRenderer; @@ -22,11 +17,15 @@ import net.minecraft.core.Direction; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.ItemDisplayContext; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.MapItem; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.saveddata.maps.MapItemSavedData; import net.minecraft.world.phys.Vec3; +import org.jetbrains.annotations.NotNull; +import org.violetmoon.quark.base.Quark; +import org.violetmoon.quark.content.tweaks.entity.DyedItemFrame; // yes this shit again public class DyedItemFrameRenderer extends EntityRenderer { @@ -51,61 +50,61 @@ protected int getBlockLightLevel(DyedItemFrame p_174216_, BlockPos p_174217_) { } @Override - public void render(DyedItemFrame p_115076_, float p_115077_, float p_115078_, PoseStack p_115079_, MultiBufferSource p_115080_, int p_115081_) { - super.render(p_115076_, p_115077_, p_115078_, p_115079_, p_115080_, p_115081_); - p_115079_.pushPose(); - Direction direction = p_115076_.getDirection(); - Vec3 vec3 = this.getRenderOffset(p_115076_, p_115078_); - p_115079_.translate(-vec3.x(), -vec3.y(), -vec3.z()); - p_115079_.translate((double)direction.getStepX() * 0.46875D, (double)direction.getStepY() * 0.46875D, (double)direction.getStepZ() * 0.46875D); - p_115079_.mulPose(Vector3f.XP.rotationDegrees(p_115076_.getXRot())); - p_115079_.mulPose(Vector3f.YP.rotationDegrees(180.0F - p_115076_.getYRot())); - boolean flag = p_115076_.isInvisible(); - ItemStack itemstack = p_115076_.getItem(); + public void render(@NotNull DyedItemFrame dyedItemFrame, float p_115077_, float p_115078_, @NotNull PoseStack poseStack, @NotNull MultiBufferSource multiBufferSource, int p_115081_) { + super.render(dyedItemFrame, p_115077_, p_115078_, poseStack, multiBufferSource, p_115081_); + poseStack.pushPose(); + Direction direction = dyedItemFrame.getDirection(); + Vec3 vec3 = this.getRenderOffset(dyedItemFrame, p_115078_); + poseStack.translate(-vec3.x(), -vec3.y(), -vec3.z()); + poseStack.translate((double)direction.getStepX() * 0.46875D, (double)direction.getStepY() * 0.46875D, (double)direction.getStepZ() * 0.46875D); + poseStack.mulPose(Axis.XP.rotationDegrees(dyedItemFrame.getXRot())); + poseStack.mulPose(Axis.YP.rotationDegrees(180.0F - dyedItemFrame.getYRot())); + boolean flag = dyedItemFrame.isInvisible(); + ItemStack itemstack = dyedItemFrame.getItem(); if (!flag) { ModelManager modelmanager = this.blockRenderer.getBlockModelShaper().getModelManager(); - boolean map = p_115076_.getItem().getItem() instanceof MapItem; + boolean map = dyedItemFrame.getItem().getItem() instanceof MapItem; ModelResourceLocation modelresourcelocation = map ? MAP_FRAME_LOCATION : FRAME_LOCATION; - p_115079_.pushPose(); - p_115079_.translate(-0.5D, -0.5D, -0.5D); + poseStack.pushPose(); + poseStack.translate(-0.5D, -0.5D, -0.5D); - int color = p_115076_.getColor(); + int color = dyedItemFrame.getColor(); float r = ((float) ((color >> 16) & 0xFF)) / 255F; float g = ((float) ((color >> 8) & 0xFF)) / 255F; float b = ((float) ((color ) & 0xFF)) / 255F; - blockRenderer.getModelRenderer().renderModel(p_115079_.last(), p_115080_.getBuffer(Sheets.solidBlockSheet()), (BlockState)null, modelmanager.getModel(modelresourcelocation), r, g, b, p_115081_, OverlayTexture.NO_OVERLAY); - p_115079_.popPose(); + blockRenderer.getModelRenderer().renderModel(poseStack.last(), multiBufferSource.getBuffer(Sheets.solidBlockSheet()), (BlockState)null, modelmanager.getModel(modelresourcelocation), r, g, b, p_115081_, OverlayTexture.NO_OVERLAY); + poseStack.popPose(); } if (!itemstack.isEmpty()) { - MapItemSavedData mapitemsaveddata = MapItem.getSavedData(itemstack, p_115076_.level); + MapItemSavedData mapitemsaveddata = MapItem.getSavedData(itemstack, dyedItemFrame.getCommandSenderWorld()); if (flag) { - p_115079_.translate(0.0D, 0.0D, 0.5D); + poseStack.translate(0.0D, 0.0D, 0.5D); } else { - p_115079_.translate(0.0D, 0.0D, 0.4375D); + poseStack.translate(0.0D, 0.0D, 0.4375D); } - int j = mapitemsaveddata != null ? p_115076_.getRotation() % 4 * 2 : p_115076_.getRotation(); - p_115079_.mulPose(Vector3f.ZP.rotationDegrees((float)j * 360.0F / 8.0F)); + int j = mapitemsaveddata != null ? dyedItemFrame.getRotation() % 4 * 2 : dyedItemFrame.getRotation(); + poseStack.mulPose(Axis.ZP.rotationDegrees((float)j * 360.0F / 8.0F)); if (mapitemsaveddata != null) { - p_115079_.mulPose(Vector3f.ZP.rotationDegrees(180.0F)); - p_115079_.scale(0.0078125F, 0.0078125F, 0.0078125F); - p_115079_.translate(-64.0D, -64.0D, 0.0D); - p_115079_.translate(0.0D, 0.0D, -1.0D); + poseStack.mulPose(Axis.ZP.rotationDegrees(180.0F)); + poseStack.scale(0.0078125F, 0.0078125F, 0.0078125F); + poseStack.translate(-64.0D, -64.0D, 0.0D); + poseStack.translate(0.0D, 0.0D, -1.0D); if (mapitemsaveddata != null) { - int i = this.getLightVal(p_115076_, 15728850, p_115081_); - Minecraft.getInstance().gameRenderer.getMapRenderer().render(p_115079_, p_115080_, p_115076_.getFramedMapId().getAsInt(), mapitemsaveddata, true, i); + int i = this.getLightVal(dyedItemFrame, 15728850, p_115081_); + Minecraft.getInstance().gameRenderer.getMapRenderer().render(poseStack, multiBufferSource, dyedItemFrame.getFramedMapId().getAsInt(), mapitemsaveddata, true, i); } } else { - int k = this.getLightVal(p_115076_, 15728880, p_115081_); - p_115079_.scale(0.5F, 0.5F, 0.5F); - this.itemRenderer.renderStatic(itemstack, ItemTransforms.TransformType.FIXED, k, OverlayTexture.NO_OVERLAY, p_115079_, p_115080_, p_115076_.getId()); + int k = this.getLightVal(dyedItemFrame, 15728880, p_115081_); + poseStack.scale(0.5F, 0.5F, 0.5F); + this.itemRenderer.renderStatic(itemstack, ItemDisplayContext.FIXED, k, OverlayTexture.NO_OVERLAY, poseStack, multiBufferSource, Minecraft.getInstance().level, dyedItemFrame.getId()); } } - p_115079_.popPose(); + poseStack.popPose(); } private int getLightVal(DyedItemFrame p_174209_, int p_174210_, int p_174211_) { diff --git a/src/main/java/org/violetmoon/quark/content/tweaks/client/screen/widgets/EmoteButton.java b/src/main/java/org/violetmoon/quark/content/tweaks/client/screen/widgets/EmoteButton.java index 6de4ed083b..62a43fc220 100644 --- a/src/main/java/org/violetmoon/quark/content/tweaks/client/screen/widgets/EmoteButton.java +++ b/src/main/java/org/violetmoon/quark/content/tweaks/client/screen/widgets/EmoteButton.java @@ -1,21 +1,18 @@ package org.violetmoon.quark.content.tweaks.client.screen.widgets; -import javax.annotation.Nonnull; - -import org.violetmoon.quark.base.handler.MiscUtil; -import org.violetmoon.quark.content.tweaks.client.emote.EmoteDescriptor; -import org.violetmoon.quark.content.tweaks.module.EmotesModule; - import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.PoseStack; - import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.renderer.GameRenderer; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; +import org.jetbrains.annotations.NotNull; +import org.violetmoon.quark.base.handler.MiscUtil; +import org.violetmoon.quark.content.tweaks.client.emote.EmoteDescriptor; +import org.violetmoon.quark.content.tweaks.module.EmotesModule; public class EmoteButton extends TranslucentButton { - public final EmoteDescriptor desc; public EmoteButton(int x, int y, EmoteDescriptor desc, OnPress onPress) { @@ -24,28 +21,28 @@ public EmoteButton(int x, int y, EmoteDescriptor desc, OnPress onPress) { } @Override - public void renderButton(@Nonnull PoseStack matrix, int mouseX, int mouseY, float partial) { - super.renderButton(matrix, mouseX, mouseY, partial); + protected void renderWidget(@NotNull GuiGraphics guiGraphics, int mouseX, int mouseY, float partial) { + super.renderWidget(guiGraphics, mouseX, mouseY, partial); + + PoseStack matrix = guiGraphics.pose(); - if(visible) { + if (visible) { Minecraft mc = Minecraft.getInstance(); RenderSystem.setShader(GameRenderer::getPositionTexShader); RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); - RenderSystem.setShaderTexture(0, desc.texture); - blit(matrix, x + 4, y + 4, 0, 0, 16, 16, 16, 16); + guiGraphics.blit(desc.texture, getX() + 4, getY() + 4, 0, 0, 16, 16, 16, 16); ResourceLocation tierTexture = desc.getTierTexture(); if(tierTexture != null) { RenderSystem.setShaderTexture(0, tierTexture); - blit(matrix, x + 4, y + 4, 0, 0, 16, 16, 16, 16); + guiGraphics.blit(tierTexture, getX() + 4, getY() + 4, 0, 0, 16, 16, 16, 16); } - boolean hovered = mouseX >= x && mouseY >= y && mouseX < x + width && mouseY < y + height; - if(hovered) { + boolean hovered = mouseX >= getX() && mouseY >= getY() && mouseX < getX() + width && mouseY < getY() + height; + if (hovered) { String name = desc.getLocalizedName(); - MiscUtil.Client.drawChatBubble(matrix, x, y, mc.font, name, 1F, false); + MiscUtil.Client.drawChatBubble(matrix, getX(), getY(), mc.font, name, 1F, false); } } } - } diff --git a/src/main/java/org/violetmoon/quark/content/tweaks/module/DiamondRepairModule.java b/src/main/java/org/violetmoon/quark/content/tweaks/module/DiamondRepairModule.java index 51fc576b0f..f801d15f6c 100644 --- a/src/main/java/org/violetmoon/quark/content/tweaks/module/DiamondRepairModule.java +++ b/src/main/java/org/violetmoon/quark/content/tweaks/module/DiamondRepairModule.java @@ -2,17 +2,12 @@ import com.google.common.collect.HashMultimap; import com.google.common.collect.Multimap; -import net.minecraft.core.Registry; +import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.MutableComponent; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; - -import java.util.Arrays; -import java.util.Collection; -import java.util.List; - import org.violetmoon.quark.base.config.Config; import org.violetmoon.zeta.event.bus.LoadEvent; import org.violetmoon.zeta.event.bus.PlayEvent; @@ -22,6 +17,10 @@ import org.violetmoon.zeta.module.ZetaModule; import org.violetmoon.zeta.util.RegistryUtil; +import java.util.Arrays; +import java.util.Collection; +import java.util.List; + @ZetaLoadModule(category = "tweaks") public class DiamondRepairModule extends ZetaModule { @@ -61,15 +60,15 @@ public final void configChanged(ZConfigChanged event) { if(toks.length == 2) { ResourceLocation itemRes = new ResourceLocation(toks[0]); - if(Registry.ITEM.containsKey(itemRes)) { + if(BuiltInRegistries.ITEM.containsKey(itemRes)) { String repairItems = toks[1]; String[] repairToks = repairItems.split(","); for(String repairTok : repairToks) { ResourceLocation repairItemRes = new ResourceLocation(repairTok); - if(Registry.ITEM.containsKey(repairItemRes)) { - Item item = Registry.ITEM.get(itemRes); - Item repairItem = Registry.ITEM.get(repairItemRes); + if(BuiltInRegistries.ITEM.containsKey(repairItemRes)) { + Item item = BuiltInRegistries.ITEM.get(itemRes); + Item repairItem = BuiltInRegistries.ITEM.get(repairItemRes); repairChanges.put(item, repairItem); } } @@ -77,7 +76,7 @@ public final void configChanged(ZConfigChanged event) { } } - unrepairableItems = RegistryUtil.massRegistryGet(unrepairableItemsList, Registry.ITEM); + unrepairableItems = RegistryUtil.massRegistryGet(unrepairableItemsList, BuiltInRegistries.ITEM); } @PlayEvent diff --git a/src/main/java/org/violetmoon/quark/content/tweaks/module/DragonScalesModule.java b/src/main/java/org/violetmoon/quark/content/tweaks/module/DragonScalesModule.java index 327a30736e..74ac806c90 100644 --- a/src/main/java/org/violetmoon/quark/content/tweaks/module/DragonScalesModule.java +++ b/src/main/java/org/violetmoon/quark/content/tweaks/module/DragonScalesModule.java @@ -1,6 +1,8 @@ package org.violetmoon.quark.content.tweaks.module; import net.minecraft.core.Registry; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.core.registries.Registries; import net.minecraft.world.entity.boss.enderdragon.EnderDragon; import net.minecraft.world.entity.item.ItemEntity; import net.minecraft.world.item.CreativeModeTab; @@ -24,7 +26,7 @@ public class DragonScalesModule extends ZetaModule { @LoadEvent public final void register(ZRegister event) { - event.getRegistry().register(ElytraDuplicationRecipe.SERIALIZER, "elytra_duplication", Registry.RECIPE_SERIALIZER_REGISTRY); + event.getRegistry().register(ElytraDuplicationRecipe.SERIALIZER, "elytra_duplication", Registries.RECIPE_SERIALIZER); dragon_scale = new ZetaItem("dragon_scale", this, new Item.Properties().tab(CreativeModeTab.TAB_MATERIALS)); } @@ -34,8 +36,8 @@ public void onEntityTick(ZLivingTick event) { if(event.getEntity() instanceof EnderDragon dragon && !event.getEntity().getCommandSenderWorld().isClientSide) { if(dragon.getDragonFight() != null && dragon.getDragonFight().hasPreviouslyKilledDragon() && dragon.dragonDeathTime == 100) { Vec3 pos = dragon.position(); - ItemEntity item = new ItemEntity(dragon.level, pos.x, pos.y, pos.z, new ItemStack(dragon_scale, 1)); - dragon.level.addFreshEntity(item); + ItemEntity item = new ItemEntity(dragon.getCommandSenderWorld(), pos.x, pos.y, pos.z, new ItemStack(dragon_scale, 1)); + dragon.getCommandSenderWorld().addFreshEntity(item); } } } diff --git a/src/main/java/org/violetmoon/quark/content/tweaks/module/DyeableItemFramesModule.java b/src/main/java/org/violetmoon/quark/content/tweaks/module/DyeableItemFramesModule.java index bb895e06b1..f3dc480882 100644 --- a/src/main/java/org/violetmoon/quark/content/tweaks/module/DyeableItemFramesModule.java +++ b/src/main/java/org/violetmoon/quark/content/tweaks/module/DyeableItemFramesModule.java @@ -1,26 +1,10 @@ package org.violetmoon.quark.content.tweaks.module; -import java.util.Arrays; -import java.util.List; - -import org.violetmoon.quark.base.Quark; -import org.violetmoon.quark.content.tweaks.client.render.entity.DyedItemFrameRenderer; -import org.violetmoon.quark.content.tweaks.entity.DyedItemFrame; -import org.violetmoon.zeta.client.event.load.ZAddModels; -import org.violetmoon.zeta.client.event.load.ZClientSetup; -import org.violetmoon.zeta.event.bus.LoadEvent; -import org.violetmoon.zeta.event.bus.PlayEvent; -import org.violetmoon.zeta.event.load.ZRegister; -import org.violetmoon.zeta.event.play.entity.player.ZRightClickBlock; -import org.violetmoon.zeta.module.ZetaLoadModule; -import org.violetmoon.zeta.module.ZetaModule; -import org.violetmoon.zeta.util.Hint; - import net.minecraft.client.renderer.entity.EntityRenderers; import net.minecraft.client.resources.model.ModelResourceLocation; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; -import net.minecraft.core.Registry; +import net.minecraft.core.registries.Registries; import net.minecraft.nbt.CompoundTag; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; @@ -36,6 +20,21 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.gameevent.GameEvent; import net.minecraft.world.phys.BlockHitResult; +import org.violetmoon.quark.base.Quark; +import org.violetmoon.quark.content.tweaks.client.render.entity.DyedItemFrameRenderer; +import org.violetmoon.quark.content.tweaks.entity.DyedItemFrame; +import org.violetmoon.zeta.client.event.load.ZAddModels; +import org.violetmoon.zeta.client.event.load.ZClientSetup; +import org.violetmoon.zeta.event.bus.LoadEvent; +import org.violetmoon.zeta.event.bus.PlayEvent; +import org.violetmoon.zeta.event.load.ZRegister; +import org.violetmoon.zeta.event.play.entity.player.ZRightClickBlock; +import org.violetmoon.zeta.module.ZetaLoadModule; +import org.violetmoon.zeta.module.ZetaModule; +import org.violetmoon.zeta.util.Hint; + +import java.util.Arrays; +import java.util.List; @ZetaLoadModule(category = "tweaks") public class DyeableItemFramesModule extends ZetaModule { @@ -54,7 +53,7 @@ public final void register(ZRegister event) { .setShouldReceiveVelocityUpdates(false) .setCustomClientFactory((spawnEntity, world) -> new DyedItemFrame(entityType, world)) .build("dyed_item_frame"); - event.getRegistry().register(entityType, "dyed_item_frame", Registry.ENTITY_TYPE_REGISTRY); + event.getRegistry().register(entityType, "dyed_item_frame", Registries.ENTITY_TYPE); Quark.ZETA.dyeables.register(Items.ITEM_FRAME, this); Quark.ZETA.dyeables.register(Items.GLOW_ITEM_FRAME, this); @@ -70,7 +69,7 @@ public void onUse(ZRightClickBlock event) { BlockHitResult blockhit = event.getHitVec(); UseOnContext context = new UseOnContext(player, hand, blockhit); - Level level = player.level; + Level level = player.getCommandSenderWorld(); BlockPos pos = event.getPos(); BlockState state = level.getBlockState(pos); @@ -120,7 +119,7 @@ private InteractionResult useOn(UseOnContext context) { } protected boolean mayPlace(Player player, Direction direction, ItemStack stack, BlockPos pos) { - return !player.level.isOutsideBuildHeight(pos) && player.mayUseItemAt(pos, direction, stack); + return !player.getCommandSenderWorld().isOutsideBuildHeight(pos) && player.mayUseItemAt(pos, direction, stack); } @ZetaLoadModule(clientReplacement = true) diff --git a/src/main/java/org/violetmoon/quark/content/tweaks/module/EnhancedLaddersModule.java b/src/main/java/org/violetmoon/quark/content/tweaks/module/EnhancedLaddersModule.java index fab10d0f1a..2c56856784 100644 --- a/src/main/java/org/violetmoon/quark/content/tweaks/module/EnhancedLaddersModule.java +++ b/src/main/java/org/violetmoon/quark/content/tweaks/module/EnhancedLaddersModule.java @@ -20,7 +20,6 @@ import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.Direction.Axis; -import net.minecraft.data.BuiltinRegistries; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.MutableComponent; import net.minecraft.resources.ResourceLocation; @@ -194,8 +193,8 @@ public void onInput(ZInputUpdate event) { Player player = event.getEntity(); if(player.onClimbable() && !player.getAbilities().flying && - !isScaffolding(player.level.getBlockState(player.blockPosition()), player) - && Minecraft.getInstance().screen != null && !(player.zza == 0 && player.getXRot() > 70) && !player.isOnGround()) { + !isScaffolding(player.getCommandSenderWorld().getBlockState(player.blockPosition()), player) + && Minecraft.getInstance().screen != null && !(player.zza == 0 && player.getXRot() > 70) && !player.onGround()) { Input input = event.getInput(); if(input != null) input.shiftKeyDown = true; // sneaking @@ -208,11 +207,11 @@ public void onPlayerTick(ZPlayerTick.Start event) { return; Player player = event.getPlayer(); - if(player.onClimbable() && player.level.isClientSide) { + if(player.onClimbable() && player.getCommandSenderWorld().isClientSide) { BlockPos playerPos = player.blockPosition(); BlockPos downPos = playerPos.below(); - boolean scaffold = isScaffolding(player.level.getBlockState(playerPos), player); + boolean scaffold = isScaffolding(player.getCommandSenderWorld().getBlockState(playerPos), player); if(player.isCrouching() == scaffold && player.zza == 0 && player.yya <= 0 && @@ -220,12 +219,12 @@ public void onPlayerTick(ZPlayerTick.Start event) { player.getXRot() > 70 && !player.jumping && !player.getAbilities().flying && - player.level.getBlockState(downPos).isLadder(player.level, downPos, player)) { + player.getCommandSenderWorld().getBlockState(downPos).isLadder(player.getCommandSenderWorld(), downPos, player)) { Vec3 move = new Vec3(0, fallSpeed, 0); AABB target = player.getBoundingBox().move(move); - Iterable collisions = player.level.getBlockCollisions(player, target); + Iterable collisions = player.getCommandSenderWorld().getBlockCollisions(player, target); if(!collisions.iterator().hasNext()) { player.setBoundingBox(target); player.move(MoverType.SELF, move); @@ -237,7 +236,7 @@ public void onPlayerTick(ZPlayerTick.Start event) { } protected boolean isScaffolding(BlockState state, LivingEntity entity) { - return zeta.blockExtensions.get(state).isScaffoldingZeta(state, entity.level, entity.blockPosition(), entity); + return zeta.blockExtensions.get(state).isScaffoldingZeta(state, entity.getCommandSenderWorld(), entity.blockPosition(), entity); } diff --git a/src/main/java/org/violetmoon/quark/content/tweaks/module/ZombieVillagersOnNormalModule.java b/src/main/java/org/violetmoon/quark/content/tweaks/module/ZombieVillagersOnNormalModule.java index 16cf7b9ccb..beea114c05 100644 --- a/src/main/java/org/violetmoon/quark/content/tweaks/module/ZombieVillagersOnNormalModule.java +++ b/src/main/java/org/violetmoon/quark/content/tweaks/module/ZombieVillagersOnNormalModule.java @@ -28,7 +28,7 @@ public void onConversion(ZLivingConversion.Pre event) { ZombieVillager zombievillager = villager.convertTo(EntityType.ZOMBIE_VILLAGER, false); zombievillager.finalizeSpawn(serverLevel, level.getCurrentDifficultyAt(zombievillager.blockPosition()), MobSpawnType.CONVERSION, new Zombie.ZombieGroupData(false, true), null); zombievillager.setVillagerData(villager.getVillagerData()); - zombievillager.setGossips(villager.getGossips().store(NbtOps.INSTANCE).getValue()); + zombievillager.setGossips(villager.getGossips().store(NbtOps.INSTANCE)); zombievillager.setTradeOffers(villager.getOffers().createTag()); zombievillager.setVillagerXp(villager.getVillagerXp()); diff --git a/src/main/java/org/violetmoon/quark/integration/claim/FlanIntegration.java b/src/main/java/org/violetmoon/quark/integration/claim/FlanIntegration.java index 53618765b7..a266c0e802 100644 --- a/src/main/java/org/violetmoon/quark/integration/claim/FlanIntegration.java +++ b/src/main/java/org/violetmoon/quark/integration/claim/FlanIntegration.java @@ -8,18 +8,17 @@ import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.player.Player; +import org.violetmoon.quark.base.Quark; import javax.annotation.Nonnull; -import org.violetmoon.quark.base.Quark; - public final class FlanIntegration implements IClaimIntegration{ @Override public boolean canBreak(@Nonnull Player player, @Nonnull BlockPos pos) { - if (player.level.isClientSide) return true; //should only be used from server but client can call too + if (player.getCommandSenderWorld().isClientSide) return true; //should only be used from server but client can call too try { - ClaimStorage storage = ClaimStorage.get((ServerLevel) player.level); + ClaimStorage storage = ClaimStorage.get((ServerLevel) player.getCommandSenderWorld()); IPermissionContainer claim = storage.getForPermissionCheck(pos); return claim.canInteract((ServerPlayer) player, PermissionRegistry.BREAK, pos, true); } catch (Exception e) { @@ -30,9 +29,9 @@ public boolean canBreak(@Nonnull Player player, @Nonnull BlockPos pos) { @Override public boolean canPlace(@Nonnull Player player, @Nonnull BlockPos pos) { - if (player.level.isClientSide) return true; //should only be used from server but client can call too + if (player.getCommandSenderWorld().isClientSide) return true; //should only be used from server but client can call too try { - ClaimStorage storage = ClaimStorage.get((ServerLevel) player.level); + ClaimStorage storage = ClaimStorage.get((ServerLevel) player.getCommandSenderWorld()); IPermissionContainer claim = storage.getForPermissionCheck(pos); return claim.canInteract((ServerPlayer) player, PermissionRegistry.PLACE, pos); } catch (Exception e) { @@ -43,9 +42,9 @@ public boolean canPlace(@Nonnull Player player, @Nonnull BlockPos pos) { @Override public boolean canReplace(@Nonnull Player player, @Nonnull BlockPos pos) { - if (player.level.isClientSide) return true; //should only be used from server but client can call too + if (player.getCommandSenderWorld().isClientSide) return true; //should only be used from server but client can call too try { - ClaimStorage storage = ClaimStorage.get((ServerLevel) player.level); + ClaimStorage storage = ClaimStorage.get((ServerLevel) player.getCommandSenderWorld()); IPermissionContainer claim = storage.getForPermissionCheck(pos); return claim.canInteract((ServerPlayer) player, PermissionRegistry.PLACE, pos); } catch (Exception e) { @@ -56,9 +55,9 @@ public boolean canReplace(@Nonnull Player player, @Nonnull BlockPos pos) { @Override public boolean canAttack(@Nonnull Player player, @Nonnull Entity victim) { - if (player.level.isClientSide) return true; //should only be used from server but client can call too + if (player.getCommandSenderWorld().isClientSide) return true; //should only be used from server but client can call too try { - ClaimStorage storage = ClaimStorage.get((ServerLevel) player.level); + ClaimStorage storage = ClaimStorage.get((ServerLevel) player.getCommandSenderWorld()); IPermissionContainer claim = storage.getForPermissionCheck(victim.blockPosition()); return claim.canInteract((ServerPlayer) player, PermissionRegistry.HURTANIMAL, victim.blockPosition()); } catch (Exception e) { @@ -69,9 +68,9 @@ public boolean canAttack(@Nonnull Player player, @Nonnull Entity victim) { @Override public boolean canInteract(@Nonnull Player player, @Nonnull BlockPos targetPos) { - if (player.level.isClientSide) return true; //should only be used from server but client can call too + if (player.getCommandSenderWorld().isClientSide) return true; //should only be used from server but client can call too try { - ClaimStorage storage = ClaimStorage.get((ServerLevel) player.level); + ClaimStorage storage = ClaimStorage.get((ServerLevel) player.getCommandSenderWorld()); IPermissionContainer claim = storage.getForPermissionCheck(targetPos); return claim.canInteract((ServerPlayer) player, PermissionRegistry.INTERACTBLOCK, targetPos); } catch (Exception e) { diff --git a/src/main/java/org/violetmoon/zeta/client/event/play/ZScreen.java b/src/main/java/org/violetmoon/zeta/client/event/play/ZScreen.java index 17752de683..fa3e375a93 100644 --- a/src/main/java/org/violetmoon/zeta/client/event/play/ZScreen.java +++ b/src/main/java/org/violetmoon/zeta/client/event/play/ZScreen.java @@ -1,14 +1,13 @@ package org.violetmoon.zeta.client.event.play; -import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.events.GuiEventListener; import net.minecraft.client.gui.screens.Screen; - -import java.util.List; - import org.violetmoon.zeta.event.bus.Cancellable; import org.violetmoon.zeta.event.bus.IZetaPlayEvent; +import java.util.List; + public interface ZScreen extends IZetaPlayEvent { Screen getScreen(); @@ -22,7 +21,7 @@ interface Post extends Init { } } interface Render extends ZScreen { - PoseStack getPoseStack(); + GuiGraphics getGuiGraphics(); int getMouseX(); int getMouseY(); diff --git a/src/main/java/org/violetmoon/zeta/registry/DyeablesRegistry.java b/src/main/java/org/violetmoon/zeta/registry/DyeablesRegistry.java index 243e03ff70..048c312c49 100644 --- a/src/main/java/org/violetmoon/zeta/registry/DyeablesRegistry.java +++ b/src/main/java/org/violetmoon/zeta/registry/DyeablesRegistry.java @@ -1,19 +1,8 @@ package org.violetmoon.zeta.registry; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.function.Supplier; - -import org.violetmoon.zeta.Zeta; -import org.violetmoon.zeta.event.bus.LoadEvent; -import org.violetmoon.zeta.event.load.ZRegister; -import org.violetmoon.zeta.module.ZetaModule; -import org.violetmoon.zeta.recipe.ZetaDyeRecipe; - import net.minecraft.core.BlockPos; -import net.minecraft.core.Registry; import net.minecraft.core.cauldron.CauldronInteraction; +import net.minecraft.core.registries.Registries; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; @@ -25,6 +14,15 @@ import net.minecraft.world.level.Level; import net.minecraft.world.level.block.LayeredCauldronBlock; import net.minecraft.world.level.block.state.BlockState; +import org.violetmoon.zeta.event.bus.LoadEvent; +import org.violetmoon.zeta.event.load.ZRegister; +import org.violetmoon.zeta.module.ZetaModule; +import org.violetmoon.zeta.recipe.ZetaDyeRecipe; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.function.Supplier; /** * @see org.violetmoon.zeta.client.ClientRegistryExtension @@ -38,7 +36,7 @@ public class DyeablesRegistry { public void register(ZRegister event) { ResourceLocation id = event.getRegistry().newResourceLocation("dye_item"); ZetaDyeRecipe recipe = new ZetaDyeRecipe(id, this); - event.getRegistry().register(recipe.getSerializer(), id, Registry.RECIPE_SERIALIZER_REGISTRY); + event.getRegistry().register(recipe.getSerializer(), id, Registries.RECIPE_SERIALIZER); } @LoadEvent diff --git a/src/main/java/org/violetmoon/zetaimplforge/client/event/player/ForgeZScreen.java b/src/main/java/org/violetmoon/zetaimplforge/client/event/player/ForgeZScreen.java index 68e5e155dc..a4b38f7380 100644 --- a/src/main/java/org/violetmoon/zetaimplforge/client/event/player/ForgeZScreen.java +++ b/src/main/java/org/violetmoon/zetaimplforge/client/event/player/ForgeZScreen.java @@ -1,14 +1,13 @@ package org.violetmoon.zetaimplforge.client.event.player; -import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.events.GuiEventListener; import net.minecraft.client.gui.screens.Screen; import net.minecraftforge.client.event.ScreenEvent; +import org.violetmoon.zeta.client.event.play.ZScreen; import java.util.List; -import org.violetmoon.zeta.client.event.play.ZScreen; - public class ForgeZScreen implements ZScreen { private final ScreenEvent e; @@ -66,8 +65,8 @@ public Render(ScreenEvent.Render e) { } @Override - public PoseStack getPoseStack() { - return e.getPoseStack(); + public GuiGraphics getGuiGraphics() { + return e.getGuiGraphics(); } @Override