From 9881132a7b8ca01e4961e0b0672bd11ecafd331c Mon Sep 17 00:00:00 2001 From: BrokenK3yboard <63761658+BrokenK3yboard@users.noreply.github.com> Date: Thu, 16 Jan 2025 01:34:30 -0600 Subject: [PATCH] Down to 832 errors --- build.gradle | 4 +- dependencies.properties | 2 +- .../addons/oddities/block/CrateBlock.java | 8 +- .../oddities/block/MovingMagnetizedBlock.java | 2 - .../be/MatrixEnchantingTableBlockEntity.java | 9 +- .../oddities/capability/MagnetTracker.java | 2 - .../client/render/be/PipeRenderer.java | 1 - .../screen/MatrixEnchantingPieceList.java | 4 +- .../oddities/entity/TotemOfHoldingEntity.java | 1 - .../oddities/inventory/BackpackMenu.java | 25 +- .../addons/oddities/inventory/CrateMenu.java | 8 +- .../slot/SlotCachingItemHandler.java | 2 +- .../addons/oddities/item/BackpackItem.java | 48 +- .../magnetsystem/DefaultMoveActions.java | 41 +- .../oddities/magnetsystem/MagnetSystem.java | 2 - .../oddities/module/BackpackModule.java | 71 ++- .../addons/oddities/module/MagnetsModule.java | 2 - .../module/MatrixEnchantingModule.java | 2 +- .../addons/oddities/module/PipesModule.java | 1 - .../java/org/violetmoon/quark/base/Quark.java | 23 +- .../base/client/config/QButtonHandler.java | 3 - .../client/config/QuarkConfigHomeScreen.java | 1 - .../base/client/handler/ModelHandler.java | 1 - .../handler/InventoryTransferHandler.java | 33 +- .../quark/base/handler/QuarkRemapHandler.java | 10 +- .../quark/base/handler/QuarkSounds.java | 1 - .../quark/base/handler/SortingHandler.java | 18 +- .../quark/base/network/QuarkNetwork.java | 1 - .../oddities/HandleBackpackMessage.java | 4 +- .../quark/base/util/InventoryIIH.java | 7 +- .../automation/block/CrafterBlock.java | 181 -------- .../automation/block/be/ChuteBlockEntity.java | 20 +- .../block/be/CrafterBlockEntity.java | 426 ------------------ .../client/screen/CrafterScreen.java | 102 ----- .../client/screen/TroughScreen.java | 1 - .../automation/inventory/CrafterMenu.java | 185 -------- .../automation/module/CrafterModule.java | 66 --- .../automation/module/IronRodModule.java | 2 - .../module/PistonsMoveTileEntitiesModule.java | 8 +- .../building/block/CelebratoryLampBlock.java | 10 +- .../content/building/block/CutVineBlock.java | 3 - .../content/building/block/HedgeBlock.java | 4 +- .../building/block/PaperWallBlock.java | 1 - .../content/building/block/RopeBlock.java | 42 +- .../content/building/block/StoolBlock.java | 1 - .../content/building/block/WoodPostBlock.java | 1 - .../block/be/VariantChestBlockEntity.java | 7 - .../render/be/VariantChestRenderer.java | 1 - .../render/entity/GlassItemFrameRenderer.java | 7 +- .../building/item/QuarkItemFrameItem.java | 1 - .../content/building/module/HedgesModule.java | 2 - .../building/module/HollowLogsModule.java | 2 - .../building/module/RainbowLampsModule.java | 2 - .../building/module/VariantChestsModule.java | 61 ++- .../building/module/VerticalSlabsModule.java | 2 - .../module/BucketsShowInhabitantsModule.java | 3 +- .../module/MicrocraftingHelperModule.java | 42 +- .../client/module/UsesForCursesModule.java | 11 +- .../module/VariantAnimalTexturesModule.java | 7 +- .../resources/AttributeTooltipManager.java | 1 - .../content/client/tooltip/FoodTooltips.java | 22 +- .../content/client/tooltip/MapTooltips.java | 3 - .../client/tooltip/ShulkerBoxTooltips.java | 6 +- .../client/screen/VariantSelectorScreen.java | 3 - .../module/VariantSelectorModule.java | 2 - .../screen/widgets/MiniInventoryButton.java | 1 - .../module/AutomaticToolRestockModule.java | 9 +- .../module/EasyTransferingModule.java | 1 - .../ExpandedItemInteractionsModule.java | 5 +- .../module/HotbarChangerModule.java | 5 +- .../module/QuickArmorSwappingModule.java | 7 +- .../quark/content/mobs/ai/RunAndPoofGoal.java | 1 - .../mobs/client/model/FoxhoundModel.java | 1 - .../quark/content/mobs/entity/Foxhound.java | 13 +- .../content/mobs/item/DiamondHeartItem.java | 1 - .../quark/content/mobs/item/SoulBeadItem.java | 1 - .../content/mobs/module/CrabsModule.java | 1 - .../quark/content/tools/base/RuneColor.java | 1 - .../quark/content/tools/entity/ParrotEgg.java | 1 - .../content/tools/item/AncientTomeItem.java | 15 +- .../content/tools/item/BottledCloudItem.java | 1 - .../tools/item/PathfindersQuillItem.java | 5 +- .../tools/module/AmbientDiscsModule.java | 14 +- .../tools/module/AncientTomesModule.java | 88 ++-- .../tools/module/BeaconRedirectionModule.java | 2 - .../tools/module/ColorRunesModule.java | 12 +- .../module/EndermoshMusicDiscModule.java | 21 +- .../tools/module/PathfinderMapsModule.java | 7 +- .../content/tools/module/PickarangModule.java | 2 - .../tools/module/SkullPikesModule.java | 1 - .../tools/module/SlimeInABucketModule.java | 2 - .../tools/recipe/SmithingRuneRecipe.java | 56 +-- .../content/tweaks/block/WaterPetalBlock.java | 1 - .../layer/ArmorStandFakePlayerLayer.java | 6 +- .../BetterElytraRocketCuriosCompat.java | 4 +- .../compat/TotemOfHoldingCuriosCompat.java | 6 +- .../module/AutomaticRecipeUnlockModule.java | 5 +- .../module/CompassesWorkEverywhereModule.java | 1 - .../tweaks/module/EnhancedLaddersModule.java | 4 - .../tweaks/module/GlassShardModule.java | 3 - .../module/GoldToolsHaveFortuneModule.java | 7 +- .../tweaks/module/LockRotationModule.java | 2 - .../tweaks/module/MapWashingModule.java | 1 - .../module/NoDurabilityOnCosmeticsModule.java | 2 - .../tweaks/module/PigLittersModule.java | 2 - .../module/ReacharoundPlacingModule.java | 1 - .../module/RenewableSporeBlossomsModule.java | 1 - .../tweaks/module/ShulkerPackingModule.java | 5 +- .../recipe/ElytraDuplicationRecipe.java | 3 - .../feature/AncientTreeTopperDecorator.java | 1 - .../world/gen/BlossomTreeGenerator.java | 2 - .../content/world/gen/FallenLogGenerator.java | 2 - .../world/gen/ObsidianSpikeGenerator.java | 2 - .../content/world/module/CorundumModule.java | 2 - .../world/module/GlimmeringWealdModule.java | 4 - .../world/module/PermafrostModule.java | 1 - .../base/UndergroundStyle.java | 2 - .../datagen/QuarkBlockLootTableProvider.java | 6 - .../quark/datagen/QuarkDatagen.java | 1 - .../datagen/QuarkEntityLootTableProvider.java | 2 - .../quark/datagen/QuarkItemModelProvider.java | 1 - .../builder/QuarkShapedRecipeBuilder.java | 6 - .../quark/integration/jei/InfluenceEntry.java | 7 +- .../quark/integration/jei/QuarkJeiPlugin.java | 4 +- .../integration/jei/SlabToBlockExtension.java | 15 +- .../lootr/LootrVariantChestBlock.java | 2 +- .../lootr/LootrVariantChestBlockEntity.java | 6 - .../lootr/LootrVariantTrappedChestBlock.java | 9 +- .../client/LootrVariantChestRenderer.java | 18 +- .../mixin/mixins/DamageEnchantmentMixin.java | 17 - .../quark/mixin/mixins/EnchantmentMixin.java | 2 - .../mixin/mixins/HarvestFarmlandMixin.java | 2 - .../quark/mixin/mixins/IForgeItemMixin.java | 8 +- .../quark/mixin/mixins/ItemStackMixin.java | 11 +- .../quark/mixin/mixins/LadderBlockMixin.java | 4 - .../quark/mixin/mixins/TemptGoalMixin.java | 2 - .../mixin/mixins/TemptingSensorMixin.java | 1 - .../mixin/mixins/VillagerTradesMixin.java | 1 - .../mixins/accessor/AccessorBlockItem.java | 2 - .../mixins/accessor/AccessorChunkAccess.java | 4 - .../accessor/AccessorSinglePoolElement.java | 1 - .../mixins/self/IZetaItemMixin_FAKE.java | 9 +- .../resources/META-INF/accesstransformer.cfg | 4 +- src/main/resources/quark.mixins.json | 1 - 144 files changed, 408 insertions(+), 1657 deletions(-) delete mode 100644 src/main/java/org/violetmoon/quark/content/automation/block/CrafterBlock.java delete mode 100644 src/main/java/org/violetmoon/quark/content/automation/block/be/CrafterBlockEntity.java delete mode 100644 src/main/java/org/violetmoon/quark/content/automation/client/screen/CrafterScreen.java delete mode 100644 src/main/java/org/violetmoon/quark/content/automation/inventory/CrafterMenu.java delete mode 100644 src/main/java/org/violetmoon/quark/content/automation/module/CrafterModule.java delete mode 100644 src/main/java/org/violetmoon/quark/mixin/mixins/DamageEnchantmentMixin.java diff --git a/build.gradle b/build.gradle index 5966c023ad..d4d9028b88 100644 --- a/build.gradle +++ b/build.gradle @@ -130,8 +130,8 @@ dependencies { // runtimeOnly fg.deobf("curse.maven:blueprint-382216:5292242") runtimeOnly "curse.maven:farmers-delight-398521:5962800" - // runtimeOnly fg.deobf("top.theillusivec4.curios:curios-forge:${deps.curios}") - // compileOnly fg.deobf("top.theillusivec4.curios:curios-forge:${deps.curios}:api") + runtimeOnly "top.theillusivec4.curios:curios-neoforge:${deps.curios}" + compileOnly "top.theillusivec4.curios:curios-neoforge:${deps.curios}:api" } spotless { diff --git a/dependencies.properties b/dependencies.properties index 2f967a20b9..c56dcf703b 100644 --- a/dependencies.properties +++ b/dependencies.properties @@ -5,4 +5,4 @@ flan=5290172 lootr=5893109 emi=1.0.24+1.20.1 spark=1.10.109-neoforge -curios=5.6.1+1.20.1 \ No newline at end of file +curios=9.2.2+1.21.1 \ No newline at end of file diff --git a/src/main/java/org/violetmoon/quark/addons/oddities/block/CrateBlock.java b/src/main/java/org/violetmoon/quark/addons/oddities/block/CrateBlock.java index 8629e56143..9afbef67d1 100644 --- a/src/main/java/org/violetmoon/quark/addons/oddities/block/CrateBlock.java +++ b/src/main/java/org/violetmoon/quark/addons/oddities/block/CrateBlock.java @@ -5,7 +5,6 @@ import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.util.RandomSource; -import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.MenuProvider; import net.minecraft.world.entity.LivingEntity; @@ -25,11 +24,8 @@ import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.BooleanProperty; import net.minecraft.world.phys.BlockHitResult; -import net.minecraftforge.network.NetworkHooks; - import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; - import org.violetmoon.quark.addons.oddities.block.be.CrateBlockEntity; import org.violetmoon.quark.addons.oddities.module.CrateModule; import org.violetmoon.zeta.block.ZetaBlock; @@ -79,7 +75,7 @@ public InteractionResult useWithoutItem(@NotNull BlockState state, Level worldIn BlockEntity be = worldIn.getBlockEntity(pos); if(be instanceof CrateBlockEntity crate) { if(player instanceof ServerPlayer serverPlayer) - NetworkHooks.openScreen(serverPlayer, crate, pos); + serverPlayer.openMenu(crate); PiglinAi.angerNearbyPiglins(player, true); } @@ -93,7 +89,7 @@ public void setPlacedBy(@NotNull Level worldIn, @NotNull BlockPos pos, @NotNull if(stack.getComponents().has(DataComponents.CUSTOM_NAME)) { BlockEntity tileentity = worldIn.getBlockEntity(pos); if(tileentity instanceof CrateBlockEntity crate) - crate.setComponents(stack.getHoverName()); + crate.setComponents(stack.getComponents()); } } diff --git a/src/main/java/org/violetmoon/quark/addons/oddities/block/MovingMagnetizedBlock.java b/src/main/java/org/violetmoon/quark/addons/oddities/block/MovingMagnetizedBlock.java index 6ade661898..471d694da1 100644 --- a/src/main/java/org/violetmoon/quark/addons/oddities/block/MovingMagnetizedBlock.java +++ b/src/main/java/org/violetmoon/quark/addons/oddities/block/MovingMagnetizedBlock.java @@ -2,7 +2,6 @@ import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; -import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; @@ -21,7 +20,6 @@ import net.minecraft.world.level.storage.loot.LootParams; import net.minecraft.world.level.storage.loot.parameters.LootContextParams; import net.minecraft.world.phys.BlockHitResult; -import net.minecraft.world.phys.HitResult; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.Shapes; import net.minecraft.world.phys.shapes.VoxelShape; diff --git a/src/main/java/org/violetmoon/quark/addons/oddities/block/be/MatrixEnchantingTableBlockEntity.java b/src/main/java/org/violetmoon/quark/addons/oddities/block/be/MatrixEnchantingTableBlockEntity.java index 77a136f7e0..253a914321 100644 --- a/src/main/java/org/violetmoon/quark/addons/oddities/block/be/MatrixEnchantingTableBlockEntity.java +++ b/src/main/java/org/violetmoon/quark/addons/oddities/block/be/MatrixEnchantingTableBlockEntity.java @@ -2,6 +2,7 @@ import com.google.common.collect.Lists; import net.minecraft.core.BlockPos; +import net.minecraft.core.HolderLookup; import net.minecraft.core.particles.ParticleOptions; import net.minecraft.core.particles.ParticleTypes; import net.minecraft.core.registries.BuiltInRegistries; @@ -317,8 +318,8 @@ private float getEnchantPowerAt(Level world, BlockPos pos) { } @Override - public void writeSharedNBT(CompoundTag cmp) { - super.writeSharedNBT(cmp); + public void writeSharedNBT(CompoundTag cmp, HolderLookup.Provider provider) { + super.writeSharedNBT(cmp, provider); CompoundTag matrixCmp = new CompoundTag(); if(matrix != null) { @@ -334,8 +335,8 @@ public void writeSharedNBT(CompoundTag cmp) { } @Override - public void readSharedNBT(CompoundTag cmp) { - super.readSharedNBT(cmp); + public void readSharedNBT(CompoundTag cmp, HolderLookup.Provider provider) { + super.readSharedNBT(cmp, provider); if(cmp.contains(TAG_MATRIX)) { long least = cmp.getLong(TAG_MATRIX_UUID_LESS); diff --git a/src/main/java/org/violetmoon/quark/addons/oddities/capability/MagnetTracker.java b/src/main/java/org/violetmoon/quark/addons/oddities/capability/MagnetTracker.java index b51f359b95..e0d7940b07 100644 --- a/src/main/java/org/violetmoon/quark/addons/oddities/capability/MagnetTracker.java +++ b/src/main/java/org/violetmoon/quark/addons/oddities/capability/MagnetTracker.java @@ -7,10 +7,8 @@ import net.minecraft.core.Direction; import net.minecraft.core.Vec3i; import net.minecraft.world.level.Level; -import net.minecraft.world.level.block.ComposterBlock; import net.minecraft.world.level.block.state.BlockState; -import org.violetmoon.quark.addons.oddities.block.MagnetBlock; import org.violetmoon.quark.api.IMagnetTracker; import java.util.Collection; diff --git a/src/main/java/org/violetmoon/quark/addons/oddities/client/render/be/PipeRenderer.java b/src/main/java/org/violetmoon/quark/addons/oddities/client/render/be/PipeRenderer.java index cc692d4562..a569f092f4 100644 --- a/src/main/java/org/violetmoon/quark/addons/oddities/client/render/be/PipeRenderer.java +++ b/src/main/java/org/violetmoon/quark/addons/oddities/client/render/be/PipeRenderer.java @@ -15,7 +15,6 @@ import net.minecraft.client.resources.model.ModelManager; import net.minecraft.client.resources.model.ModelResourceLocation; import net.minecraft.core.Direction; -import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemDisplayContext; import net.minecraft.world.item.ItemStack; diff --git a/src/main/java/org/violetmoon/quark/addons/oddities/client/screen/MatrixEnchantingPieceList.java b/src/main/java/org/violetmoon/quark/addons/oddities/client/screen/MatrixEnchantingPieceList.java index 4c50db5ab2..3d54b2908b 100644 --- a/src/main/java/org/violetmoon/quark/addons/oddities/client/screen/MatrixEnchantingPieceList.java +++ b/src/main/java/org/violetmoon/quark/addons/oddities/client/screen/MatrixEnchantingPieceList.java @@ -17,7 +17,7 @@ public class MatrixEnchantingPieceList extends ObjectSelectionList handlerOpt = stack.getCapability(ForgeCapabilities.ITEM_HANDLER, null); + Optional handlerOpt = Optional.ofNullable(stack.getCapability(Capabilities.ItemHandler.ITEM, null)); - if(!handlerOpt.isPresent()) + if(handlerOpt.isEmpty()) return false; IItemHandler handler = handlerOpt.orElse(new ItemStackHandler()); @@ -101,8 +97,8 @@ public static boolean doesBackpackHaveItems(ItemStack stack) { } @Override - public boolean canEquipZeta(ItemStack stack, EquipmentSlot equipmentSlot, Entity ent) { - return equipmentSlot == EquipmentSlot.CHEST; + public boolean canEquipZeta(ItemStack stack, EquipmentSlot armorType, LivingEntity entity) { + return armorType == EquipmentSlot.CHEST; } @Override @@ -110,21 +106,11 @@ public boolean isBookEnchantableZeta(ItemStack stack, ItemStack book) { return false; } - @Override - public boolean canApplyAtEnchantingTableZeta(ItemStack stack, Enchantment enchantment) { - return false; - } - @Override public int getEnchantmentValueZeta(ItemStack stack) { return 0; } - @Override - public boolean canBeDepleted() { - return false; - } - @Override public int damageItemZeta(ItemStack stack, int amount, T entity, Consumer onBroken) { return 0; @@ -132,13 +118,12 @@ public int damageItemZeta(ItemStack stack, int amount, @Override public void inventoryTick(@NotNull ItemStack stack, Level worldIn, @NotNull Entity entityIn, int itemSlot, boolean isSelected) { - if(worldIn.isClientSide) - return; + if(worldIn.isClientSide) return; boolean hasItems = !BackpackModule.superOpMode && doesBackpackHaveItems(stack); - Map enchants = EnchantmentHelper.getEnchantments(stack); boolean isCursed = enchants.containsKey(Enchantments.BINDING_CURSE); + boolean changedEnchants = false; if(hasItems) { @@ -149,7 +134,7 @@ public void inventoryTick(@NotNull ItemStack stack, Level worldIn, @NotNull Enti } if(BackpackModule.itemsInBackpackTick) { - LazyOptional handlerOpt = stack.getCapability(ForgeCapabilities.ITEM_HANDLER, null); + Optional handlerOpt = Optional.ofNullable(stack.getCapability(Capabilities.ItemHandler.ITEM, null)); IItemHandler handler = handlerOpt.orElse(new ItemStackHandler()); for(int i = 0; i < handler.getSlots(); i++) { ItemStack inStack = handler.getStackInSlot(i); @@ -173,16 +158,11 @@ public void inventoryTick(@NotNull ItemStack stack, Level worldIn, @NotNull Enti @Override public boolean onEntityItemUpdateZeta(ItemStack stack, ItemEntity entityItem) { - if(BackpackModule.superOpMode || entityItem.level().isClientSide) - return false; + if (BackpackModule.superOpMode || entityItem.level().isClientSide) return false; - if(!stack.hasTag()) - return false; - - LazyOptional handlerOpt = stack.getCapability(ForgeCapabilities.ITEM_HANDLER, null); + Optional handlerOpt = Optional.ofNullable(stack.getCapability(Capabilities.ItemHandler.ITEM, null)); - if(!handlerOpt.isPresent()) - return false; + if (handlerOpt.isEmpty()) return false; IItemHandler handler = handlerOpt.orElse(new ItemStackHandler()); diff --git a/src/main/java/org/violetmoon/quark/addons/oddities/magnetsystem/DefaultMoveActions.java b/src/main/java/org/violetmoon/quark/addons/oddities/magnetsystem/DefaultMoveActions.java index c1b326bfe8..054bcf8150 100644 --- a/src/main/java/org/violetmoon/quark/addons/oddities/magnetsystem/DefaultMoveActions.java +++ b/src/main/java/org/violetmoon/quark/addons/oddities/magnetsystem/DefaultMoveActions.java @@ -1,39 +1,34 @@ package org.violetmoon.quark.addons.oddities.magnetsystem; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - import com.mojang.authlib.GameProfile; -import net.minecraft.server.level.ServerLevel; -import net.minecraft.world.InteractionHand; -import net.minecraft.world.entity.Entity; -import net.minecraft.world.item.Items; -import net.minecraft.world.item.enchantment.EnchantmentHelper; -import net.minecraft.world.item.enchantment.Enchantments; -import net.minecraft.world.level.block.*; -import net.minecraft.world.level.gameevent.GameEvent; -import net.minecraft.world.level.material.FluidState; -import net.neoforged.neoforge.common.util.FakePlayer; -import net.neoforged.neoforge.common.util.FakePlayerFactory; -import org.violetmoon.quark.addons.oddities.module.MagnetsModule; -import org.violetmoon.quark.api.IMagnetMoveAction; - import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; +import net.minecraft.core.registries.Registries; +import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundSource; +import net.minecraft.world.InteractionHand; import net.minecraft.world.entity.item.ItemEntity; import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.world.item.enchantment.Enchantments; import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.*; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.HopperBlockEntity; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.properties.DoubleBlockHalf; +import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.level.material.FluidState; import net.minecraft.world.phys.Vec3; -import net.minecraftforge.common.IPlantable; +import net.neoforged.neoforge.common.SpecialPlantable; +import net.neoforged.neoforge.common.util.FakePlayer; +import net.neoforged.neoforge.common.util.FakePlayerFactory; +import org.violetmoon.quark.addons.oddities.module.MagnetsModule; +import org.violetmoon.quark.api.IMagnetMoveAction; -import javax.annotation.Nullable; +import java.util.HashMap; +import java.util.UUID; public class DefaultMoveActions { @@ -72,7 +67,7 @@ private static boolean destroyBlockWithSilkTouch(BlockState blockstate, BlockPos FakePlayer player = FakePlayerFactory.get(level, FAKE_PLAYER_PROFILE); ItemStack tool = Items.IRON_PICKAXE.getDefaultInstance(); - EnchantmentHelper.setEnchantments(Map.of(Enchantments.SILK_TOUCH, 1), tool); + tool.enchant(level.registryAccess().holderOrThrow(Registries.ENCHANTMENT).value().getHolderOrThrow(Enchantments.SILK_TOUCH), 1); player.setItemInHand(InteractionHand.MAIN_HAND, tool); BlockEntity blockentity = blockstate.hasBlockEntity() ? level.getBlockEntity(pPos) : null; @@ -113,9 +108,9 @@ private static void hopperMoved(Level world, BlockPos pos, Direction direction, if(world.isEmptyBlock(groundPos)) groundPos = groundPos.below(); Block seedType = blockItem.getBlock(); - if(seedType instanceof IPlantable plantable) { + if(seedType instanceof SpecialPlantable) { BlockState groundBlock = world.getBlockState(groundPos); - if(groundBlock.getBlock().canSustainPlant(groundBlock, world, groundPos,Direction.UP, plantable)) { + if(groundBlock.getBlock().canSustainPlant(groundBlock, world, groundPos,Direction.UP, state).isTrue()) { BlockPos seedPos = groundPos.above(); if(state.canSurvive(world, seedPos)) { BlockState seedState = seedType.defaultBlockState(); diff --git a/src/main/java/org/violetmoon/quark/addons/oddities/magnetsystem/MagnetSystem.java b/src/main/java/org/violetmoon/quark/addons/oddities/magnetsystem/MagnetSystem.java index a86762dc21..b43c5418c0 100644 --- a/src/main/java/org/violetmoon/quark/addons/oddities/magnetsystem/MagnetSystem.java +++ b/src/main/java/org/violetmoon/quark/addons/oddities/magnetsystem/MagnetSystem.java @@ -1,13 +1,11 @@ package org.violetmoon.quark.addons.oddities.magnetsystem; -import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.List; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.world.item.Item; -import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.level.block.entity.BlockEntity; import org.jetbrains.annotations.Nullable; diff --git a/src/main/java/org/violetmoon/quark/addons/oddities/module/BackpackModule.java b/src/main/java/org/violetmoon/quark/addons/oddities/module/BackpackModule.java index ef0a0603cf..9a7c58cb13 100644 --- a/src/main/java/org/violetmoon/quark/addons/oddities/module/BackpackModule.java +++ b/src/main/java/org/violetmoon/quark/addons/oddities/module/BackpackModule.java @@ -1,29 +1,5 @@ package org.violetmoon.quark.addons.oddities.module; -import org.violetmoon.quark.addons.oddities.client.screen.BackpackInventoryScreen; -import org.violetmoon.quark.addons.oddities.inventory.BackpackMenu; -import org.violetmoon.quark.addons.oddities.item.BackpackItem; -import org.violetmoon.quark.base.Quark; -import org.violetmoon.quark.base.QuarkClient; -import org.violetmoon.quark.base.client.handler.ModelHandler; -import org.violetmoon.quark.base.network.message.oddities.HandleBackpackMessage; -import org.violetmoon.zeta.block.ZetaBlock; -import org.violetmoon.zeta.client.event.load.ZAddItemColorHandlers; -import org.violetmoon.zeta.client.event.load.ZClientSetup; -import org.violetmoon.zeta.client.event.play.ZClientTick; -import org.violetmoon.zeta.client.event.play.ZScreen; -import org.violetmoon.zeta.config.Config; -import org.violetmoon.zeta.event.bus.LoadEvent; -import org.violetmoon.zeta.event.bus.PlayEvent; -import org.violetmoon.zeta.event.load.ZCommonSetup; -import org.violetmoon.zeta.event.load.ZRegister; -import org.violetmoon.zeta.event.play.entity.living.ZLivingDrops; -import org.violetmoon.zeta.event.play.entity.player.ZPlayerInteract; -import org.violetmoon.zeta.item.ZetaItem; -import org.violetmoon.zeta.module.ZetaLoadModule; -import org.violetmoon.zeta.module.ZetaModule; -import org.violetmoon.zeta.util.Hint; - import net.minecraft.client.Minecraft; import net.minecraft.client.color.item.ItemColor; import net.minecraft.client.gui.screens.MenuScreens; @@ -32,7 +8,6 @@ import net.minecraft.client.renderer.item.ItemProperties; import net.minecraft.core.cauldron.CauldronInteraction; import net.minecraft.core.registries.Registries; -import net.minecraft.resources.ResourceLocation; import net.minecraft.sounds.SoundEvents; import net.minecraft.tags.ItemTags; import net.minecraft.tags.TagKey; @@ -46,18 +21,36 @@ import net.minecraft.world.entity.item.ItemEntity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.inventory.MenuType; -import net.minecraft.world.item.CreativeModeTabs; -import net.minecraft.world.item.DyeColor; -import net.minecraft.world.item.DyeableArmorItem; -import net.minecraft.world.item.Item; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.Items; -import net.minecraft.world.item.Rarity; -import net.minecraft.world.item.enchantment.Enchantments; +import net.minecraft.world.item.*; +import net.minecraft.world.item.component.DyedItemColor; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.SoundType; import net.minecraft.world.level.block.state.properties.NoteBlockInstrument; import net.minecraftforge.common.extensions.IForgeMenuType; +import org.violetmoon.quark.addons.oddities.client.screen.BackpackInventoryScreen; +import org.violetmoon.quark.addons.oddities.inventory.BackpackMenu; +import org.violetmoon.quark.addons.oddities.item.BackpackItem; +import org.violetmoon.quark.base.Quark; +import org.violetmoon.quark.base.QuarkClient; +import org.violetmoon.quark.base.client.handler.ModelHandler; +import org.violetmoon.quark.base.network.message.oddities.HandleBackpackMessage; +import org.violetmoon.zeta.block.ZetaBlock; +import org.violetmoon.zeta.client.event.load.ZAddItemColorHandlers; +import org.violetmoon.zeta.client.event.load.ZClientSetup; +import org.violetmoon.zeta.client.event.play.ZClientTick; +import org.violetmoon.zeta.client.event.play.ZScreen; +import org.violetmoon.zeta.config.Config; +import org.violetmoon.zeta.event.bus.LoadEvent; +import org.violetmoon.zeta.event.bus.PlayEvent; +import org.violetmoon.zeta.event.bus.ZPhase; +import org.violetmoon.zeta.event.load.ZCommonSetup; +import org.violetmoon.zeta.event.load.ZRegister; +import org.violetmoon.zeta.event.play.entity.living.ZLivingDrops; +import org.violetmoon.zeta.event.play.entity.player.ZPlayerInteract; +import org.violetmoon.zeta.item.ZetaItem; +import org.violetmoon.zeta.module.ZetaLoadModule; +import org.violetmoon.zeta.module.ZetaModule; +import org.violetmoon.zeta.util.Hint; @ZetaLoadModule(category = "oddities") public class BackpackModule extends ZetaModule { @@ -108,7 +101,7 @@ public final void register(ZRegister event) { .setCondition(() -> enableRavagerHide) .setCreativeTab(CreativeModeTabs.BUILDING_BLOCKS); - CauldronInteraction.WATER.put(backpack, CauldronInteraction.DYED_ITEM); + CauldronInteraction.WATER.map().put(backpack, CauldronInteraction.DYED_ITEM); } @LoadEvent @@ -203,16 +196,18 @@ public void clientSetup(ZClientSetup e) { @PlayEvent public void onOpenGUI(ZScreen.Opening event) { Player player = Minecraft.getInstance().player; - if(player != null && isInventoryGUI(event.getScreen()) && !player.getAbilities().instabuild && isEntityWearingBackpack(player) && !player.isInsidePortal) { + if(player != null && isInventoryGUI(event.getScreen()) && !player.getAbilities().instabuild && isEntityWearingBackpack(player) && !player.portalProcess.isInsidePortalThisTick()) { requestBackpack(); event.setCanceled(true); } } @PlayEvent - public void clientTick(ZClientTick.Start event) { + public void clientTick(ZClientTick event) { + if (event.getPhase() != ZPhase.START) return; + Minecraft mc = Minecraft.getInstance(); - if(isInventoryGUI(mc.screen) && !backpackRequested && isEntityWearingBackpack(mc.player) && !mc.player.isInsidePortal) { + if(isInventoryGUI(mc.screen) && !backpackRequested && isEntityWearingBackpack(mc.player) && !mc.player.portalProcess.isInsidePortalThisTick()) { requestBackpack(); mc.player.inventoryMenu.setCarried(mc.player.getItemBySlot(EquipmentSlot.CHEST)); backpackRequested = true; @@ -228,7 +223,7 @@ public void clientTick(ZClientTick.Start event) { @LoadEvent public void registerItemColors(ZAddItemColorHandlers event) { - ItemColor color = (stack, i) -> i > 0 ? -1 : ((DyeableArmorItem) stack.getItem()).getColor(stack); + ItemColor color = (stack, i) -> i > 0 ? -1 : DyedItemColor.getOrDefault(stack, -6265536); event.register(color, backpack); } diff --git a/src/main/java/org/violetmoon/quark/addons/oddities/module/MagnetsModule.java b/src/main/java/org/violetmoon/quark/addons/oddities/module/MagnetsModule.java index da5b845d9f..ac0b989337 100644 --- a/src/main/java/org/violetmoon/quark/addons/oddities/module/MagnetsModule.java +++ b/src/main/java/org/violetmoon/quark/addons/oddities/module/MagnetsModule.java @@ -15,7 +15,6 @@ import org.violetmoon.quark.addons.oddities.client.render.be.MagnetizedBlockRenderer; import org.violetmoon.quark.addons.oddities.magnetsystem.MagnetSystem; import org.violetmoon.quark.base.Quark; -import org.violetmoon.quark.content.automation.block.IronRodBlock; import org.violetmoon.zeta.client.event.load.ZClientSetup; import org.violetmoon.zeta.config.Config; import org.violetmoon.zeta.event.bus.LoadEvent; @@ -26,7 +25,6 @@ import org.violetmoon.zeta.module.ZetaLoadModule; import org.violetmoon.zeta.module.ZetaModule; import org.violetmoon.zeta.util.Hint; -import org.violetmoon.zeta.util.handler.RecipeCrawlHandler; import org.violetmoon.zeta.util.handler.ToolInteractionHandler; import java.util.List; diff --git a/src/main/java/org/violetmoon/quark/addons/oddities/module/MatrixEnchantingModule.java b/src/main/java/org/violetmoon/quark/addons/oddities/module/MatrixEnchantingModule.java index cf2ee3bf7b..175a9e7a23 100644 --- a/src/main/java/org/violetmoon/quark/addons/oddities/module/MatrixEnchantingModule.java +++ b/src/main/java/org/violetmoon/quark/addons/oddities/module/MatrixEnchantingModule.java @@ -19,7 +19,7 @@ import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; import net.minecraftforge.common.extensions.IForgeMenuType; -import net.minecraftforge.common.util.FakePlayer; +import net.neoforged.neoforge.common.util.FakePlayer; import org.violetmoon.quark.addons.oddities.block.MatrixEnchantingTableBlock; import org.violetmoon.quark.addons.oddities.block.be.MatrixEnchantingTableBlockEntity; import org.violetmoon.quark.addons.oddities.client.render.be.MatrixEnchantingTableRenderer; diff --git a/src/main/java/org/violetmoon/quark/addons/oddities/module/PipesModule.java b/src/main/java/org/violetmoon/quark/addons/oddities/module/PipesModule.java index b50bca2dd0..bad3713e5f 100644 --- a/src/main/java/org/violetmoon/quark/addons/oddities/module/PipesModule.java +++ b/src/main/java/org/violetmoon/quark/addons/oddities/module/PipesModule.java @@ -3,7 +3,6 @@ import net.minecraft.client.renderer.blockentity.BlockEntityRenderers; import net.minecraft.client.resources.model.ModelResourceLocation; import net.minecraft.core.registries.Registries; -import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.BlockTags; import net.minecraft.tags.TagKey; import net.minecraft.world.level.block.Block; diff --git a/src/main/java/org/violetmoon/quark/base/Quark.java b/src/main/java/org/violetmoon/quark/base/Quark.java index 52bed50375..6eb65dceb0 100644 --- a/src/main/java/org/violetmoon/quark/base/Quark.java +++ b/src/main/java/org/violetmoon/quark/base/Quark.java @@ -33,6 +33,18 @@ public class Quark { public static Quark instance; public static CommonProxy proxy; + public Quark(IEventBus bus) { + instance = this; + + ZETA.start(bus); + + proxy = Env.unsafeRunForDist(() -> ClientProxy::new, () -> CommonProxy::new); + proxy.start(); + + if (!ZETA.isProduction) // force all mixins to load in dev + MixinEnvironment.getCurrentEnvironment().audit(); + } + /* public static final IClaimIntegration FLAN_INTEGRATION = ZETA.modIntegration("flan", () -> FlanIntegration::new, @@ -47,17 +59,6 @@ public class Quark { () -> TerrablenderUndergroundBiomeHandler::new, () -> VanillaUndergroundBiomeHandler::new); - public Quark(IEventBus bus) { - instance = this; - - ZETA.start(bus); - - proxy = Env.unsafeRunForDist(() -> ClientProxy::new, () -> CommonProxy::new); - proxy.start(); - - if (!ZETA.isProduction) // force all mixins to load in dev - MixinEnvironment.getCurrentEnvironment().audit(); - } public static ResourceLocation asResource(String path) { return ResourceLocation.fromNamespaceAndPath(MOD_ID, path); } diff --git a/src/main/java/org/violetmoon/quark/base/client/config/QButtonHandler.java b/src/main/java/org/violetmoon/quark/base/client/config/QButtonHandler.java index 1adb0f8340..dc2c9e8753 100644 --- a/src/main/java/org/violetmoon/quark/base/client/config/QButtonHandler.java +++ b/src/main/java/org/violetmoon/quark/base/client/config/QButtonHandler.java @@ -1,8 +1,5 @@ package org.violetmoon.quark.base.client.config; -import com.google.common.collect.ImmutableSet; - -import net.minecraft.client.Minecraft; import net.minecraft.client.gui.components.AbstractWidget; import net.minecraft.client.gui.components.Button; import net.minecraft.client.gui.components.events.GuiEventListener; diff --git a/src/main/java/org/violetmoon/quark/base/client/config/QuarkConfigHomeScreen.java b/src/main/java/org/violetmoon/quark/base/client/config/QuarkConfigHomeScreen.java index 0658836da6..92cf0b7c20 100644 --- a/src/main/java/org/violetmoon/quark/base/client/config/QuarkConfigHomeScreen.java +++ b/src/main/java/org/violetmoon/quark/base/client/config/QuarkConfigHomeScreen.java @@ -8,7 +8,6 @@ import net.minecraft.client.renderer.PanoramaRenderer; import net.minecraft.client.resources.language.I18n; import net.minecraft.network.chat.Component; -import net.minecraft.resources.ResourceLocation; import org.jetbrains.annotations.NotNull; diff --git a/src/main/java/org/violetmoon/quark/base/client/handler/ModelHandler.java b/src/main/java/org/violetmoon/quark/base/client/handler/ModelHandler.java index 5a43824e1e..fdcaa5e30f 100644 --- a/src/main/java/org/violetmoon/quark/base/client/handler/ModelHandler.java +++ b/src/main/java/org/violetmoon/quark/base/client/handler/ModelHandler.java @@ -7,7 +7,6 @@ import net.minecraft.client.model.geom.ModelLayerLocation; import net.minecraft.client.model.geom.ModelPart; import net.minecraft.client.model.geom.builders.LayerDefinition; -import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.Mob; diff --git a/src/main/java/org/violetmoon/quark/base/handler/InventoryTransferHandler.java b/src/main/java/org/violetmoon/quark/base/handler/InventoryTransferHandler.java index 330620961f..2aeb369ccd 100644 --- a/src/main/java/org/violetmoon/quark/base/handler/InventoryTransferHandler.java +++ b/src/main/java/org/violetmoon/quark/base/handler/InventoryTransferHandler.java @@ -1,11 +1,18 @@ package org.violetmoon.quark.base.handler; -import java.util.ArrayList; -import java.util.List; -import java.util.function.BiPredicate; - import net.minecraft.client.gui.screens.inventory.CreativeModeInventoryScreen; +import net.minecraft.world.Container; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.AbstractContainerMenu; import net.minecraft.world.inventory.CraftingMenu; +import net.minecraft.world.inventory.Slot; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.neoforged.neoforge.items.IItemHandler; +import net.neoforged.neoforge.items.ItemHandlerHelper; +import net.neoforged.neoforge.items.SlotItemHandler; +import net.neoforged.neoforge.items.wrapper.InvWrapper; import org.apache.commons.lang3.tuple.Pair; import org.jetbrains.annotations.NotNull; import org.violetmoon.quark.api.IQuarkButtonAllowed; @@ -15,17 +22,9 @@ import org.violetmoon.quark.base.config.QuarkGeneralConfig; import org.violetmoon.quark.content.management.module.EasyTransferingModule; -import net.minecraft.world.Container; -import net.minecraft.world.entity.player.Inventory; -import net.minecraft.world.entity.player.Player; -import net.minecraft.world.inventory.AbstractContainerMenu; -import net.minecraft.world.inventory.Slot; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.level.block.entity.BlockEntity; -import net.minecraftforge.items.IItemHandler; -import net.minecraftforge.items.ItemHandlerHelper; -import net.minecraftforge.items.SlotItemHandler; -import net.minecraftforge.items.wrapper.InvWrapper; +import java.util.ArrayList; +import java.util.List; +import java.util.function.BiPredicate; public class InventoryTransferHandler { @@ -130,7 +129,7 @@ public void smartTransfer() { boolean itemEqual = stack.getItem() == stackAt.getItem(); boolean damageEqual = stack.getDamageValue() == stackAt.getDamageValue(); - boolean nbtEqual = ItemStack.isSameItemSameTags(stackAt, stack); + boolean nbtEqual = ItemStack.isSameItemSameComponents(stackAt, stack); if(itemEqual && damageEqual && nbtEqual) return true; @@ -228,7 +227,7 @@ public Restock(Player player, boolean filtered) { @Override public void transfer(TransferPredicate predicate) { - IItemHandler inv = itemHandlers.get(0).getLeft(); + IItemHandler inv = itemHandlers.getFirst().getLeft(); IItemHandler playerInv = new PlayerInvWrapper(player.getInventory()); for(int i = inv.getSlots() - 1; i >= 0; i--) { diff --git a/src/main/java/org/violetmoon/quark/base/handler/QuarkRemapHandler.java b/src/main/java/org/violetmoon/quark/base/handler/QuarkRemapHandler.java index 8ca219fa91..895c26c3f5 100644 --- a/src/main/java/org/violetmoon/quark/base/handler/QuarkRemapHandler.java +++ b/src/main/java/org/violetmoon/quark/base/handler/QuarkRemapHandler.java @@ -1,12 +1,6 @@ package org.violetmoon.quark.base.handler; -import net.minecraft.core.DefaultedRegistry; -import net.minecraft.core.registries.BuiltInRegistries; -import net.minecraft.resources.ResourceLocation; -import net.minecraftforge.eventbus.api.SubscribeEvent; -import net.minecraftforge.registries.MissingMappingsEvent; import net.neoforged.fml.common.EventBusSubscriber; -import org.violetmoon.quark.base.Quark; import java.util.HashMap; import java.util.Map; @@ -14,6 +8,7 @@ @EventBusSubscriber public class QuarkRemapHandler { //datafixers could have also been used here but good luck figuring them out + // TODO: Replace with Registry#addAlias/DataFixers private static final Map REMAP = new HashMap<>(); @@ -36,13 +31,13 @@ public class QuarkRemapHandler { REMAP.put("quark:egg_parrot_grey", "quark:egg_parrot_gray"); } + /* @SubscribeEvent public static void onRemapBlocks(MissingMappingsEvent event) { remapAll(event, BuiltInRegistries.BLOCK); remapAll(event, BuiltInRegistries.ITEM); } - private static void remapAll(MissingMappingsEvent event, DefaultedRegistry block) { for (var v : event.getMappings(block.key(), Quark.MOD_ID)) { String rem = REMAP.get(v.getKey().toString()); @@ -52,4 +47,5 @@ private static void remapAll(MissingMappingsEvent event, DefaultedRegistry effects1 = PotionUtils.getCustomEffects(stack1); - List effects2 = PotionUtils.getCustomEffects(stack2); + List effects1 = new ArrayList<>(); + stack1.get(DataComponents.POTION_CONTENTS).getAllEffects().forEach(effects1::add); + List effects2 = new ArrayList<>(); + stack2.get(DataComponents.POTION_CONTENTS).getAllEffects().forEach(effects2::add); int totalPower1 = 0; int totalPower2 = 0; diff --git a/src/main/java/org/violetmoon/quark/base/network/QuarkNetwork.java b/src/main/java/org/violetmoon/quark/base/network/QuarkNetwork.java index dab4f9be4d..9737a4ae63 100644 --- a/src/main/java/org/violetmoon/quark/base/network/QuarkNetwork.java +++ b/src/main/java/org/violetmoon/quark/base/network/QuarkNetwork.java @@ -1,7 +1,6 @@ package org.violetmoon.quark.base.network; import java.time.Instant; -import java.util.BitSet; import org.violetmoon.quark.base.Quark; import org.violetmoon.quark.base.network.message.ChangeHotbarMessage; diff --git a/src/main/java/org/violetmoon/quark/base/network/message/oddities/HandleBackpackMessage.java b/src/main/java/org/violetmoon/quark/base/network/message/oddities/HandleBackpackMessage.java index 901687e2e1..4a4d4dac1f 100644 --- a/src/main/java/org/violetmoon/quark/base/network/message/oddities/HandleBackpackMessage.java +++ b/src/main/java/org/violetmoon/quark/base/network/message/oddities/HandleBackpackMessage.java @@ -4,8 +4,6 @@ import net.minecraft.world.MenuProvider; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.item.ItemStack; -import net.minecraftforge.network.NetworkHooks; - import org.violetmoon.quark.addons.oddities.inventory.BackpackMenu; import org.violetmoon.zeta.network.IZetaMessage; import org.violetmoon.zeta.network.IZetaNetworkEventContext; @@ -34,7 +32,7 @@ public boolean receive(IZetaNetworkEventContext context) { if(stack.getItem() instanceof MenuProvider && player.containerMenu != null) { ItemStack holding = player.containerMenu.getCarried().copy(); player.containerMenu.setCarried(ItemStack.EMPTY); - NetworkHooks.openScreen(player, (MenuProvider) stack.getItem(), player.blockPosition()); + player.openMenu((MenuProvider) stack.getItem()); player.containerMenu.setCarried(holding); } } else { diff --git a/src/main/java/org/violetmoon/quark/base/util/InventoryIIH.java b/src/main/java/org/violetmoon/quark/base/util/InventoryIIH.java index ecd265cc76..c9ec9a9d3b 100644 --- a/src/main/java/org/violetmoon/quark/base/util/InventoryIIH.java +++ b/src/main/java/org/violetmoon/quark/base/util/InventoryIIH.java @@ -1,12 +1,13 @@ package org.violetmoon.quark.base.util; import net.minecraft.world.item.ItemStack; -import net.minecraftforge.common.capabilities.ForgeCapabilities; -import net.minecraftforge.common.util.LazyOptional; +import net.neoforged.neoforge.capabilities.Capabilities; import net.neoforged.neoforge.items.IItemHandler; import net.neoforged.neoforge.items.IItemHandlerModifiable; import org.jetbrains.annotations.NotNull; +import java.util.Optional; + // formerly from AutoRegLib public class InventoryIIH implements IItemHandlerModifiable { @@ -15,7 +16,7 @@ public class InventoryIIH implements IItemHandlerModifiable { public InventoryIIH(ItemStack stack) { this.stack = stack; - LazyOptional opt = stack.getCapability(ForgeCapabilities.ITEM_HANDLER, null); + Optional opt = Optional.ofNullable(stack.getCapability(Capabilities.ItemHandler.ITEM, null)); if(opt.isPresent()) { IItemHandler handler = opt.orElse(null); diff --git a/src/main/java/org/violetmoon/quark/content/automation/block/CrafterBlock.java b/src/main/java/org/violetmoon/quark/content/automation/block/CrafterBlock.java deleted file mode 100644 index c7c7b622d8..0000000000 --- a/src/main/java/org/violetmoon/quark/content/automation/block/CrafterBlock.java +++ /dev/null @@ -1,181 +0,0 @@ -/* - * The Cool MIT License (CMIT) - * - * Copyright (c) 2023 Emi - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, as long as the person is cool, subject to the following - * conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * The person is cool. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -package org.violetmoon.quark.content.automation.block; - -import net.minecraft.core.BlockPos; -import net.minecraft.core.Direction; -import net.minecraft.server.level.ServerLevel; -import net.minecraft.util.RandomSource; -import net.minecraft.util.StringRepresentable; -import net.minecraft.world.Containers; -import net.minecraft.world.InteractionResult; -import net.minecraft.world.entity.player.Player; -import net.minecraft.world.item.CreativeModeTabs; -import net.minecraft.world.item.context.BlockPlaceContext; -import net.minecraft.world.level.Level; -import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.block.EntityBlock; -import net.minecraft.world.level.block.RenderShape; -import net.minecraft.world.level.block.entity.BlockEntity; -import net.minecraft.world.level.block.entity.BlockEntityTicker; -import net.minecraft.world.level.block.entity.BlockEntityType; -import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.level.block.state.StateDefinition; -import net.minecraft.world.level.block.state.properties.BlockStateProperties; -import net.minecraft.world.level.block.state.properties.DirectionProperty; -import net.minecraft.world.level.block.state.properties.EnumProperty; -import net.minecraft.world.phys.BlockHitResult; -import org.jetbrains.annotations.Nullable; -import org.violetmoon.quark.content.automation.block.be.CrafterBlockEntity; -import org.violetmoon.quark.content.automation.module.CrafterModule; -import org.violetmoon.zeta.block.ZetaBlock; -import org.violetmoon.zeta.module.ZetaModule; - -public class CrafterBlock extends ZetaBlock implements EntityBlock { - public static final DirectionProperty FACING = BlockStateProperties.FACING; - public static final EnumProperty POWER = EnumProperty.create("power", PowerState.class); - - public CrafterBlock(String regname, @Nullable ZetaModule module, Properties properties) { - super(regname, module, properties); - registerDefaultState(this.stateDefinition.any().setValue(FACING, Direction.NORTH).setValue(POWER, PowerState.OFF)); - - if(module == null) //auto registration below this line - return; - - setCreativeTab(CreativeModeTabs.REDSTONE_BLOCKS); - } - - @Override - public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { - return new CrafterBlockEntity(pos, state); - } - - @Override - public InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) { - if (world.isClientSide) { - return InteractionResult.SUCCESS; - } else { - BlockEntity be = world.getBlockEntity(pos); - if (be instanceof CrafterBlockEntity cbe) { - player.openMenu(cbe); - } - - return InteractionResult.CONSUME; - } - } - - @SuppressWarnings("deprecation") - @Override - public void onRemove(BlockState state, Level world, BlockPos pos, BlockState newState, boolean moved) { - if (!state.is(newState.getBlock())) { - BlockEntity blockEntity = world.getBlockEntity(pos); - if (blockEntity instanceof CrafterBlockEntity cbe) { - Containers.dropContents(world, pos, cbe); - world.updateNeighbourForOutputSignal(pos, this); - } - super.onRemove(state, world, pos, newState, moved); - } - } - - @Override - public void tick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) { - boolean bl = world.hasNeighborSignal(pos) || world.hasNeighborSignal(pos.above()); - world.setBlock(pos, state.setValue(POWER, bl ? PowerState.ON : PowerState.OFF), 2); - } - - @Override - public void neighborChanged(BlockState state, Level world, BlockPos pos, Block sourceBlock, BlockPos sourcePos, boolean notify) { - PowerState powerState = state.getValue(POWER); - boolean bl = world.hasNeighborSignal(pos) || world.hasNeighborSignal(pos.above()); - boolean bl2 = powerState.powered(); - - if (bl && !bl2) { - world.scheduleTick(pos, this, 6); - ((CrafterBlockEntity) world.getBlockEntity(pos)).craft(); - world.setBlock(pos, state.setValue(POWER, PowerState.TRIGGERED), 2); - } else if (!bl && state.getValue(POWER) != PowerState.OFF) { - world.setBlock(pos, state.setValue(POWER, PowerState.OFF), 2); - } - } - - @Override - public boolean hasAnalogOutputSignal(BlockState state) { - return true; - } - - @Override - public int getAnalogOutputSignal(BlockState state, Level world, BlockPos pos) { - return ((CrafterBlockEntity) world.getBlockEntity(pos)).getComparatorOutput(); - } - - @Override - public BlockState getStateForPlacement(BlockPlaceContext ctx) { - return this.defaultBlockState().setValue(FACING, ctx.getHorizontalDirection().getOpposite()); - } - - @Override - public BlockEntityTicker getTicker(Level world, BlockState state, BlockEntityType type) { - return createTickerHelper(type, CrafterModule.blockEntityType, CrafterBlockEntity::tick); - } - - @Override - public RenderShape getRenderShape(BlockState state) { - return RenderShape.MODEL; - } - - @Override - protected void createBlockStateDefinition(StateDefinition.Builder builder) { - builder.add(FACING, POWER); - } - - public enum PowerState implements StringRepresentable { - OFF("off"), - TRIGGERED("triggered"), - ON("on"); - - private final String name; - - PowerState(String name) { - this.name = name; - } - - @Override - public String toString() { - return this.getSerializedName(); - } - - @Override - public String getSerializedName() { - return this.name; - } - - public boolean powered() { - return this != OFF; - } - } -} diff --git a/src/main/java/org/violetmoon/quark/content/automation/block/be/ChuteBlockEntity.java b/src/main/java/org/violetmoon/quark/content/automation/block/be/ChuteBlockEntity.java index 0a785604b2..431b2f0560 100644 --- a/src/main/java/org/violetmoon/quark/content/automation/block/be/ChuteBlockEntity.java +++ b/src/main/java/org/violetmoon/quark/content/automation/block/be/ChuteBlockEntity.java @@ -1,24 +1,21 @@ package org.violetmoon.quark.content.automation.block.be; -import net.minecraft.world.phys.AABB; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; -import org.violetmoon.quark.content.automation.block.ChuteBlock; -import org.violetmoon.quark.content.automation.module.ChuteModule; -import org.violetmoon.quark.content.building.module.GrateModule; -import org.violetmoon.quark.content.building.module.HollowLogsModule; -import org.violetmoon.zeta.block.be.ZetaBlockEntity; - import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.world.entity.item.ItemEntity; import net.minecraft.world.item.ItemStack; -import net.minecraft.world.level.block.RotatedPillarBlock; import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.AABB; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.ForgeCapabilities; import net.minecraftforge.common.util.LazyOptional; -import net.minecraftforge.items.IItemHandler; +import net.neoforged.neoforge.items.IItemHandler; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.violetmoon.quark.content.automation.block.ChuteBlock; +import org.violetmoon.quark.content.automation.module.ChuteModule; +import org.violetmoon.quark.content.building.module.GrateModule; +import org.violetmoon.zeta.block.be.ZetaBlockEntity; /** * @author WireSegal @@ -52,6 +49,7 @@ private boolean canDropItem() { } private final IItemHandler handler = new IItemHandler() { + @Override public int getSlots() { return 1; diff --git a/src/main/java/org/violetmoon/quark/content/automation/block/be/CrafterBlockEntity.java b/src/main/java/org/violetmoon/quark/content/automation/block/be/CrafterBlockEntity.java deleted file mode 100644 index eafffbad2d..0000000000 --- a/src/main/java/org/violetmoon/quark/content/automation/block/be/CrafterBlockEntity.java +++ /dev/null @@ -1,426 +0,0 @@ -/* - * The Cool MIT License (CMIT) - * - * Copyright (c) 2023 Emi - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, as long as the person is cool, subject to the following - * conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * The person is cool. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -package org.violetmoon.quark.content.automation.block.be; - -import net.minecraft.core.BlockPos; -import net.minecraft.core.Direction; -import net.minecraft.core.Direction.Axis; -import net.minecraft.core.NonNullList; -import net.minecraft.core.Position; -import net.minecraft.core.dispenser.BlockSource; -import net.minecraft.core.dispenser.DispenseItemBehavior; -import net.minecraft.nbt.ByteTag; -import net.minecraft.nbt.CompoundTag; -import net.minecraft.nbt.ListTag; -import net.minecraft.nbt.Tag; -import net.minecraft.network.chat.Component; -import net.minecraft.server.level.ServerLevel; -import net.minecraft.world.Container; -import net.minecraft.world.ContainerHelper; -import net.minecraft.world.WorldlyContainer; -import net.minecraft.world.entity.item.ItemEntity; -import net.minecraft.world.entity.player.Inventory; -import net.minecraft.world.entity.player.Player; -import net.minecraft.world.entity.player.StackedContents; -import net.minecraft.world.inventory.*; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.crafting.CraftingRecipe; -import net.minecraft.world.item.crafting.RecipeType; -import net.minecraft.world.level.Level; -import net.minecraft.world.level.block.entity.BaseContainerBlockEntity; -import net.minecraft.world.level.block.entity.HopperBlockEntity; -import net.minecraft.world.level.block.state.BlockState; -import org.violetmoon.quark.content.automation.block.CrafterBlock; -import org.violetmoon.quark.content.automation.inventory.CrafterMenu; -import org.violetmoon.quark.content.automation.module.CrafterModule; - -import java.util.Optional; -import java.util.stream.IntStream; - -public class CrafterBlockEntity extends BaseContainerBlockEntity implements CraftingContainer, WorldlyContainer { - private static final DispenseItemBehavior BEHAVIOR = new CraftDispenseBehavior(); - public final NonNullList stacks = NonNullList.withSize(9, ItemStack.EMPTY); - public final ResultContainer result = new ResultContainer(); - public final boolean[] blocked = new boolean[9]; - public final ContainerData delegate; - private boolean didInitialScan = false; - - - public CrafterBlockEntity(BlockPos pos, BlockState state) { - super(CrafterModule.blockEntityType, pos, state); - delegate = new ContainerData() { - - @Override - public int get(int index) { - int res = level.getBlockState(pos).getValue(CrafterBlock.POWER) == CrafterBlock.PowerState.TRIGGERED ? 1 : 0; - for (int i = 0; i < 9; i++) { - if (blocked[i]) { - res |= 1 << (i + 1); - } - } - return res; - } - - @Override - public void set(int index, int value) { - } - - @Override - public int getCount() { - return 1; - } - }; - } - - @Override - protected void saveAdditional(CompoundTag nbt) { - super.saveAdditional(nbt); - ListTag list = new ListTag(); - for (boolean b : blocked) { - list.add(ByteTag.valueOf(b)); - } - nbt.put("Blocked", list); - ContainerHelper.saveAllItems(nbt, stacks); - } - - @Override - public void load(CompoundTag nbt) { - super.load(nbt); - if (nbt.contains("Blocked")) { - ListTag list = nbt.getList("Blocked", Tag.TAG_BYTE); - for (int i = 0; i < list.size() && i < 9; i++) { - blocked[i] = ((ByteTag) list.get(i)).getAsByte() != 0; - } - } - ContainerHelper.loadAllItems(nbt, stacks); - } - - public void craft() { - if (level instanceof ServerLevel sw) { - // BlockSource blockSource = new BlockSource(sw, worldPosition, this.getBlockState(), null); - update(); - BlockSource blockSource = new BlockSourceImpl(sw, worldPosition); - ItemStack itemStack = result.getItem(0); - if (!itemStack.isEmpty()) { - Direction direction = this.getBlockState().getValue(CrafterBlock.FACING); - Container inventory = HopperBlockEntity.getContainerAt(level, worldPosition.relative(direction)); - if (inventory == null) { - BEHAVIOR.dispense(blockSource, itemStack); - } else { - if (!hasSpace(inventory, direction, itemStack)) { - return; - } - if (inventory instanceof CrafterBlockEntity) { - int count = itemStack.getCount(); - for (int i = 0; i < count; i++) { - ItemStack is = itemStack.copy(); - is.setCount(1); - HopperBlockEntity.addItem(result, inventory, is, direction.getOpposite()); - } - } else { - HopperBlockEntity.addItem(result, inventory, itemStack, direction.getOpposite()); - } - } - takeItems(); - update(); - } - } - } - - private static IntStream getAvailableSlots(Container inventory, Direction side) { - return inventory instanceof WorldlyContainer ? IntStream.of(((WorldlyContainer)inventory).getSlotsForFace(side)) : IntStream.range(0, inventory.getContainerSize()); - } - - public boolean hasSpace(Container inv, Direction dir, ItemStack stack) { - IntStream stream = getAvailableSlots(inv, dir); - int inserted = 0; - int slotMax = Math.min(stack.getMaxStackSize(), inv.getMaxStackSize()); - if (CrafterModule.useEmiLogic && inv instanceof CrafterBlockEntity) { - slotMax = 1; - } - - for (int i : stream.toArray()) { - if (inv instanceof WorldlyContainer si && !si.canPlaceItemThroughFace(i, stack, dir)) { - continue; - } - ItemStack is = inv.getItem(i); - if (is.isEmpty()) { - inserted += slotMax; - } else if (ItemStack.isSameItemSameTags(is, stack) && is.getCount() < slotMax) { - inserted += slotMax - is.getCount(); - } - if (inserted >= stack.getCount()) { - return true; - } - } - return false; - } - - public void takeItems() { - NonNullList defaultedList = level.getRecipeManager().getRemainingItemsFor(RecipeType.CRAFTING, this, level); - - if(level instanceof ServerLevel serverLevel) { - BlockSource blockSource = new BlockSourceImpl(serverLevel, worldPosition); - for(int i = 0; i < defaultedList.size(); ++i) { - ItemStack itemInCrafter = this.getItem(i); - ItemStack remainingItem = defaultedList.get(i); - - if(remainingItem.isEmpty()) - itemInCrafter.shrink(1); - else { - BEHAVIOR.dispense(blockSource, remainingItem); - itemInCrafter.shrink(itemInCrafter.getCount()); - } - } - } - - update(); - } - - public int getComparatorOutput() { - int out = 0; - for (int i = 0; i < 9; i++) { - if (blocked[i] || !getItem(i).isEmpty()) { - out++; - } - } - return out; - } - - public static void tick(Level world, BlockPos pos, BlockState state, CrafterBlockEntity be) { - if(!be.didInitialScan && !world.isClientSide) { - be.update(); - be.didInitialScan = true; - } - } - - public static ItemStack getResult(Level world, CraftingContainer craftingInventory) { - Optional optional = world.getServer().getRecipeManager().getRecipeFor(RecipeType.CRAFTING, craftingInventory, world); - if (optional.isPresent()) { - CraftingRecipe craftingRecipe = optional.get(); - ItemStack stack = craftingRecipe.assemble(craftingInventory.asCraftInput(), world.registryAccess()); - if (stack.isItemEnabled(world.enabledFeatures())) { - return stack; - } - } - return ItemStack.EMPTY; - } - - public void update() { - ItemStack stack = CrafterBlockEntity.getResult(level, this); - result.setItem(0, stack); - level.updateNeighbourForOutputSignal(worldPosition, CrafterModule.block); - } - - @Override - public boolean stillValid(Player player) { - return true; - } - - @Override - public ItemStack getItem(int slot) { - return stacks.get(slot); - } - - @Override - public boolean isEmpty() { - for (ItemStack stack : stacks) { - if (!stack.isEmpty()) { - return false; - } - } - return true; - } - - @Override - public ItemStack removeItem(int slot, int amount) { - ItemStack stack = ContainerHelper.removeItem(stacks, slot, amount); - if (!stack.isEmpty()) { - this.setChanged(); - } - update(); - return stack; - } - - @Override - public ItemStack removeItemNoUpdate(int slot) { - ItemStack stack = ContainerHelper.takeItem(stacks, slot); - update(); - return stack; - } - - @Override - public void setItem(int slot, ItemStack stack) { - stacks.set(slot, stack); - update(); - } - - @Override - public int getContainerSize() { - return 9; - } - - @Override - public void clearContent() { - for (int i = 0; i < getContainerSize(); i++) { - setItem(i, ItemStack.EMPTY); - } - } - - @Override - protected AbstractContainerMenu createMenu(int syncId, Inventory playerInventory) { - return new CrafterMenu(syncId, playerInventory, (it) -> new TransientCraftingContainer(it, 3, 3, stacks), result, delegate, ContainerLevelAccess.create(level, getBlockPos())); - } - - @Override - protected Component getDefaultName() { - return Component.translatable("block.quark.crafter"); - } - - @Override - public void fillStackedContents(StackedContents finder) { - for(ItemStack itemstack : stacks) { - finder.accountSimpleStack(itemstack); - } - } - - @Override - public int getWidth() { - return 3; - } - - @Override - public int getHeight() { - return 3; - } - - @Override - public NonNullList getItems() { - return stacks; - } - - @Override - public boolean canTakeItemThroughFace(int slot, ItemStack stack, Direction dir) { - return true; - } - - @Override - public boolean canPlaceItemThroughFace(int slot, ItemStack stack, Direction dir) { - return canPlaceItem(slot, stack); - } - - @Override - public boolean canPlaceItem(int slot, ItemStack stack) { - ItemStack stackInSlot = getItem(slot); - boolean allowed = stackInSlot.isEmpty(); - - if(!CrafterModule.useEmiLogic && !allowed) { - int min = 999; - for(int i = 0; i < 9; i++) { - if(blocked[i]) - continue; - - ItemStack testStack = getItem(i); - if(testStack.isEmpty() || ItemStack.isSameItemSameComponents(stackInSlot, testStack)) - min = Math.min(min, testStack.getCount()); - } - - return stackInSlot.getCount() == min; - } - - boolean blockedSlot = blocked[slot]; - boolean powered = level.getBlockState(worldPosition).getValue(CrafterBlock.POWER).powered(); - - return allowed && !blockedSlot && (CrafterModule.allowItemsWhilePowered || !powered); - } - - @Override - public int[] getSlotsForFace(Direction side) { - int ct = 0; - for(boolean bl : blocked) - if(!bl) - ct++; - - int[] ret = new int[ct]; - int i = 0; - for(int j = 0; j < blocked.length; j++) - if(!blocked[j]) { - ret[i] = j; - i++; - } - - return ret; - } - - private static class CraftDispenseBehavior implements DispenseItemBehavior { - - @Override - public final ItemStack dispense(BlockSource source, ItemStack itemStack) { - ItemStack itemStack2 = this.dispenseSilently(source, itemStack); - this.playSound(source); - this.spawnParticles(source, source.state().getValue(CrafterBlock.FACING)); - return itemStack2; - } - - protected ItemStack dispenseSilently(BlockSource pointer, ItemStack stack) { - Direction direction = pointer.state().getValue(CrafterBlock.FACING); - Position position = getOutputLocation(pointer); - spawnItem(pointer.level(), stack, 6, direction, position); - return stack; - } - - public static void spawnItem(Level world, ItemStack stack, int speed, Direction side, Position pos) { - double d = pos.x(); - double e = pos.y(); - double f = pos.z(); - if (side.getAxis() == Axis.Y) { - e -= 0.125; - } else { - e -= 0.15625; - } - - ItemEntity itemEntity = new ItemEntity(world, d, e, f, stack); - double g = world.random.nextDouble() * 0.1 + 0.2; - itemEntity.setDeltaMovement(world.random.triangle((double)side.getStepX() * g, 0.0172275 * (double)speed), world.random.triangle(0.2, 0.0172275 * (double)speed), world.random.triangle((double)side.getStepZ() * g, 0.0172275 * (double)speed)); - world.addFreshEntity(itemEntity); - } - - protected void playSound(BlockSource pointer) { - pointer.level().levelEvent(1000, pointer.pos(), 0); - } - - protected void spawnParticles(BlockSource pointer, Direction side) { - pointer.level().levelEvent(2000, pointer.pos(), side.get3DDataValue()); - } - - private static Position getOutputLocation(BlockSource pointer) { - Direction direction = pointer.state().getValue(CrafterBlock.FACING); - return pointer.pos().getCenter().add(0.7 * (double)direction.getStepX(), 0.7 * (double)direction.getStepY(), 0.7 * (double)direction.getStepZ()); - } - } -} diff --git a/src/main/java/org/violetmoon/quark/content/automation/client/screen/CrafterScreen.java b/src/main/java/org/violetmoon/quark/content/automation/client/screen/CrafterScreen.java deleted file mode 100644 index a7ec2e72ad..0000000000 --- a/src/main/java/org/violetmoon/quark/content/automation/client/screen/CrafterScreen.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * The Cool MIT License (CMIT) - * - * Copyright (c) 2023 Emi - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, as long as the person is cool, subject to the following - * conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * The person is cool. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -package org.violetmoon.quark.content.automation.client.screen; - -import net.minecraft.client.gui.GuiGraphics; -import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; -import net.minecraft.client.resources.sounds.SimpleSoundInstance; -import net.minecraft.network.chat.Component; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.sounds.SoundEvents; -import net.minecraft.world.entity.player.Inventory; -import net.minecraft.world.inventory.Slot; -import org.violetmoon.quark.base.Quark; -import org.violetmoon.quark.content.automation.inventory.CrafterMenu; - -import java.util.List; - -public class CrafterScreen extends AbstractContainerScreen { - private static final ResourceLocation TEXTURE = Quark.asResource("textures/gui/container/crafter.png"); - - public CrafterScreen(CrafterMenu menu, Inventory inventory, Component title) { - super(menu, inventory, title); - } - - @Override - public void init() { - super.init(); - this.titleLabelX = (this.imageWidth - this.font.width(this.title)) / 2; - } - - @Override - public void render(GuiGraphics context, int mouseX, int mouseY, float delta) { - renderBackground(context, mouseX, mouseY, delta); - super.render(context, mouseX, mouseY, delta); - this.renderTooltip(context, mouseX, mouseY); - if (menu.getCarried().isEmpty() && this.hoveredSlot != null && this.hoveredSlot.getItem().isEmpty() && this.hoveredSlot.container == menu.crafter && !isBlocked(this.hoveredSlot)) { - context.renderComponentTooltip(font, List.of( - Component.translatable("quark.misc.disable_slot") - ), mouseX, mouseY); - } - } - - @Override - public boolean mouseClicked(double mouseX, double mouseY, int button) { - if (menu.getCarried().isEmpty() && this.hoveredSlot != null && this.hoveredSlot.getItem().isEmpty() && this.hoveredSlot.container == menu.crafter) { - this.minecraft.gameMode.handleInventoryButtonClick(this.menu.containerId, this.hoveredSlot.getContainerSlot()); - this.minecraft.getSoundManager().play(SimpleSoundInstance.forUI(SoundEvents.UI_BUTTON_CLICK, 1.0F)); - - return true; - } - return super.mouseClicked(mouseX, mouseY, button); - } - - public boolean isBlocked(Slot slot) { - if (slot.container == menu.crafter && (menu.delegate.get(0) & (1 << (1 + slot.getContainerSlot()))) != 0) { - return true; - } - return false; - } - - @Override - public void renderBg(GuiGraphics context, float delta, int mouseX, int mouseY) { - int i = this.leftPos; - int j = (this.height - this.imageHeight) / 2; - context.blit(TEXTURE, i, j, 0, 0, this.imageWidth, this.imageHeight); - int del = menu.delegate.get(0); - if ((del & 1) != 0) { - context.blit(TEXTURE, i + 97, j + 38, 176, 18, 16, 11); - } - for (int s = 0; s < 9; s++) { - if ((del & (1 << (s + 1))) != 0) { - Slot slot = menu.slots.get(s + 1); - context.blit(TEXTURE, i + slot.x - 1, j + slot.y - 1, 176, 0, 18, 18); - } - } - } -} diff --git a/src/main/java/org/violetmoon/quark/content/automation/client/screen/TroughScreen.java b/src/main/java/org/violetmoon/quark/content/automation/client/screen/TroughScreen.java index 4a6aa1d40d..705c0c3da9 100644 --- a/src/main/java/org/violetmoon/quark/content/automation/client/screen/TroughScreen.java +++ b/src/main/java/org/violetmoon/quark/content/automation/client/screen/TroughScreen.java @@ -7,7 +7,6 @@ import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.inventory.DispenserMenu; import org.violetmoon.quark.base.Quark; -import org.violetmoon.quark.base.handler.ContributorRewardHandler; public class TroughScreen extends DispenserScreen { diff --git a/src/main/java/org/violetmoon/quark/content/automation/inventory/CrafterMenu.java b/src/main/java/org/violetmoon/quark/content/automation/inventory/CrafterMenu.java deleted file mode 100644 index 8d40ead6f2..0000000000 --- a/src/main/java/org/violetmoon/quark/content/automation/inventory/CrafterMenu.java +++ /dev/null @@ -1,185 +0,0 @@ -/* - * The Cool MIT License (CMIT) - * - * Copyright (c) 2023 Emi - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, as long as the person is cool, subject to the following - * conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * The person is cool. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -package org.violetmoon.quark.content.automation.inventory; - -import net.minecraft.network.FriendlyByteBuf; -import net.minecraft.world.Container; -import net.minecraft.world.entity.player.Inventory; -import net.minecraft.world.entity.player.Player; -import net.minecraft.world.inventory.*; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.level.block.entity.BlockEntity; -import org.violetmoon.quark.content.automation.block.be.CrafterBlockEntity; -import org.violetmoon.quark.content.automation.module.CrafterModule; - -import javax.annotation.Nonnull; -import java.util.function.Function; - -public class CrafterMenu extends AbstractContainerMenu { - public final Container crafter; - public final ContainerData delegate; - - private final ContainerLevelAccess access; - - public CrafterMenu(int syncId, Inventory player) { - this(syncId, player, (it) -> new TransientCraftingContainer(it, 3, 3), new ResultContainer(), new SimpleContainerData(1), ContainerLevelAccess.NULL); - } - - public CrafterMenu(int syncId, Inventory player, Function crafterProvider, ResultContainer result, ContainerData delegate, ContainerLevelAccess access) { - super(CrafterModule.menuType, syncId); - - CraftingContainer crafter = crafterProvider.apply(this); - - this.access = access; - - checkContainerSize(crafter, 9); - this.crafter = crafter; - crafter.startOpen(player.player); - this.delegate = delegate; - this.addDataSlots(delegate); - - this.addSlot(new ResultSlot(player.player, crafter, result, 0, 26 + 18 * 6, 17 + 18) { - @Override - public boolean mayPickup(Player p_40228_) { - return false; - } - }); - - int i; - int j; - for(i = 0; i < 3; ++i) { - for(j = 0; j < 3; ++j) { - int index = j + i * 3; - this.addSlot(new Slot(crafter, index, 26 + j * 18, 17 + i * 18) { - @Override - public boolean mayPlace(@Nonnull ItemStack stack) { - return (delegate.get(0) & (1 << index)) == 0; - } - }); - } - } - - for(i = 0; i < 3; ++i) { - for(j = 0; j < 9; ++j) { - this.addSlot(new Slot(player, j + i * 9 + 9, 8 + j * 18, 84 + i * 18)); - } - } - - for(i = 0; i < 9; ++i) { - this.addSlot(new Slot(player, i, 8 + i * 18, 142)); - } - } - - public static CrafterMenu fromNetwork(int windowId, Inventory playerInventory, FriendlyByteBuf buf) { - return new CrafterMenu(windowId, playerInventory); - } - - @Override - public boolean clickMenuButton(Player player, int id) { - if (id >= 0 && id < 9) { - access.execute((level, pos) -> { - if (!level.isClientSide) { - BlockEntity be = level.getBlockEntity(pos); - if (be instanceof CrafterBlockEntity cbe) { - cbe.blocked[id] = !cbe.blocked[id]; - cbe.update(); - cbe.setChanged(); - } - } - }); - return true; - } - - return super.clickMenuButton(player, id); - } - - @Override - public void slotsChanged(Container container) { - super.slotsChanged(container); - access.execute((level, pos) -> { - if (!level.isClientSide) { - BlockEntity be = level.getBlockEntity(pos); - if (be instanceof CrafterBlockEntity cbe) { - cbe.update(); - } - } - }); - } - - @Override - public boolean stillValid(Player player) { - return crafter.stillValid(player); - } - - @Override - public ItemStack quickMoveStack(Player player, int index) { - Slot slot = this.getSlot(index); - ItemStack original = ItemStack.EMPTY; - if (slot != null && slot.hasItem()) { - ItemStack stack = slot.getItem(); - original = stack.copy(); - if (index == 0) { - if (!this.moveItemStackTo(stack, 10, 46, true)) { - return ItemStack.EMPTY; - } - slot.onQuickCraft(stack, original); - /* - this.context.run((world, pos) -> { - stack.getItem().onCraft(stack, world, player); - });*/ - } else if (index < 10) { - if (!this.moveItemStackTo(stack, 10, 46, false)) { - return ItemStack.EMPTY; - } - } else { - if (!this.moveItemStackTo(stack, 1, 10, false)) { - if (index < 37) { - if (!this.moveItemStackTo(stack, 37, 46, false)) { - return ItemStack.EMPTY; - } - } else if (!this.moveItemStackTo(stack, 10, 37, false)) { - return ItemStack.EMPTY; - } - } - } - if (stack.isEmpty()) { - slot.setByPlayer(ItemStack.EMPTY); - } else { - slot.setChanged(); - } - if (stack.getCount() == original.getCount()) { - return ItemStack.EMPTY; - } - slot.onTake(player, stack); - if (index == 0) { - player.drop(stack, false); - } - } - return original; - } -} diff --git a/src/main/java/org/violetmoon/quark/content/automation/module/CrafterModule.java b/src/main/java/org/violetmoon/quark/content/automation/module/CrafterModule.java deleted file mode 100644 index 80f1cbf896..0000000000 --- a/src/main/java/org/violetmoon/quark/content/automation/module/CrafterModule.java +++ /dev/null @@ -1,66 +0,0 @@ -package org.violetmoon.quark.content.automation.module; - -import net.minecraft.client.gui.screens.MenuScreens; -import net.minecraft.core.registries.Registries; -import net.minecraft.world.inventory.MenuType; -import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.block.SoundType; -import net.minecraft.world.level.block.entity.BlockEntityType; -import net.minecraft.world.level.material.MapColor; -import net.neoforged.neoforge.common.extensions.IMenuTypeExtension; -import org.violetmoon.quark.base.Quark; -import org.violetmoon.quark.content.automation.block.CrafterBlock; -import org.violetmoon.quark.content.automation.block.be.CrafterBlockEntity; -import org.violetmoon.quark.content.automation.client.screen.CrafterScreen; -import org.violetmoon.quark.content.automation.inventory.CrafterMenu; -import org.violetmoon.zeta.client.event.load.ZClientSetup; -import org.violetmoon.zeta.config.Config; -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; - -//fixme Fix crafter PITA atm and frankly not worth delaying a stable release over -@ZetaLoadModule(category = "automation") -public class CrafterModule extends ZetaModule { - - public static Block block; - public static MenuType menuType; - public static BlockEntityType blockEntityType; - - Block crafter; - - @Config(description = "Setting this to true will change the Crafter to use Emi's original design instead of Mojang's.\n" - + "Emi's design allows only one item per slot, instead of continuing to fill it round robin.\n" - + "If this is enabled, Allow Items While Powered should also be set to false for the full design.") - public static boolean useEmiLogic = false; - - @Config(description = "Set to false to allow items to be inserted into the Crafter even while it's powered.") - public static boolean allowItemsWhilePowered = true; - - @LoadEvent - public final void register(ZRegister event) { - crafter = block = new CrafterBlock("crafter", this, - Block.Properties.of() - .mapColor(MapColor.WOOD) - .strength(2.5F) - .sound(SoundType.WOOD) - .ignitedByLava() - ); - - menuType = IMenuTypeExtension.create(CrafterMenu::fromNetwork); - Quark.ZETA.registry.register(menuType, "crafter", Registries.MENU); - - blockEntityType = BlockEntityType.Builder.of(CrafterBlockEntity::new, crafter).build(null); - Quark.ZETA.registry.register(blockEntityType, "crafter", Registries.BLOCK_ENTITY_TYPE); - } - - @ZetaLoadModule(clientReplacement = true) - public static final class Client extends CrafterModule { - - @LoadEvent - public void clientSetup(ZClientSetup event) { - event.enqueueWork(() -> MenuScreens.register(menuType, CrafterScreen::new)); - } - } -} diff --git a/src/main/java/org/violetmoon/quark/content/automation/module/IronRodModule.java b/src/main/java/org/violetmoon/quark/content/automation/module/IronRodModule.java index 89a1da7bc2..4cc9fa49c5 100644 --- a/src/main/java/org/violetmoon/quark/content/automation/module/IronRodModule.java +++ b/src/main/java/org/violetmoon/quark/content/automation/module/IronRodModule.java @@ -1,8 +1,6 @@ package org.violetmoon.quark.content.automation.module; import net.minecraft.core.registries.Registries; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.tags.BlockTags; import net.minecraft.tags.TagKey; import net.minecraft.world.level.block.Block; diff --git a/src/main/java/org/violetmoon/quark/content/automation/module/PistonsMoveTileEntitiesModule.java b/src/main/java/org/violetmoon/quark/content/automation/module/PistonsMoveTileEntitiesModule.java index ad6fad9f5a..b6b7ce3fe4 100644 --- a/src/main/java/org/violetmoon/quark/content/automation/module/PistonsMoveTileEntitiesModule.java +++ b/src/main/java/org/violetmoon/quark/content/automation/module/PistonsMoveTileEntitiesModule.java @@ -16,7 +16,6 @@ import net.minecraft.world.level.block.piston.PistonStructureResolver; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.properties.ChestType; -import net.minecraftforge.common.util.NonNullConsumer; import org.apache.commons.lang3.tuple.Pair; import org.jetbrains.annotations.Nullable; import org.violetmoon.quark.api.IPistonCallback; @@ -36,6 +35,7 @@ import org.violetmoon.zeta.piston.ZetaPistonStructureResolver; import java.util.*; +import java.util.function.Consumer; import java.util.function.Predicate; @ZetaLoadModule(category = "automation") @@ -118,7 +118,7 @@ public static boolean shouldMoveTE(BlockState state) { return true; ResourceLocation res = BuiltInRegistries.BLOCK.getKey(state.getBlock()); - return res == null || PistonsMoveTileEntitiesModule.movementBlacklist.contains(res.toString()) || PistonsMoveTileEntitiesModule.movementBlacklist.contains(res.getNamespace()); + return PistonsMoveTileEntitiesModule.movementBlacklist.contains(res.toString()) || PistonsMoveTileEntitiesModule.movementBlacklist.contains(res.getNamespace()); } public static void detachTileEntities(Level world, PistonStructureResolver helper, Direction facing, boolean extending) { @@ -160,7 +160,7 @@ public static boolean setPistonBlock(Level world, BlockPos pos, BlockState state if(entityTag != null) { BlockState currState = world.getBlockState(pos); BlockEntity currEntity = world.getBlockEntity(pos); - CompoundTag currTag = currEntity == null ? null : currEntity.saveWithFullMetadata(); + CompoundTag currTag = currEntity == null ? null : currEntity.saveWithFullMetadata(world.registryAccess()); world.removeBlock(pos, false); if(!state.canSurvive( world, pos)) { @@ -246,7 +246,7 @@ private static void registerDelayedUpdate(Level world, BlockPos pos, CompoundTag delayedUpdates.get(world).add(Pair.of(pos, tag)); } - private static void callCallback(@Nullable BlockEntity entity, NonNullConsumer caller) { + private static void callCallback(@Nullable BlockEntity entity, Consumer caller) { if(entity != null) { IPistonCallback cb = Quark.ZETA.capabilityManager.getCapability(QuarkCapabilities.PISTON_CALLBACK, entity); if(cb != null) diff --git a/src/main/java/org/violetmoon/quark/content/building/block/CelebratoryLampBlock.java b/src/main/java/org/violetmoon/quark/content/building/block/CelebratoryLampBlock.java index 42b63177c0..75eb2cc036 100644 --- a/src/main/java/org/violetmoon/quark/content/building/block/CelebratoryLampBlock.java +++ b/src/main/java/org/violetmoon/quark/content/building/block/CelebratoryLampBlock.java @@ -2,9 +2,9 @@ import net.minecraft.ChatFormatting; import net.minecraft.network.chat.Component; +import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.TooltipFlag; -import net.minecraft.world.level.BlockGetter; import org.jetbrains.annotations.Nullable; import org.violetmoon.zeta.block.ZetaBlock; import org.violetmoon.zeta.module.ZetaModule; @@ -18,10 +18,10 @@ public CelebratoryLampBlock(String regname, @Nullable ZetaModule module, Propert } @Override - public void appendHoverText(ItemStack pStack, @Nullable BlockGetter pLevel, List pTooltip, TooltipFlag pFlag) { - super.appendHoverText(pStack, pLevel, pTooltip, pFlag); - if (pFlag.isAdvanced()) { - pTooltip.add(1, Component.translatable("quark.misc.celebration").withStyle(ChatFormatting.GRAY)); + public void appendHoverText(ItemStack stack, Item.TooltipContext context, List components, TooltipFlag flag) { + super.appendHoverText(stack, context, components, flag); + if (flag.isAdvanced()) { + components.add(1, Component.translatable("quark.misc.celebration").withStyle(ChatFormatting.GRAY)); } } } diff --git a/src/main/java/org/violetmoon/quark/content/building/block/CutVineBlock.java b/src/main/java/org/violetmoon/quark/content/building/block/CutVineBlock.java index cb37da6ea5..e82433ec2f 100644 --- a/src/main/java/org/violetmoon/quark/content/building/block/CutVineBlock.java +++ b/src/main/java/org/violetmoon/quark/content/building/block/CutVineBlock.java @@ -2,10 +2,7 @@ import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.Items; import net.minecraft.world.level.BlockGetter; -import net.minecraft.world.level.LevelReader; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.properties.BooleanProperty; diff --git a/src/main/java/org/violetmoon/quark/content/building/block/HedgeBlock.java b/src/main/java/org/violetmoon/quark/content/building/block/HedgeBlock.java index a29d775283..bed86301d5 100644 --- a/src/main/java/org/violetmoon/quark/content/building/block/HedgeBlock.java +++ b/src/main/java/org/violetmoon/quark/content/building/block/HedgeBlock.java @@ -15,7 +15,6 @@ import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.FenceBlock; -import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.properties.BooleanProperty; @@ -24,6 +23,7 @@ import net.minecraft.world.phys.shapes.Shapes; import net.minecraft.world.phys.shapes.VoxelShape; +import net.neoforged.neoforge.common.util.TriState; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -140,7 +140,7 @@ public boolean connectsTo(BlockState state, boolean isSideSolid, @NotNull Direct } @Override - public boolean canSustainPlantZeta(@NotNull BlockState state, @NotNull BlockGetter world, @NotNull BlockPos pos, @NotNull Direction facing, @NotNull String plantabletype) { + public TriState canSustainPlantZeta(BlockState state, BlockGetter level, BlockPos soilPosition, Direction facing, BlockState plant) { return facing == Direction.UP && !state.getValue(WATERLOGGED) && "plains".equals(plantabletype); } diff --git a/src/main/java/org/violetmoon/quark/content/building/block/PaperWallBlock.java b/src/main/java/org/violetmoon/quark/content/building/block/PaperWallBlock.java index a7e37bdce3..5f24f55db8 100755 --- a/src/main/java/org/violetmoon/quark/content/building/block/PaperWallBlock.java +++ b/src/main/java/org/violetmoon/quark/content/building/block/PaperWallBlock.java @@ -13,7 +13,6 @@ import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.world.level.BlockGetter; -import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.state.BlockState; import org.violetmoon.quark.base.util.BlockPropertyUtil; diff --git a/src/main/java/org/violetmoon/quark/content/building/block/RopeBlock.java b/src/main/java/org/violetmoon/quark/content/building/block/RopeBlock.java index 559004715c..3b3023f56b 100755 --- a/src/main/java/org/violetmoon/quark/content/building/block/RopeBlock.java +++ b/src/main/java/org/violetmoon/quark/content/building/block/RopeBlock.java @@ -7,10 +7,11 @@ import net.minecraft.stats.Stats; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; +import net.minecraft.world.ItemInteractionResult; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.*; -import net.minecraft.world.item.alchemy.PotionUtils; +import net.minecraft.world.item.alchemy.PotionContents; import net.minecraft.world.item.alchemy.Potions; import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.level.BlockGetter; @@ -31,9 +32,8 @@ import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.Shapes; import net.minecraft.world.phys.shapes.VoxelShape; -import net.minecraftforge.common.capabilities.ForgeCapabilities; -import net.minecraftforge.fluids.FluidActionResult; -import net.minecraftforge.fluids.FluidUtil; +import net.neoforged.neoforge.fluids.FluidActionResult; +import net.neoforged.neoforge.fluids.FluidUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.violetmoon.quark.content.automation.module.PistonsMoveTileEntitiesModule; @@ -108,20 +108,32 @@ public BlockState updateShape(BlockState state, @NotNull Direction facing, @NotN return super.updateShape(state, facing, facingState, level, pos, facingPos); } + @Override + protected InteractionResult useWithoutItem(BlockState state, Level level, BlockPos pos, Player player, BlockHitResult result) { + if (pullUp(level, pos)) { + if(!player.getAbilities().instabuild) { + if(!player.addItem(new ItemStack(this))) + player.drop(new ItemStack(this), false); + } + level.playSound(null, pos, soundType.getBreakSound(), SoundSource.BLOCKS, 0.5F, 1F); + return InteractionResult.sidedSuccess(level.isClientSide); + } + return InteractionResult.PASS; + } + @NotNull @Override - public InteractionResult use(@NotNull BlockState state, @NotNull Level worldIn, @NotNull BlockPos pos, @NotNull Player player, @NotNull InteractionHand hand, @NotNull BlockHitResult hit) { + public ItemInteractionResult useItemOn(ItemStack stack, @NotNull BlockState state, @NotNull Level worldIn, @NotNull BlockPos pos, @NotNull Player player, @NotNull InteractionHand hand, @NotNull BlockHitResult hit) { if(hand == InteractionHand.MAIN_HAND) { - ItemStack stack = player.getItemInHand(hand); if(stack.getItem() == asItem() && !player.isDiscrete()) { if(pullDown(worldIn, pos)) { if(!player.getAbilities().instabuild) stack.shrink(1); worldIn.playSound(null, pos, soundType.getPlaceSound(), SoundSource.BLOCKS, 0.5F, 1F); - return InteractionResult.sidedSuccess(worldIn.isClientSide); + return ItemInteractionResult.sidedSuccess(worldIn.isClientSide); } - } else if(stack.getCapability(ForgeCapabilities.FLUID_HANDLER_ITEM).isPresent()) { //TODO: Forge extension + } else if(FluidUtil.getFluidHandler(stack).isPresent()) { //TODO: Forge extension FluidActionResult interact = FluidUtil.tryPickUpFluid(stack, player, worldIn, getBottomPos(worldIn, pos), Direction.UP); if(interact.success) { stack.shrink(1); @@ -129,7 +141,7 @@ public InteractionResult use(@NotNull BlockState state, @NotNull Level worldIn, player.drop(interact.result, false); } - return interact.success ? InteractionResult.sidedSuccess(worldIn.isClientSide) : InteractionResult.PASS; + return interact.success ? ItemInteractionResult.sidedSuccess(worldIn.isClientSide) : ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION; } else if(stack.getItem() == Items.GLASS_BOTTLE) { BlockPos bottomPos = getBottomPos(worldIn, pos); BlockState stateAt = worldIn.getBlockState(bottomPos); @@ -137,7 +149,7 @@ public InteractionResult use(@NotNull BlockState state, @NotNull Level worldIn, Vec3 playerPos = player.position(); worldIn.playSound(player, playerPos.x, playerPos.y, playerPos.z, SoundEvents.BOTTLE_FILL, SoundSource.NEUTRAL, 1.0F, 1.0F); stack.shrink(1); - ItemStack bottleStack = PotionUtils.setPotion(new ItemStack(Items.POTION), Potions.WATER); + ItemStack bottleStack = PotionContents.createItemStack(Items.POTION, Potions.WATER); player.awardStat(Stats.ITEM_USED.get(stack.getItem())); if(stack.isEmpty()) @@ -145,10 +157,9 @@ public InteractionResult use(@NotNull BlockState state, @NotNull Level worldIn, else if(!player.addItem(bottleStack)) player.drop(bottleStack, false); - return InteractionResult.sidedSuccess(worldIn.isClientSide); + return ItemInteractionResult.sidedSuccess(worldIn.isClientSide); } - - return InteractionResult.PASS; + return ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION; } else { if(pullUp(worldIn, pos)) { if(!player.getAbilities().instabuild) { @@ -157,12 +168,11 @@ else if(!player.addItem(bottleStack)) } worldIn.playSound(null, pos, soundType.getBreakSound(), SoundSource.BLOCKS, 0.5F, 1F); - return InteractionResult.sidedSuccess(worldIn.isClientSide); + return ItemInteractionResult.sidedSuccess(worldIn.isClientSide); } } } - - return InteractionResult.PASS; + return ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION; } public boolean pullUp(Level world, BlockPos pos) { diff --git a/src/main/java/org/violetmoon/quark/content/building/block/StoolBlock.java b/src/main/java/org/violetmoon/quark/content/building/block/StoolBlock.java index 37f6d9bf93..bb0b198d06 100644 --- a/src/main/java/org/violetmoon/quark/content/building/block/StoolBlock.java +++ b/src/main/java/org/violetmoon/quark/content/building/block/StoolBlock.java @@ -5,7 +5,6 @@ import net.minecraft.core.Direction.Axis; import net.minecraft.server.level.ServerLevel; import net.minecraft.util.RandomSource; -import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.LivingEntity; diff --git a/src/main/java/org/violetmoon/quark/content/building/block/WoodPostBlock.java b/src/main/java/org/violetmoon/quark/content/building/block/WoodPostBlock.java index a019a0d2d9..3b8b985f91 100644 --- a/src/main/java/org/violetmoon/quark/content/building/block/WoodPostBlock.java +++ b/src/main/java/org/violetmoon/quark/content/building/block/WoodPostBlock.java @@ -1,6 +1,5 @@ package org.violetmoon.quark.content.building.block; -import net.minecraft.world.level.block.state.BlockBehaviour; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.violetmoon.quark.base.Quark; diff --git a/src/main/java/org/violetmoon/quark/content/building/block/be/VariantChestBlockEntity.java b/src/main/java/org/violetmoon/quark/content/building/block/be/VariantChestBlockEntity.java index dfad86959e..83ec542705 100644 --- a/src/main/java/org/violetmoon/quark/content/building/block/be/VariantChestBlockEntity.java +++ b/src/main/java/org/violetmoon/quark/content/building/block/be/VariantChestBlockEntity.java @@ -4,7 +4,6 @@ import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.entity.ChestBlockEntity; import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.phys.AABB; import org.violetmoon.quark.content.building.module.VariantChestsModule; @@ -17,10 +16,4 @@ protected VariantChestBlockEntity(BlockEntityType typeIn, BlockPos pos, Block public VariantChestBlockEntity(BlockPos pos, BlockState state) { super(VariantChestsModule.chestTEType, pos, state); } - - @Override - public AABB getRenderBoundingBox() { - return new AABB(worldPosition.offset(-1, 0, -1), worldPosition.offset(2, 2, 2)); - } - } diff --git a/src/main/java/org/violetmoon/quark/content/building/client/render/be/VariantChestRenderer.java b/src/main/java/org/violetmoon/quark/content/building/client/render/be/VariantChestRenderer.java index a143f1909b..2a84077343 100644 --- a/src/main/java/org/violetmoon/quark/content/building/client/render/be/VariantChestRenderer.java +++ b/src/main/java/org/violetmoon/quark/content/building/client/render/be/VariantChestRenderer.java @@ -12,7 +12,6 @@ import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider; import net.minecraft.client.renderer.blockentity.ChestRenderer; import net.minecraft.client.resources.model.Material; -import net.minecraft.resources.ResourceLocation; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.entity.ChestBlockEntity; import net.minecraft.world.level.block.state.properties.ChestType; 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 e19bb4d7fc..94a7c32590 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,7 +1,6 @@ package org.violetmoon.quark.content.building.client.render.entity; import com.mojang.blaze3d.vertex.PoseStack; -import com.mojang.datafixers.util.Pair; import com.mojang.math.Axis; import net.minecraft.client.Minecraft; @@ -21,21 +20,19 @@ import net.minecraft.client.resources.model.ModelResourceLocation; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; -import net.minecraft.core.Holder; import net.minecraft.core.component.DataComponents; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.EntityType; import net.minecraft.world.inventory.InventoryMenu; import net.minecraft.world.item.BannerItem; -import net.minecraft.world.item.DyeColor; import net.minecraft.world.item.ItemDisplayContext; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.MapItem; import net.minecraft.world.item.ShieldItem; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.entity.BannerBlockEntity; -import net.minecraft.world.level.block.entity.BannerPattern; +import net.minecraft.world.level.block.entity.BannerPatternLayers; import net.minecraft.world.level.saveddata.maps.MapItemSavedData; import net.minecraft.world.phys.Vec3; @@ -193,7 +190,7 @@ protected void renderItemStack(GlassItemFrame itemFrame, PoseStack matrix, Multi float s = (float) GlassItemFrameModule.itemRenderScale; if(stack.getItem() instanceof BannerItem bannerItem) { banner.fromItem(stack, bannerItem.getColor()); - List, DyeColor>> patterns = banner.getPatterns(); + BannerPatternLayers patterns = banner.getPatterns(); matrix.pushPose(); matrix.translate(0.0001F, -0.5001F, 0.55F); diff --git a/src/main/java/org/violetmoon/quark/content/building/item/QuarkItemFrameItem.java b/src/main/java/org/violetmoon/quark/content/building/item/QuarkItemFrameItem.java index 8e49fbbad7..855befef8a 100644 --- a/src/main/java/org/violetmoon/quark/content/building/item/QuarkItemFrameItem.java +++ b/src/main/java/org/violetmoon/quark/content/building/item/QuarkItemFrameItem.java @@ -3,7 +3,6 @@ import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.component.DataComponents; -import net.minecraft.nbt.CompoundTag; import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.decoration.HangingEntity; diff --git a/src/main/java/org/violetmoon/quark/content/building/module/HedgesModule.java b/src/main/java/org/violetmoon/quark/content/building/module/HedgesModule.java index 89506dd251..1e98bd7e34 100644 --- a/src/main/java/org/violetmoon/quark/content/building/module/HedgesModule.java +++ b/src/main/java/org/violetmoon/quark/content/building/module/HedgesModule.java @@ -1,8 +1,6 @@ package org.violetmoon.quark.content.building.module; import net.minecraft.core.registries.Registries; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.tags.BlockTags; import net.minecraft.tags.TagKey; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; diff --git a/src/main/java/org/violetmoon/quark/content/building/module/HollowLogsModule.java b/src/main/java/org/violetmoon/quark/content/building/module/HollowLogsModule.java index 61e89ee10b..26c635de78 100644 --- a/src/main/java/org/violetmoon/quark/content/building/module/HollowLogsModule.java +++ b/src/main/java/org/violetmoon/quark/content/building/module/HollowLogsModule.java @@ -26,9 +26,7 @@ import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.Direction.Axis; -import net.minecraft.resources.ResourceLocation; import net.minecraft.server.level.ServerPlayer; -import net.minecraft.tags.BlockTags; import net.minecraft.tags.TagKey; import net.minecraft.world.entity.Pose; import net.minecraft.world.entity.player.Player; diff --git a/src/main/java/org/violetmoon/quark/content/building/module/RainbowLampsModule.java b/src/main/java/org/violetmoon/quark/content/building/module/RainbowLampsModule.java index 2f93244906..e8869c1565 100644 --- a/src/main/java/org/violetmoon/quark/content/building/module/RainbowLampsModule.java +++ b/src/main/java/org/violetmoon/quark/content/building/module/RainbowLampsModule.java @@ -1,8 +1,6 @@ package org.violetmoon.quark.content.building.module; import net.minecraft.core.registries.Registries; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.tags.BlockTags; import net.minecraft.tags.TagKey; import net.minecraft.world.level.block.Block; diff --git a/src/main/java/org/violetmoon/quark/content/building/module/VariantChestsModule.java b/src/main/java/org/violetmoon/quark/content/building/module/VariantChestsModule.java index 6b2eaea4b5..f3c6b6f798 100644 --- a/src/main/java/org/violetmoon/quark/content/building/module/VariantChestsModule.java +++ b/src/main/java/org/violetmoon/quark/content/building/module/VariantChestsModule.java @@ -1,12 +1,29 @@ package org.violetmoon.quark.content.building.module; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Optional; -import java.util.function.BooleanSupplier; - +import net.minecraft.client.renderer.blockentity.BlockEntityRenderers; +import net.minecraft.core.Holder; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.core.registries.Registries; +import net.minecraft.resources.ResourceKey; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.tags.TagKey; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.animal.horse.AbstractChestedHorse; +import net.minecraft.world.entity.item.ItemEntity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.CreativeModeTabs; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.world.level.ServerLevelAccessor; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.SoundType; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.block.state.BlockBehaviour; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.levelgen.structure.Structure; +import net.neoforged.neoforge.common.Tags; import org.jetbrains.annotations.Nullable; import org.violetmoon.quark.base.Quark; import org.violetmoon.quark.base.QuarkClient; @@ -37,30 +54,8 @@ import org.violetmoon.zeta.util.handler.StructureBlockReplacementHandler; import org.violetmoon.zeta.util.handler.StructureBlockReplacementHandler.StructureHolder; -import net.minecraft.client.renderer.blockentity.BlockEntityRenderers; -import net.minecraft.core.Holder; -import net.minecraft.core.registries.BuiltInRegistries; -import net.minecraft.core.registries.Registries; -import net.minecraft.resources.ResourceKey; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.tags.TagKey; -import net.minecraft.world.InteractionResult; -import net.minecraft.world.entity.Entity; -import net.minecraft.world.entity.animal.horse.AbstractChestedHorse; -import net.minecraft.world.entity.item.ItemEntity; -import net.minecraft.world.entity.player.Player; -import net.minecraft.world.item.CreativeModeTabs; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.Items; -import net.minecraft.world.level.ServerLevelAccessor; -import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.block.Blocks; -import net.minecraft.world.level.block.SoundType; -import net.minecraft.world.level.block.entity.BlockEntityType; -import net.minecraft.world.level.block.state.BlockBehaviour; -import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.level.levelgen.structure.Structure; -import net.minecraftforge.common.Tags; +import java.util.*; +import java.util.function.BooleanSupplier; @ZetaLoadModule(category = "building", antiOverlap = { "woodworks" }) public class VariantChestsModule extends ZetaModule { @@ -240,7 +235,7 @@ public void onClickEntity(ZPlayerInteract.EntityInteractSpecific event) { copy.setCount(1); held.shrink(1); - horse.getPersistentData().put(DONK_CHEST, copy.serializeNBT()); + horse.getPersistentData().put(DONK_CHEST, copy.save(player.level().registryAccess())); horse.setChest(true); horse.createInventory(); @@ -257,7 +252,7 @@ public void onClickEntity(ZPlayerInteract.EntityInteractSpecific event) { public void onDeath(ZLivingDeath event) { Entity target = event.getEntity(); if(target instanceof AbstractChestedHorse horse) { - ItemStack chest = ItemStack.of(horse.getPersistentData().getCompound(DONK_CHEST)); + ItemStack chest = ItemStack.parseOptional(target.level().registryAccess(), horse.getPersistentData().getCompound(DONK_CHEST)); if(!chest.isEmpty() && horse.hasChest()) WAIT_TO_REPLACE_CHEST.set(chest); } diff --git a/src/main/java/org/violetmoon/quark/content/building/module/VerticalSlabsModule.java b/src/main/java/org/violetmoon/quark/content/building/module/VerticalSlabsModule.java index 085b5e475f..d5b1d44ca1 100644 --- a/src/main/java/org/violetmoon/quark/content/building/module/VerticalSlabsModule.java +++ b/src/main/java/org/violetmoon/quark/content/building/module/VerticalSlabsModule.java @@ -23,8 +23,6 @@ import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.tags.BlockTags; import net.minecraft.tags.TagKey; import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.block.Block; diff --git a/src/main/java/org/violetmoon/quark/content/client/module/BucketsShowInhabitantsModule.java b/src/main/java/org/violetmoon/quark/content/client/module/BucketsShowInhabitantsModule.java index 944d9bf313..b2119f50da 100644 --- a/src/main/java/org/violetmoon/quark/content/client/module/BucketsShowInhabitantsModule.java +++ b/src/main/java/org/violetmoon/quark/content/client/module/BucketsShowInhabitantsModule.java @@ -6,7 +6,6 @@ import net.minecraft.client.renderer.item.ItemPropertyFunction; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.Tag; -import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.animal.TropicalFish; import net.minecraft.world.entity.animal.axolotl.Axolotl; @@ -161,7 +160,7 @@ public int getColor(@NotNull ItemStack stack, int layer) { int variant = tag.getInt(TropicalFish.BUCKET_VARIANT_TAG); DyeColor dyeColor = layer == 1 ? TropicalFish.getBaseColor(variant) : TropicalFish.getPatternColor(variant); - float[] colorComponents = dyeColor.getTextureDiffuseColors(); + float[] colorComponents = dyeColor.getTextureDiffuseColor(); return ((int) (colorComponents[0] * 255) << 16) | ((int) (colorComponents[1] * 255) << 8) | diff --git a/src/main/java/org/violetmoon/quark/content/client/module/MicrocraftingHelperModule.java b/src/main/java/org/violetmoon/quark/content/client/module/MicrocraftingHelperModule.java index 6862bfbcff..c9ec72390e 100644 --- a/src/main/java/org/violetmoon/quark/content/client/module/MicrocraftingHelperModule.java +++ b/src/main/java/org/violetmoon/quark/content/client/module/MicrocraftingHelperModule.java @@ -1,32 +1,15 @@ package org.violetmoon.quark.content.client.module; -import java.util.*; -import java.util.function.BooleanSupplier; - -import net.minecraft.client.gui.components.Tooltip; -import net.minecraft.client.gui.screens.inventory.tooltip.ClientTooltipPositioner; -import net.minecraft.network.chat.Component; -import org.apache.commons.lang3.tuple.Pair; -import org.joml.Vector2i; -import org.joml.Vector2ic; -import org.violetmoon.quark.base.QuarkClient; -import org.violetmoon.quark.base.client.handler.ClientUtil; -import org.violetmoon.zeta.client.event.play.ZClientTick; -import org.violetmoon.zeta.client.event.play.ZRenderContainerScreen; -import org.violetmoon.zeta.client.event.play.ZScreen; -import org.violetmoon.zeta.event.bus.PlayEvent; -import org.violetmoon.zeta.module.ZetaLoadModule; -import org.violetmoon.zeta.module.ZetaModule; - 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.gui.components.EditBox; +import net.minecraft.client.gui.components.Tooltip; import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; import net.minecraft.client.gui.screens.inventory.CraftingScreen; +import net.minecraft.client.gui.screens.inventory.tooltip.ClientTooltipPositioner; import net.minecraft.client.gui.screens.recipebook.GhostRecipe; import net.minecraft.client.gui.screens.recipebook.GhostRecipe.GhostIngredient; import net.minecraft.client.gui.screens.recipebook.RecipeBookComponent; @@ -34,10 +17,28 @@ import net.minecraft.client.gui.screens.recipebook.RecipeCollection; import net.minecraft.client.renderer.GameRenderer; import net.minecraft.core.RegistryAccess; +import net.minecraft.network.chat.Component; import net.minecraft.world.inventory.Slot; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.crafting.Ingredient; import net.minecraft.world.item.crafting.Recipe; +import org.apache.commons.lang3.tuple.Pair; +import org.joml.Vector2i; +import org.joml.Vector2ic; +import org.violetmoon.quark.base.client.handler.ClientUtil; +import org.violetmoon.zeta.client.event.play.ZClientTick; +import org.violetmoon.zeta.client.event.play.ZRenderContainerScreen; +import org.violetmoon.zeta.client.event.play.ZScreen; +import org.violetmoon.zeta.event.bus.PlayEvent; +import org.violetmoon.zeta.event.bus.ZPhase; +import org.violetmoon.zeta.module.ZetaLoadModule; +import org.violetmoon.zeta.module.ZetaModule; + +import java.util.ArrayList; +import java.util.List; +import java.util.Locale; +import java.util.Stack; +import java.util.function.BooleanSupplier; @ZetaLoadModule(category = "client") public class MicrocraftingHelperModule extends ZetaModule { @@ -195,7 +196,8 @@ private void positionTooltip(int pScreenWidth, int pScreenHeight, Vector2i pTool @PlayEvent - public void onTick(ZClientTick.Start event) { + public void onTick(ZClientTick event) { + if (event.getPhase() != ZPhase.START) return; Minecraft mc = Minecraft.getInstance(); Screen prevScreen = currentScreen; diff --git a/src/main/java/org/violetmoon/quark/content/client/module/UsesForCursesModule.java b/src/main/java/org/violetmoon/quark/content/client/module/UsesForCursesModule.java index 204a8bc9a4..8c1c1a04c1 100644 --- a/src/main/java/org/violetmoon/quark/content/client/module/UsesForCursesModule.java +++ b/src/main/java/org/violetmoon/quark/content/client/module/UsesForCursesModule.java @@ -1,13 +1,17 @@ package org.violetmoon.quark.content.client.module; import net.minecraft.client.renderer.entity.ArmorStandRenderer; +import net.minecraft.core.Holder; +import net.minecraft.core.registries.Registries; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; +import net.minecraft.world.item.enchantment.Enchantment; import net.minecraft.world.item.enchantment.EnchantmentHelper; +import net.minecraft.world.item.enchantment.Enchantments; import net.minecraft.world.level.block.Blocks; import org.violetmoon.quark.content.tweaks.client.layer.ArmorStandFakePlayerLayer; @@ -53,11 +57,10 @@ public static boolean shouldHideArmorStandModel(ItemStack stack) { } public static boolean shouldHidePumpkinOverlay(ResourceLocation location, Player player) { - if(!staticEnabled || !vanishPumpkinOverlay || !location.equals(PUMPKIN_OVERLAY)) - return false; + if(!staticEnabled || !vanishPumpkinOverlay || !location.equals(PUMPKIN_OVERLAY)) return false; ItemStack stack = player.getInventory().getArmor(3); - return stack.is(Blocks.CARVED_PUMPKIN.asItem()) && - EnchantmentHelper.hasVanishingCurse(stack); + Holder vanishing = player.level().registryAccess().lookupOrThrow(Registries.ENCHANTMENT).getOrThrow(Enchantments.VANISHING_CURSE); + return stack.is(Blocks.CARVED_PUMPKIN.asItem()) && EnchantmentHelper.getTagEnchantmentLevel(vanishing, stack) > 0; } @ZetaLoadModule(clientReplacement = true) diff --git a/src/main/java/org/violetmoon/quark/content/client/module/VariantAnimalTexturesModule.java b/src/main/java/org/violetmoon/quark/content/client/module/VariantAnimalTexturesModule.java index 3a6c768870..9d890353a0 100644 --- a/src/main/java/org/violetmoon/quark/content/client/module/VariantAnimalTexturesModule.java +++ b/src/main/java/org/violetmoon/quark/content/client/module/VariantAnimalTexturesModule.java @@ -100,16 +100,15 @@ public final void configChanged(ZConfigChanged event) { @PlayEvent public void doShinySparkles(ZLivingTick event) { - if(!shinySparkles) - return; - LivingEntity entity = event.getEntity(); + if(!shinySparkles) return; + LivingEntity entity = (LivingEntity) event.getEntity(); Level level = entity.level(); if(level.isClientSide() && level.getGameTime() % 10 == 0) { if(isSparkly(entity)) { double angle = Math.random() * 2 * Math.PI; double dist = Math.random() * 0.5 + 0.25; double dX = Math.cos(angle) * dist; - double dY = entity.getDimensions(entity.getPose()).height + (Math.random() - 0.5) * 0.2; + double dY = entity.getDimensions(entity.getPose()).height() + (Math.random() - 0.5) * 0.2; double dZ = Math.sin(angle) * dist; level.addParticle(ParticleTypes.HAPPY_VILLAGER, entity.getX() + dX, entity.getY() + dY, entity.getZ() + dZ, Math.random() - 0.5, Math.random() - 0.5, Math.random() - 0.5); } diff --git a/src/main/java/org/violetmoon/quark/content/client/resources/AttributeTooltipManager.java b/src/main/java/org/violetmoon/quark/content/client/resources/AttributeTooltipManager.java index f431220337..6d50c47485 100644 --- a/src/main/java/org/violetmoon/quark/content/client/resources/AttributeTooltipManager.java +++ b/src/main/java/org/violetmoon/quark/content/client/resources/AttributeTooltipManager.java @@ -4,7 +4,6 @@ import com.google.gson.GsonBuilder; import com.google.gson.reflect.TypeToken; -import net.minecraft.resources.ResourceLocation; import net.minecraft.server.packs.resources.Resource; import net.minecraft.server.packs.resources.ResourceManager; import net.minecraft.server.packs.resources.SimplePreparableReloadListener; diff --git a/src/main/java/org/violetmoon/quark/content/client/tooltip/FoodTooltips.java b/src/main/java/org/violetmoon/quark/content/client/tooltip/FoodTooltips.java index b1ac20a0ff..7bea2382e1 100755 --- a/src/main/java/org/violetmoon/quark/content/client/tooltip/FoodTooltips.java +++ b/src/main/java/org/violetmoon/quark/content/client/tooltip/FoodTooltips.java @@ -3,8 +3,6 @@ import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.datafixers.util.Either; -import com.mojang.datafixers.util.Pair; - import net.minecraft.ChatFormatting; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Font; @@ -12,16 +10,14 @@ import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.screens.inventory.tooltip.ClientTooltipComponent; import net.minecraft.client.renderer.GameRenderer; +import net.minecraft.core.component.DataComponents; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.FormattedText; import net.minecraft.world.effect.MobEffectCategory; -import net.minecraft.world.effect.MobEffectInstance; import net.minecraft.world.food.FoodProperties; import net.minecraft.world.inventory.tooltip.TooltipComponent; import net.minecraft.world.item.ItemStack; - import org.jetbrains.annotations.NotNull; - import org.violetmoon.quark.content.client.module.ImprovedTooltipsModule; import org.violetmoon.zeta.client.event.play.ZGatherTooltipComponents; @@ -30,8 +26,8 @@ public class FoodTooltips { private static boolean isPoison(FoodProperties food) { - for(Pair effect : food.getEffects()) { - if(effect.getFirst() != null && effect.getFirst().getEffect() != null && effect.getFirst().getEffect().getCategory() == MobEffectCategory.HARMFUL) { + for(FoodProperties.PossibleEffect effect : food.effects()) { + if(effect != null && effect.effect().getEffect().value().getCategory() == MobEffectCategory.HARMFUL) { return true; } } @@ -40,17 +36,17 @@ private static boolean isPoison(FoodProperties food) { public static void makeTooltip(ZGatherTooltipComponents event, boolean showFood, boolean showSaturation) { ItemStack stack = event.getItemStack(); - if(stack.isEdible()) { - FoodProperties food = stack.getItem().getFoodProperties(); + if(stack.has(DataComponents.FOOD)) { + FoodProperties food = stack.get(DataComponents.FOOD); if(food != null) { - int pips = food.getNutrition(); + int pips = food.nutrition(); if(pips == 0) return; int len = (int) Math.ceil((double) pips / ImprovedTooltipsModule.foodDivisor); int saturationSimplified = 0; - float saturation = Math.min(20, food.getSaturationModifier() * food.getNutrition() * 2); + float saturation = Math.min(20, food.saturation() * food.nutrition() * 2); if(saturation >= 19) saturationSimplified = 5; else if(saturation < 10) { @@ -97,13 +93,13 @@ public void renderImage(@NotNull Font font, int tooltipX, int tooltipY, @NotNull PoseStack pose = guiGraphics.pose(); Minecraft mc = Minecraft.getInstance(); - if(stack.isEdible()) { + if(stack.has(DataComponents.FOOD)) { FoodProperties food = stack.getItem().getFoodProperties(stack, mc.player); if(food != null) { RenderSystem.setShader(GameRenderer::getPositionTexShader); RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); - int pips = food.getNutrition(); + int pips = food.nutrition(); if(pips == 0) return; diff --git a/src/main/java/org/violetmoon/quark/content/client/tooltip/MapTooltips.java b/src/main/java/org/violetmoon/quark/content/client/tooltip/MapTooltips.java index 352f3a2009..fccf26eb8f 100755 --- a/src/main/java/org/violetmoon/quark/content/client/tooltip/MapTooltips.java +++ b/src/main/java/org/violetmoon/quark/content/client/tooltip/MapTooltips.java @@ -1,9 +1,7 @@ package org.violetmoon.quark.content.client.tooltip; import com.mojang.blaze3d.systems.RenderSystem; -import com.mojang.blaze3d.vertex.BufferBuilder; import com.mojang.blaze3d.vertex.PoseStack; -import com.mojang.blaze3d.vertex.Tesselator; import com.mojang.datafixers.util.Either; import net.minecraft.client.Minecraft; @@ -12,7 +10,6 @@ import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.gui.screens.inventory.tooltip.ClientTooltipComponent; import net.minecraft.client.renderer.GameRenderer; -import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.FormattedText; import net.minecraft.resources.ResourceLocation; diff --git a/src/main/java/org/violetmoon/quark/content/client/tooltip/ShulkerBoxTooltips.java b/src/main/java/org/violetmoon/quark/content/client/tooltip/ShulkerBoxTooltips.java index 87a602cb48..c1932b637d 100755 --- a/src/main/java/org/violetmoon/quark/content/client/tooltip/ShulkerBoxTooltips.java +++ b/src/main/java/org/violetmoon/quark/content/client/tooltip/ShulkerBoxTooltips.java @@ -25,6 +25,7 @@ import net.minecraftforge.common.capabilities.ForgeCapabilities; import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.items.IItemHandler; +import net.neoforged.neoforge.items.IItemHandler; import org.jetbrains.annotations.NotNull; import org.violetmoon.quark.base.Quark; import org.violetmoon.quark.base.handler.SimilarBlockTypeHandler; @@ -35,6 +36,7 @@ import java.util.ArrayList; import java.util.List; +import java.util.Optional; public class ShulkerBoxTooltips { @@ -104,12 +106,12 @@ public void renderImage(@NotNull Font font, int tooltipX, int tooltipY, @NotNull cmp = cmp.copy(); cmp.putString("id", "minecraft:shulker_box"); } - BlockEntity te = BlockEntity.loadStatic(BlockPos.ZERO, ((BlockItem) stack.getItem()).getBlock().defaultBlockState(), cmp); + BlockEntity te = BlockEntity.loadStatic(BlockPos.ZERO, ((BlockItem) stack.getItem()).getBlock().defaultBlockState(), cmp, mc.player.registryAccess()); if(te != null) { if(te instanceof RandomizableContainerBlockEntity randomizable) randomizable.setLootTable(null, 0); - LazyOptional handler = te.getCapability(ForgeCapabilities.ITEM_HANDLER, null); + Optional handler = te.getCapability(ForgeCapabilities.ITEM_HANDLER, null); handler.ifPresent((capability) -> { ItemStack currentBox = stack; int currentX = tooltipX; diff --git a/src/main/java/org/violetmoon/quark/content/experimental/client/screen/VariantSelectorScreen.java b/src/main/java/org/violetmoon/quark/content/experimental/client/screen/VariantSelectorScreen.java index 4c94a4a3b7..213c8c667b 100644 --- a/src/main/java/org/violetmoon/quark/content/experimental/client/screen/VariantSelectorScreen.java +++ b/src/main/java/org/violetmoon/quark/content/experimental/client/screen/VariantSelectorScreen.java @@ -25,13 +25,10 @@ import org.jetbrains.annotations.Nullable; import org.lwjgl.opengl.GL11; -import org.violetmoon.quark.content.experimental.item.HammerItem; import org.violetmoon.quark.content.experimental.module.VariantSelectorModule; import java.util.ArrayList; -import java.util.HashMap; import java.util.List; -import java.util.Map; public class VariantSelectorScreen extends Screen { diff --git a/src/main/java/org/violetmoon/quark/content/experimental/module/VariantSelectorModule.java b/src/main/java/org/violetmoon/quark/content/experimental/module/VariantSelectorModule.java index fd824338b5..1b3d496683 100644 --- a/src/main/java/org/violetmoon/quark/content/experimental/module/VariantSelectorModule.java +++ b/src/main/java/org/violetmoon/quark/content/experimental/module/VariantSelectorModule.java @@ -4,7 +4,6 @@ import java.util.Objects; import com.mojang.blaze3d.platform.GlStateManager; -import net.minecraft.world.level.block.PressurePlateBlock; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.lwjgl.glfw.GLFW; @@ -25,7 +24,6 @@ import org.violetmoon.zeta.client.event.play.ZRenderGuiOverlay; import org.violetmoon.zeta.client.event.play.ZRenderTooltip; import org.violetmoon.zeta.config.Config; -import org.violetmoon.zeta.config.ConfigManager; import org.violetmoon.zeta.event.bus.LoadEvent; import org.violetmoon.zeta.event.bus.PlayEvent; import org.violetmoon.zeta.event.load.ZConfigChanged; diff --git a/src/main/java/org/violetmoon/quark/content/management/client/screen/widgets/MiniInventoryButton.java b/src/main/java/org/violetmoon/quark/content/management/client/screen/widgets/MiniInventoryButton.java index e3678cbc2f..5e6a65bd79 100644 --- a/src/main/java/org/violetmoon/quark/content/management/client/screen/widgets/MiniInventoryButton.java +++ b/src/main/java/org/violetmoon/quark/content/management/client/screen/widgets/MiniInventoryButton.java @@ -19,7 +19,6 @@ import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.Button; import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; -import net.minecraft.client.gui.screens.recipebook.RecipeUpdateListener; import net.minecraft.client.renderer.GameRenderer; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.MutableComponent; diff --git a/src/main/java/org/violetmoon/quark/content/management/module/AutomaticToolRestockModule.java b/src/main/java/org/violetmoon/quark/content/management/module/AutomaticToolRestockModule.java index e64609074e..cb6c6eaaeb 100644 --- a/src/main/java/org/violetmoon/quark/content/management/module/AutomaticToolRestockModule.java +++ b/src/main/java/org/violetmoon/quark/content/management/module/AutomaticToolRestockModule.java @@ -1,7 +1,6 @@ package org.violetmoon.quark.content.management.module; import com.google.common.collect.Lists; - import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.InteractionHand; @@ -11,15 +10,11 @@ import net.minecraft.world.item.enchantment.Enchantment; import net.minecraft.world.item.enchantment.EnchantmentHelper; import net.minecraft.world.item.enchantment.Enchantments; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.common.ToolAction; -import net.minecraftforge.common.ToolActions; -import net.minecraftforge.items.IItemHandler; -import net.minecraftforge.items.wrapper.PlayerInvWrapper; - import net.neoforged.neoforge.common.ItemAbilities; import net.neoforged.neoforge.common.ItemAbility; import net.neoforged.neoforge.common.NeoForge; +import net.neoforged.neoforge.items.IItemHandler; +import net.neoforged.neoforge.items.wrapper.PlayerInvWrapper; import org.violetmoon.quark.addons.oddities.module.BackpackModule; import org.violetmoon.quark.api.event.GatherToolClassesEvent; import org.violetmoon.quark.base.Quark; diff --git a/src/main/java/org/violetmoon/quark/content/management/module/EasyTransferingModule.java b/src/main/java/org/violetmoon/quark/content/management/module/EasyTransferingModule.java index 0793e8b6cf..f3b5076a78 100644 --- a/src/main/java/org/violetmoon/quark/content/management/module/EasyTransferingModule.java +++ b/src/main/java/org/violetmoon/quark/content/management/module/EasyTransferingModule.java @@ -3,7 +3,6 @@ import java.util.List; import net.minecraft.client.gui.screens.Screen; -import net.minecraft.client.resources.language.I18n; import net.minecraft.network.chat.Component; import org.violetmoon.quark.base.QuarkClient; diff --git a/src/main/java/org/violetmoon/quark/content/management/module/ExpandedItemInteractionsModule.java b/src/main/java/org/violetmoon/quark/content/management/module/ExpandedItemInteractionsModule.java index 40a9944135..c365cf149b 100644 --- a/src/main/java/org/violetmoon/quark/content/management/module/ExpandedItemInteractionsModule.java +++ b/src/main/java/org/violetmoon/quark/content/management/module/ExpandedItemInteractionsModule.java @@ -259,8 +259,7 @@ private static boolean shulkerOverride(ItemStack shulkerStack, ItemStack incomin int lockedSlot = slot.getSlotIndex(); if(player instanceof ServerPlayer splayer) { HeldShulkerBoxContainer container = new HeldShulkerBoxContainer(splayer, lockedSlot); - - NetworkHooks.openScreen(splayer, container, buf -> buf.writeInt(lockedSlot)); + player.openMenu(container); } else player.playSound(SoundEvents.SHULKER_BOX_OPEN, 1F, 1F); @@ -437,7 +436,7 @@ public void onScroll(ZScreen.MouseScrolled.Pre event) { Minecraft mc = Minecraft.getInstance(); Screen gui = mc.screen; - double scrollDelta = event.getScrollDelta(); + double scrollDelta = event.getScrollDeltaY(); if(mc.player != null && gui instanceof AbstractContainerScreen containerGui) { Slot under = containerGui.getSlotUnderMouse(); diff --git a/src/main/java/org/violetmoon/quark/content/management/module/HotbarChangerModule.java b/src/main/java/org/violetmoon/quark/content/management/module/HotbarChangerModule.java index 8ede876389..d479b068a7 100644 --- a/src/main/java/org/violetmoon/quark/content/management/module/HotbarChangerModule.java +++ b/src/main/java/org/violetmoon/quark/content/management/module/HotbarChangerModule.java @@ -9,7 +9,6 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.renderer.GameRenderer; -import net.minecraft.client.renderer.entity.ItemRenderer; import net.minecraft.resources.ResourceLocation; import net.minecraft.util.Mth; import net.minecraft.world.entity.player.Inventory; @@ -27,6 +26,7 @@ import org.violetmoon.zeta.config.Config; import org.violetmoon.zeta.event.bus.LoadEvent; import org.violetmoon.zeta.event.bus.PlayEvent; +import org.violetmoon.zeta.event.bus.ZPhase; import org.violetmoon.zeta.module.ZetaLoadModule; import org.violetmoon.zeta.module.ZetaModule; @@ -149,7 +149,8 @@ public void hudPost(ZRenderGuiOverlay.Hotbar.Pre event) { } @PlayEvent - public void clientTick(ZClientTick.End event) { + public void clientTick(ZClientTick event) { + if (event.getPhase() != ZPhase.END) return; Player player = Minecraft.getInstance().player; diff --git a/src/main/java/org/violetmoon/quark/content/management/module/QuickArmorSwappingModule.java b/src/main/java/org/violetmoon/quark/content/management/module/QuickArmorSwappingModule.java index 1f4444d109..b8b025532f 100644 --- a/src/main/java/org/violetmoon/quark/content/management/module/QuickArmorSwappingModule.java +++ b/src/main/java/org/violetmoon/quark/content/management/module/QuickArmorSwappingModule.java @@ -1,5 +1,6 @@ package org.violetmoon.quark.content.management.module; +import net.minecraft.core.registries.Registries; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.EquipmentSlot; @@ -7,7 +8,7 @@ import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.enchantment.EnchantmentHelper; - +import net.minecraft.world.item.enchantment.Enchantments; import org.violetmoon.zeta.config.Config; import org.violetmoon.zeta.event.bus.PlayEvent; import org.violetmoon.zeta.event.play.entity.player.ZPlayerInteract; @@ -44,8 +45,8 @@ private void swapSlot(Player player, ArmorStand armorStand, EquipmentSlot slot) ItemStack playerItem = player.getItemBySlot(slot); ItemStack armorStandItem = armorStand.getItemBySlot(slot); - if(EnchantmentHelper.hasBindingCurse(playerItem)) - return; // lol no + if (EnchantmentHelper.getTagEnchantmentLevel(player.level().registryAccess().lookupOrThrow(Registries.ENCHANTMENT).getOrThrow(Enchantments.BINDING_CURSE), playerItem) > 0) + return; ItemStack held = player.getItemInHand(InteractionHand.MAIN_HAND); diff --git a/src/main/java/org/violetmoon/quark/content/mobs/ai/RunAndPoofGoal.java b/src/main/java/org/violetmoon/quark/content/mobs/ai/RunAndPoofGoal.java index b1cd015610..97ebdf3504 100755 --- a/src/main/java/org/violetmoon/quark/content/mobs/ai/RunAndPoofGoal.java +++ b/src/main/java/org/violetmoon/quark/content/mobs/ai/RunAndPoofGoal.java @@ -21,7 +21,6 @@ import net.minecraft.world.entity.ai.navigation.PathNavigation; import net.minecraft.world.entity.ai.util.DefaultRandomPos; import net.minecraft.world.entity.player.Player; -import net.minecraft.world.level.Level; import net.minecraft.world.level.pathfinder.Path; import net.minecraft.world.phys.Vec3; 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 ceb8b79b47..829a7d72b6 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 @@ -9,7 +9,6 @@ import net.minecraft.client.model.geom.builders.LayerDefinition; import net.minecraft.client.model.geom.builders.MeshDefinition; import net.minecraft.client.model.geom.builders.PartDefinition; -import net.minecraft.core.particles.ParticleTypes; import net.minecraft.util.Mth; diff --git a/src/main/java/org/violetmoon/quark/content/mobs/entity/Foxhound.java b/src/main/java/org/violetmoon/quark/content/mobs/entity/Foxhound.java index af039b481a..cfae847cc8 100755 --- a/src/main/java/org/violetmoon/quark/content/mobs/entity/Foxhound.java +++ b/src/main/java/org/violetmoon/quark/content/mobs/entity/Foxhound.java @@ -204,7 +204,7 @@ else if(isBlue()) if(cookTime > 0 && cookTime % 3 == 0) { List foxhounds = level.getEntitiesOfClass(Foxhound.class, new AABB(blockPosition()), (fox) -> fox != null && fox.isTame()); - if(!foxhounds.isEmpty() && foxhounds.get(0) == this) { + if(!foxhounds.isEmpty() && foxhounds.getFirst() == this) { furnace.cookingProgress = furnace.cookingProgress == 3 ? 5 : Math.min(furnace.cookingTotalTime - 1, cookTime + 1); if(getOwner() instanceof ServerPlayer sp) @@ -274,9 +274,7 @@ public boolean doHurtTarget(Entity entityIn) { if(flag) { entityIn.igniteForSeconds(5); - this.doEnchantDamageEffects(this, entityIn); } - return flag; } @@ -411,15 +409,6 @@ public void setTatering(boolean tatering) { entityData.set(TATERING, tatering); } -// public static boolean canSpawnHere(IServerWorld world, BlockPos pos, Random rand) { -// if(world.getLightFor(LightType.SKY, pos) > rand.nextInt(32)) { -// return false; -// } else { -// int light = world.getWorld().isThundering() ? world.getNeighborAwareLightSubtracted(pos, 10) : world.getLight(pos); -// return light <= rand.nextInt(8); -// } -// } - @Override public float getWalkTargetValue(BlockPos pos, LevelReader worldIn) { return worldIn.getBlockState(pos.below()).is(FoxhoundModule.foxhoundSpawnableTag) ? 10.0F : worldIn.getRawBrightness(pos, 0) - 0.5F; diff --git a/src/main/java/org/violetmoon/quark/content/mobs/item/DiamondHeartItem.java b/src/main/java/org/violetmoon/quark/content/mobs/item/DiamondHeartItem.java index 8e35de7021..fcdff0a818 100755 --- a/src/main/java/org/violetmoon/quark/content/mobs/item/DiamondHeartItem.java +++ b/src/main/java/org/violetmoon/quark/content/mobs/item/DiamondHeartItem.java @@ -11,7 +11,6 @@ import net.minecraft.world.item.CreativeModeTabs; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; -import net.minecraft.world.item.Rarity; import net.minecraft.world.item.context.UseOnContext; import net.minecraft.world.level.Level; import net.minecraft.world.level.ServerLevelAccessor; diff --git a/src/main/java/org/violetmoon/quark/content/mobs/item/SoulBeadItem.java b/src/main/java/org/violetmoon/quark/content/mobs/item/SoulBeadItem.java index f94200dd9c..88b6bcb964 100644 --- a/src/main/java/org/violetmoon/quark/content/mobs/item/SoulBeadItem.java +++ b/src/main/java/org/violetmoon/quark/content/mobs/item/SoulBeadItem.java @@ -5,7 +5,6 @@ import net.minecraft.sounds.SoundSource; import net.minecraft.stats.Stats; import net.minecraft.world.InteractionHand; -import net.minecraft.world.InteractionResult; import net.minecraft.world.InteractionResultHolder; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.CreativeModeTabs; diff --git a/src/main/java/org/violetmoon/quark/content/mobs/module/CrabsModule.java b/src/main/java/org/violetmoon/quark/content/mobs/module/CrabsModule.java index f05b36d63b..be2e199fd2 100644 --- a/src/main/java/org/violetmoon/quark/content/mobs/module/CrabsModule.java +++ b/src/main/java/org/violetmoon/quark/content/mobs/module/CrabsModule.java @@ -19,7 +19,6 @@ import net.minecraft.world.item.CreativeModeTabs; import net.minecraft.world.item.Item; import net.minecraft.world.item.Items; -import net.minecraft.world.item.crafting.Ingredient; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.levelgen.Heightmap.Types; import net.minecraft.world.level.material.Fluids; diff --git a/src/main/java/org/violetmoon/quark/content/tools/base/RuneColor.java b/src/main/java/org/violetmoon/quark/content/tools/base/RuneColor.java index de43a28c0b..167957e54d 100644 --- a/src/main/java/org/violetmoon/quark/content/tools/base/RuneColor.java +++ b/src/main/java/org/violetmoon/quark/content/tools/base/RuneColor.java @@ -4,7 +4,6 @@ import net.minecraft.network.chat.TextColor; import net.minecraft.util.StringRepresentable; import net.minecraft.world.item.DyeColor; -import org.jetbrains.annotations.NotNull; import javax.annotation.Nonnull; import javax.annotation.Nullable; diff --git a/src/main/java/org/violetmoon/quark/content/tools/entity/ParrotEgg.java b/src/main/java/org/violetmoon/quark/content/tools/entity/ParrotEgg.java index a10d567584..9cca78e4a2 100644 --- a/src/main/java/org/violetmoon/quark/content/tools/entity/ParrotEgg.java +++ b/src/main/java/org/violetmoon/quark/content/tools/entity/ParrotEgg.java @@ -5,7 +5,6 @@ import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; -import net.minecraft.util.Mth; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.animal.Parrot; diff --git a/src/main/java/org/violetmoon/quark/content/tools/item/AncientTomeItem.java b/src/main/java/org/violetmoon/quark/content/tools/item/AncientTomeItem.java index 0b177d14d5..075774baef 100644 --- a/src/main/java/org/violetmoon/quark/content/tools/item/AncientTomeItem.java +++ b/src/main/java/org/violetmoon/quark/content/tools/item/AncientTomeItem.java @@ -4,7 +4,6 @@ import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.network.chat.Component; import net.minecraft.world.item.CreativeModeTabs; -import net.minecraft.world.item.EnchantedBookItem; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Rarity; @@ -27,8 +26,7 @@ public class AncientTomeItem extends ZetaItem implements CreativeTabManager.AppendsUniquely { public AncientTomeItem(ZetaModule module) { - super("ancient_tome", module, - new Item.Properties().stacksTo(1).rarity(Rarity.UNCOMMON)); + super("ancient_tome", module, new Item.Properties().stacksTo(1).rarity(Rarity.UNCOMMON)); CreativeTabManager.addToCreativeTab(CreativeModeTabs.INGREDIENTS, this); } @@ -42,19 +40,12 @@ public boolean isFoil(@NotNull ItemStack stack) { return true; } - @Override - public boolean canApplyAtEnchantingTableZeta(ItemStack stack, Enchantment enchantment) { - return false; - } - public static ItemStack getEnchantedItemStack(Enchantment ench) { - ItemStack newStack = new ItemStack(AncientTomesModule.ancient_tome); - EnchantedBookItem.addEnchantment(newStack, new EnchantmentInstance(ench, ench.getMaxLevel())); - return newStack; + return new ItemStack(AncientTomesModule.ancient_tome).enchant(new EnchantmentInstance(ench, ench.getMaxLevel())); } public static Component getFullTooltipText(Enchantment ench) { - return Component.translatable("quark.misc.ancient_tome_tooltip", Component.translatable(ench.getDescriptionId()), Component.translatable("enchantment.level." + (ench.getMaxLevel() + 1))).withStyle(ChatFormatting.GRAY); + return Component.translatable("quark.misc.ancient_tome_tooltip", Component.translatable(ench.description().getString()), Component.translatable("enchantment.level." + (ench.getMaxLevel() + 1))).withStyle(ChatFormatting.GRAY); } @Override diff --git a/src/main/java/org/violetmoon/quark/content/tools/item/BottledCloudItem.java b/src/main/java/org/violetmoon/quark/content/tools/item/BottledCloudItem.java index 73d1a67919..edc3b23ca6 100644 --- a/src/main/java/org/violetmoon/quark/content/tools/item/BottledCloudItem.java +++ b/src/main/java/org/violetmoon/quark/content/tools/item/BottledCloudItem.java @@ -2,7 +2,6 @@ import net.minecraft.core.BlockPos; import net.minecraft.world.InteractionHand; -import net.minecraft.world.InteractionResult; import net.minecraft.world.InteractionResultHolder; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.CreativeModeTabs; diff --git a/src/main/java/org/violetmoon/quark/content/tools/item/PathfindersQuillItem.java b/src/main/java/org/violetmoon/quark/content/tools/item/PathfindersQuillItem.java index 0ec644a455..f78fa1389c 100644 --- a/src/main/java/org/violetmoon/quark/content/tools/item/PathfindersQuillItem.java +++ b/src/main/java/org/violetmoon/quark/content/tools/item/PathfindersQuillItem.java @@ -6,6 +6,7 @@ import net.minecraft.core.GlobalPos; import net.minecraft.core.Holder; import net.minecraft.core.QuartPos; +import net.minecraft.core.component.DataComponents; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.MutableComponent; import net.minecraft.resources.ResourceLocation; @@ -197,7 +198,7 @@ && getActiveQuill(player) == stack) { player.displayClientMessage(Component.translatable(msg), true); Vec3 pos = player.getPosition(1F); - level.playSound(null, pos.x, pos.y, pos.z, SoundEvents.NOTE_BLOCK_CHIME.get(), SoundSource.PLAYERS, 0.5F, 1F); + level.playSound(null, pos.x, pos.y, pos.z, SoundEvents.NOTE_BLOCK_CHIME, SoundSource.PLAYERS, 0.5F, 1F); //we have to check for off hand manually as game uses same slot index.... if(player.getOffhandItem() == stack){ @@ -371,7 +372,7 @@ public ItemStack createMap(ServerLevel level, BlockPos targetPos, ResourceLocati MapItem.renderBiomePreviewMap(level, stack); MapItemSavedData.addTargetDecoration(stack, targetPos, "+", Type.RED_X); - stack.setHoverName(Component.translatable("item.quark.biome_map", biomeComponent)); + stack.set(DataComponents.CUSTOM_NAME, Component.translatable("item.quark.biome_map", biomeComponent)); stack.getOrCreateTagElement("display").putInt("MapColor", color); ItemNBTHelper.setBoolean(stack, PathfinderMapsModule.TAG_IS_PATHFINDER, true); diff --git a/src/main/java/org/violetmoon/quark/content/tools/module/AmbientDiscsModule.java b/src/main/java/org/violetmoon/quark/content/tools/module/AmbientDiscsModule.java index 8c692134c7..d52fb5c48b 100644 --- a/src/main/java/org/violetmoon/quark/content/tools/module/AmbientDiscsModule.java +++ b/src/main/java/org/violetmoon/quark/content/tools/module/AmbientDiscsModule.java @@ -13,8 +13,9 @@ import net.minecraft.world.entity.monster.Spider; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.JukeboxSongs; +import net.minecraft.world.item.Rarity; import net.minecraft.world.level.block.entity.JukeboxBlockEntity; - import org.violetmoon.quark.base.handler.QuarkSounds; import org.violetmoon.quark.base.item.QuarkMusicDiscItem; import org.violetmoon.zeta.config.Config; @@ -22,6 +23,7 @@ import org.violetmoon.zeta.event.bus.PlayEvent; import org.violetmoon.zeta.event.load.ZRegister; import org.violetmoon.zeta.event.play.entity.living.ZLivingDeath; +import org.violetmoon.zeta.item.ZetaItem; import org.violetmoon.zeta.module.ZetaLoadModule; import org.violetmoon.zeta.module.ZetaModule; import org.violetmoon.zeta.util.Hint; @@ -54,7 +56,9 @@ public void register(ZRegister event) { private void disc(SoundEvent sound) { String name = sound.getLocation().getPath().replaceAll(".+\\.", ""); - discs.add(new QuarkMusicDiscItem(15, () -> sound, name, this, Integer.MAX_VALUE)); + // discs.add(new QuarkMusicDiscItem(15, () -> sound, name, this, Integer.MAX_VALUE)); + // TODO: JukeboxSongs.XXXXXX requires datagen with above parameters + discs.add(new ZetaItem(name, this, new Item.Properties().rarity(Rarity.RARE).jukeboxPlayable(JukeboxSongs.THIRTEEN))); } @PlayEvent @@ -73,13 +77,13 @@ public static void onJukeboxLoad(JukeboxBlockEntity tile) { LevelRenderer render = mc.levelRenderer; BlockPos pos = tile.getBlockPos(); - SoundInstance sound = render.playingRecords.get(pos); + SoundInstance sound = render.playingJukeboxSongs.get(pos); SoundManager soundEngine = mc.getSoundManager(); if(sound == null || !soundEngine.isActive(sound)) { if(sound != null) { soundEngine.play(sound); } else { - ItemStack stack = tile.getFirstItem(); + ItemStack stack = tile.getTheItem(); if(stack.getItem() instanceof QuarkMusicDiscItem disc) playAmbientSound(disc, pos); } @@ -94,7 +98,7 @@ public static boolean playAmbientSound(QuarkMusicDiscItem disc, BlockPos pos) { SimpleSoundInstance simplesound = new SimpleSoundInstance(disc.soundSupplier.get().getLocation(), SoundSource.RECORDS, (float) AmbientDiscsModule.volume, 1.0F, SoundInstance.createUnseededRandom(), true, 0, SoundInstance.Attenuation.LINEAR, pos.getX(), pos.getY(), pos.getZ(), false); - render.playingRecords.put(pos, simplesound); + render.playingJukeboxSongs.put(pos, simplesound); soundEngine.play(simplesound); if(mc.level != null) diff --git a/src/main/java/org/violetmoon/quark/content/tools/module/AncientTomesModule.java b/src/main/java/org/violetmoon/quark/content/tools/module/AncientTomesModule.java index 83050eb4c9..09f993532c 100644 --- a/src/main/java/org/violetmoon/quark/content/tools/module/AncientTomesModule.java +++ b/src/main/java/org/violetmoon/quark/content/tools/module/AncientTomesModule.java @@ -1,43 +1,14 @@ package org.violetmoon.quark.content.tools.module; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; -import org.violetmoon.quark.api.QuarkCapabilities; -import org.violetmoon.quark.base.Quark; -import org.violetmoon.quark.content.experimental.module.EnchantmentsBegoneModule; -import org.violetmoon.quark.content.tools.base.RuneColor; -import org.violetmoon.quark.content.tools.item.AncientTomeItem; -import org.violetmoon.quark.content.tools.loot.EnchantTome; -import org.violetmoon.quark.content.world.module.MonsterBoxModule; -import org.violetmoon.zeta.advancement.ManualTrigger; -import org.violetmoon.zeta.config.Config; -import org.violetmoon.zeta.event.bus.LoadEvent; -import org.violetmoon.zeta.event.bus.PlayEvent; -import org.violetmoon.zeta.event.load.ZCommonSetup; -import org.violetmoon.zeta.event.load.ZConfigChanged; -import org.violetmoon.zeta.event.load.ZRegister; -import org.violetmoon.zeta.event.play.ZAnvilRepair; -import org.violetmoon.zeta.event.play.ZAnvilUpdate; -import org.violetmoon.zeta.event.play.entity.player.ZPlayer; -import org.violetmoon.zeta.event.play.loading.ZAttachCapabilities; -import org.violetmoon.zeta.event.play.loading.ZLootTableLoad; -import org.violetmoon.zeta.event.play.loading.ZVillagerTrades; -import org.violetmoon.zeta.module.ZetaLoadModule; -import org.violetmoon.zeta.module.ZetaModule; -import org.violetmoon.zeta.util.Hint; - import com.google.common.collect.Lists; - import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.objects.Object2IntArrayMap; import it.unimi.dsi.fastutil.objects.Object2IntMap; +import net.minecraft.core.Holder; import net.minecraft.core.Registry; +import net.minecraft.core.component.DataComponents; import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.core.registries.Registries; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.ListTag; import net.minecraft.network.chat.Component; @@ -52,11 +23,7 @@ import net.minecraft.world.entity.player.Player; import net.minecraft.world.inventory.MerchantContainer; import net.minecraft.world.inventory.MerchantMenu; -import net.minecraft.world.item.EnchantedBookItem; -import net.minecraft.world.item.Item; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.Items; -import net.minecraft.world.item.Rarity; +import net.minecraft.world.item.*; import net.minecraft.world.item.enchantment.Enchantment; import net.minecraft.world.item.enchantment.EnchantmentHelper; import net.minecraft.world.item.enchantment.EnchantmentInstance; @@ -69,6 +36,36 @@ import net.minecraft.world.level.storage.loot.entries.LootPoolEntryContainer; import net.minecraft.world.level.storage.loot.functions.LootItemFunctionType; import net.minecraft.world.level.storage.loot.predicates.LootItemCondition; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.violetmoon.quark.api.QuarkCapabilities; +import org.violetmoon.quark.base.Quark; +import org.violetmoon.quark.content.experimental.module.EnchantmentsBegoneModule; +import org.violetmoon.quark.content.tools.base.RuneColor; +import org.violetmoon.quark.content.tools.item.AncientTomeItem; +import org.violetmoon.quark.content.tools.loot.EnchantTome; +import org.violetmoon.quark.content.world.module.MonsterBoxModule; +import org.violetmoon.zeta.advancement.ManualTrigger; +import org.violetmoon.zeta.config.Config; +import org.violetmoon.zeta.event.bus.LoadEvent; +import org.violetmoon.zeta.event.bus.PlayEvent; +import org.violetmoon.zeta.event.load.ZCommonSetup; +import org.violetmoon.zeta.event.load.ZConfigChanged; +import org.violetmoon.zeta.event.load.ZRegister; +import org.violetmoon.zeta.event.play.ZAnvilRepair; +import org.violetmoon.zeta.event.play.ZAnvilUpdate; +import org.violetmoon.zeta.event.play.entity.player.ZPlayer; +import org.violetmoon.zeta.event.play.loading.ZAttachCapabilities; +import org.violetmoon.zeta.event.play.loading.ZLootTableLoad; +import org.violetmoon.zeta.event.play.loading.ZVillagerTrades; +import org.violetmoon.zeta.module.ZetaLoadModule; +import org.violetmoon.zeta.module.ZetaModule; +import org.violetmoon.zeta.util.Hint; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Map; @ZetaLoadModule(category = "tools") public class AncientTomesModule extends ZetaModule { @@ -220,7 +217,7 @@ public void onAnvilUpdate(ZAnvilUpdate.Highest event) { return; Enchantment ench = getTomeEnchantment(right); - Map enchants = EnchantmentHelper.getEnchantments(left); + Map enchants = EnchantmentHelper(left); if(ench != null && enchants.containsKey(ench) && enchants.get(ench) <= ench.getMaxLevel()) { int lvl = enchants.get(ench) + 1; @@ -230,8 +227,8 @@ public void onAnvilUpdate(ZAnvilUpdate.Highest event) { EnchantmentHelper.setEnchantments(enchants, out); int cost = lvl > ench.getMaxLevel() ? limitBreakUpgradeCost : normalUpgradeCost; - if(name != null && !name.isEmpty() && (!out.hasCustomHoverName() || !out.getHoverName().getString().equals(name))) { - out.setHoverName(Component.literal(name)); + if(name != null && !name.isEmpty() && (!out.has(DataComponents.CUSTOM_NAME) || !out.getHoverName().getString().equals(name))) { + out.set(DataComponents.CUSTOM_NAME, Component.literal(name)); cost++; } @@ -292,8 +289,8 @@ else if(combineWithBooks && right.is(Items.ENCHANTED_BOOK)) { EnchantmentHelper.setEnchantments(currentEnchants, out); int cost = normalUpgradeCost; - if(name != null && !name.isEmpty() && (!out.hasCustomHoverName() || !out.getHoverName().getString().equals(name))) { - out.setHoverName(Component.literal(name)); + if(name != null && !name.isEmpty() && (!out.has(DataComponents.CUSTOM_NAME) || !out.getHoverName().getString().equals(name))) { + out.set(DataComponents.CUSTOM_NAME, Component.literal(name)); cost++; } @@ -324,9 +321,10 @@ public void onGetSpeed(ZPlayer.BreakSpeed event) { Player player = event.getPlayer(); ItemStack stack = player.getMainHandItem(); BlockState state = event.getState(); + Holder efficiency = event.getPlayer().level().registryAccess().lookupOrThrow(Registries.ENCHANTMENT).getOrThrow(Enchantments.EFFICIENCY); if(state.is(Blocks.DEEPSLATE) - && EnchantmentHelper.getItemEnchantmentLevel(Enchantments.BLOCK_EFFICIENCY, stack) >= 6 + && EnchantmentHelper.getTagEnchantmentLevel(efficiency, stack) >= 6 && event.getOriginalSpeed() >= 45F && (!deepslateTweakNeedsHaste2 || playerHasHaste2(player))) { @@ -477,8 +475,8 @@ private static void moveFromInventoryToPaymentSlot(MerchantMenu menu, MerchantCo ItemStack inSlot = menu.slots.get(slot).getItem(); ItemStack currentStack = container.getItem(tradeSlot); - if(!ItemStack.isSameItemSameTags(inSlot, offer.getResult()) && - !inSlot.isEmpty() && (currentStack.isEmpty() ? offer.isRequiredItem(inSlot, targetStack) : ItemStack.isSameItemSameTags(targetStack, inSlot))) { + if(!ItemStack.isSameItemSameComponents(inSlot, offer.getResult()) && + !inSlot.isEmpty() && (currentStack.isEmpty() ? offer.isRequiredItem(inSlot, targetStack) : ItemStack.isSameItemSameComponents(targetStack, inSlot))) { int currentCount = currentStack.isEmpty() ? 0 : currentStack.getCount(); int amountToTake = Math.min(targetStack.getMaxStackSize() - currentCount, inSlot.getCount()); ItemStack newStack = inSlot.copy(); diff --git a/src/main/java/org/violetmoon/quark/content/tools/module/BeaconRedirectionModule.java b/src/main/java/org/violetmoon/quark/content/tools/module/BeaconRedirectionModule.java index 6ee60243ee..6323498fe2 100644 --- a/src/main/java/org/violetmoon/quark/content/tools/module/BeaconRedirectionModule.java +++ b/src/main/java/org/violetmoon/quark/content/tools/module/BeaconRedirectionModule.java @@ -5,9 +5,7 @@ import net.minecraft.core.Vec3i; import net.minecraft.core.registries.Registries; import net.minecraft.network.chat.Component; -import net.minecraft.resources.ResourceLocation; import net.minecraft.server.level.ServerPlayer; -import net.minecraft.tags.BlockTags; import net.minecraft.tags.TagKey; import net.minecraft.world.item.Item; import net.minecraft.world.item.Items; diff --git a/src/main/java/org/violetmoon/quark/content/tools/module/ColorRunesModule.java b/src/main/java/org/violetmoon/quark/content/tools/module/ColorRunesModule.java index d03a79d699..18342ba8dd 100644 --- a/src/main/java/org/violetmoon/quark/content/tools/module/ColorRunesModule.java +++ b/src/main/java/org/violetmoon/quark/content/tools/module/ColorRunesModule.java @@ -2,6 +2,7 @@ import com.google.common.collect.ImmutableSet; import net.minecraft.client.renderer.RenderType; +import net.minecraft.core.component.DataComponents; import net.minecraft.core.registries.Registries; import net.minecraft.network.chat.CommonComponents; import net.minecraft.network.chat.Component; @@ -13,7 +14,6 @@ import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.projectile.ThrownTrident; -import net.minecraft.world.item.CompassItem; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; @@ -38,9 +38,7 @@ import org.violetmoon.zeta.event.play.loading.ZLootTableLoad; import org.violetmoon.zeta.module.ZetaLoadModule; import org.violetmoon.zeta.module.ZetaModule; -import org.violetmoon.zeta.network.ZetaNetworkDirection; import org.violetmoon.zeta.util.Hint; -import org.violetmoon.zeta.util.ItemNBTHelper; import java.util.List; import java.util.Map; @@ -116,7 +114,7 @@ public static RuneColor getAppliedStackColor(ItemStack target) { public static void syncTrident(Consumer> packetConsumer, ThrownTrident trident, boolean force) { ItemStack stack = trident.getPickupItem(); ItemStack prev = TRIDENT_STACK_REFERENCES.get(trident); - if(force || prev == null || ItemStack.isSameItemSameTags(stack, prev)) + if(force || prev == null || ItemStack.isSameItemSameComponents(stack, prev)) packetConsumer.accept(Quark.ZETA.network.wrapInVanilla(new UpdateTridentMessage(trident.getId(), stack), ZetaNetworkDirection.PLAY_TO_CLIENT)); else TRIDENT_STACK_REFERENCES.put(trident, stack); @@ -188,7 +186,7 @@ private boolean isPlayerRainbow(Player player) { } public static boolean canHaveRune(ItemStack stack) { - return stack.isEnchanted() || (stack.getItem() == Items.COMPASS && CompassItem.isLodestoneCompass(stack)); // isLodestoneCompass = is lodestone compass + return stack.isEnchanted() || (stack.getItem() == Items.COMPASS && stack.has(DataComponents.LODESTONE_TRACKER)); // isLodestoneCompass = is lodestone compass } public static Component extremeRainbow(Component component) { @@ -245,7 +243,7 @@ public static RenderType getEntityGlint() { } public static RenderType getGlintDirect() { - return renderType(GlintRenderTypes.glintDirect, RenderType::glintDirect); + return renderType(GlintRenderTypes.glintDirect, RenderType::entityGlintDirect); } public static RenderType getEntityGlintDirect() { @@ -253,7 +251,7 @@ public static RenderType getEntityGlintDirect() { } public static RenderType getArmorGlint() { - return renderType(GlintRenderTypes.armorGlint, RenderType::armorGlint); + return renderType(GlintRenderTypes.armorGlint, RenderType::armorEntityGlint); } public static RenderType getArmorEntityGlint() { diff --git a/src/main/java/org/violetmoon/quark/content/tools/module/EndermoshMusicDiscModule.java b/src/main/java/org/violetmoon/quark/content/tools/module/EndermoshMusicDiscModule.java index 05a4749195..d337fc4d7c 100644 --- a/src/main/java/org/violetmoon/quark/content/tools/module/EndermoshMusicDiscModule.java +++ b/src/main/java/org/violetmoon/quark/content/tools/module/EndermoshMusicDiscModule.java @@ -3,19 +3,22 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.resources.sounds.SimpleSoundInstance; import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.JukeboxSongs; +import net.minecraft.world.item.Rarity; import net.minecraft.world.level.dimension.LevelStem; import net.minecraft.world.level.storage.loot.BuiltInLootTables; import net.minecraft.world.level.storage.loot.entries.LootItem; import net.minecraft.world.level.storage.loot.entries.LootPoolEntryContainer; - import org.violetmoon.quark.base.handler.QuarkSounds; -import org.violetmoon.quark.base.item.QuarkMusicDiscItem; import org.violetmoon.zeta.client.event.play.ZClientTick; import org.violetmoon.zeta.config.Config; import org.violetmoon.zeta.event.bus.LoadEvent; import org.violetmoon.zeta.event.bus.PlayEvent; +import org.violetmoon.zeta.event.bus.ZPhase; import org.violetmoon.zeta.event.load.ZRegister; import org.violetmoon.zeta.event.play.loading.ZLootTableLoad; +import org.violetmoon.zeta.item.ZetaItem; import org.violetmoon.zeta.module.ZetaLoadModule; import org.violetmoon.zeta.module.ZetaModule; import org.violetmoon.zeta.util.Hint; @@ -34,23 +37,24 @@ public class EndermoshMusicDiscModule extends ZetaModule { protected int lootQuality = 1; @Hint - public QuarkMusicDiscItem endermosh; + public Item endermosh; @LoadEvent public final void register(ZRegister event) { - endermosh = new QuarkMusicDiscItem(14, () -> QuarkSounds.MUSIC_ENDERMOSH, "endermosh", this, 3783); // Tick length calculated from endermosh.ogg - 3:09.150 + // endermosh = new QuarkMusicDiscItem(14, () -> QuarkSounds.MUSIC_ENDERMOSH, "endermosh", this, 3783); // Tick length calculated from endermosh.ogg - 3:09.150 + // TODO: JukeboxSongs.XXXXXX requires datagen with above parameters + endermosh = new ZetaItem("music_disc_endermosh", this, new Item.Properties().rarity(Rarity.RARE).jukeboxPlayable(JukeboxSongs.THIRTEEN)); } @PlayEvent public void onLootTableLoad(ZLootTableLoad event) { if(addToEndCityLoot) { ResourceLocation res = event.getName(); - if(res.equals(BuiltInLootTables.END_CITY_TREASURE)) { + if(res.equals(BuiltInLootTables.END_CITY_TREASURE.location())) { LootPoolEntryContainer entry = LootItem.lootTableItem(endermosh) .setWeight(lootWeight) .setQuality(lootQuality) .build(); - event.add(entry); } } @@ -64,7 +68,8 @@ public static class Client extends EndermoshMusicDiscModule { private SimpleSoundInstance sound; @PlayEvent - public void clientTick(ZClientTick.End event) { + public void clientTick(ZClientTick event) { + if (event.getPhase() != ZPhase.END) return; if(playEndermoshDuringEnderdragonFight) { boolean wasFightingDragon = isFightingDragon; @@ -80,7 +85,7 @@ public void clientTick(ZClientTick.End event) { if(delay == targetDelay) { sound = SimpleSoundInstance.forMusic(QuarkSounds.MUSIC_ENDERMOSH); mc.getSoundManager().playDelayed(sound, 0); - mc.gui.setNowPlaying(endermosh.getDisplayName()); + mc.gui.setNowPlaying(endermosh.getDescription()); } double x = mc.player.getX(); diff --git a/src/main/java/org/violetmoon/quark/content/tools/module/PathfinderMapsModule.java b/src/main/java/org/violetmoon/quark/content/tools/module/PathfinderMapsModule.java index 121253fd2f..f207fd5b3f 100644 --- a/src/main/java/org/violetmoon/quark/content/tools/module/PathfinderMapsModule.java +++ b/src/main/java/org/violetmoon/quark/content/tools/module/PathfinderMapsModule.java @@ -27,6 +27,7 @@ import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; +import net.minecraft.world.item.trading.ItemCost; import net.minecraft.world.item.trading.MerchantOffer; import net.minecraft.world.item.trading.MerchantOffers; import net.minecraft.world.level.biome.Biome; @@ -62,6 +63,7 @@ import java.util.ArrayList; import java.util.List; +import java.util.Optional; import java.util.function.Predicate; import java.util.stream.Collectors; @@ -329,8 +331,8 @@ public MerchantOffer getOffer(@NotNull Entity entity, @NotNull RandomSource rand int xp = xpFromTrade * Math.max(1, (info.level - 1)); if(hasCompass) - return new MerchantOffer(new ItemStack(Items.EMERALD, i), new ItemStack(Items.COMPASS), itemstack, 12, xp, 0.2F); - return new MerchantOffer(new ItemStack(Items.EMERALD, i), itemstack, 12, xp, 0.2F); + return new MerchantOffer(new ItemCost(Items.EMERALD, i), Optional.of(new ItemCost(Items.COMPASS)), itemstack, 12, xp, 0.2F); + return new MerchantOffer(new ItemCost(Items.EMERALD, i), itemstack, 12, xp, 0.2F); } } @@ -415,6 +417,5 @@ public void registerItemColors(ZAddItemColorHandlers event) { ItemColor color = (stack, id) -> id == 0 ? 0xFFFFFF : PathfindersQuillItem.getOverlayColor(stack); event.register(color, pathfinders_quill); } - } } diff --git a/src/main/java/org/violetmoon/quark/content/tools/module/PickarangModule.java b/src/main/java/org/violetmoon/quark/content/tools/module/PickarangModule.java index 5c8facc34d..ba9b87c346 100755 --- a/src/main/java/org/violetmoon/quark/content/tools/module/PickarangModule.java +++ b/src/main/java/org/violetmoon/quark/content/tools/module/PickarangModule.java @@ -3,8 +3,6 @@ import net.minecraft.client.renderer.entity.EntityRenderers; import net.minecraft.core.registries.Registries; import net.minecraft.resources.ResourceKey; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.tags.BlockTags; import net.minecraft.tags.TagKey; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.damagesource.DamageType; diff --git a/src/main/java/org/violetmoon/quark/content/tools/module/SkullPikesModule.java b/src/main/java/org/violetmoon/quark/content/tools/module/SkullPikesModule.java index e73a948ab5..89cf4738d5 100644 --- a/src/main/java/org/violetmoon/quark/content/tools/module/SkullPikesModule.java +++ b/src/main/java/org/violetmoon/quark/content/tools/module/SkullPikesModule.java @@ -20,7 +20,6 @@ import net.minecraft.client.renderer.entity.EntityRenderers; import net.minecraft.core.BlockPos; import net.minecraft.core.registries.Registries; -import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.BlockTags; import net.minecraft.tags.TagKey; import net.minecraft.world.entity.Entity; diff --git a/src/main/java/org/violetmoon/quark/content/tools/module/SlimeInABucketModule.java b/src/main/java/org/violetmoon/quark/content/tools/module/SlimeInABucketModule.java index 8fe4d4b0a3..ca9dbba32d 100644 --- a/src/main/java/org/violetmoon/quark/content/tools/module/SlimeInABucketModule.java +++ b/src/main/java/org/violetmoon/quark/content/tools/module/SlimeInABucketModule.java @@ -2,7 +2,6 @@ import net.minecraft.client.renderer.item.ItemProperties; import net.minecraft.nbt.CompoundTag; -import net.minecraft.resources.ResourceLocation; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.EntityType; @@ -12,7 +11,6 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.level.gameevent.GameEvent; - import org.violetmoon.quark.base.Quark; import org.violetmoon.quark.content.tools.item.SlimeInABucketItem; import org.violetmoon.zeta.client.event.load.ZClientSetup; diff --git a/src/main/java/org/violetmoon/quark/content/tools/recipe/SmithingRuneRecipe.java b/src/main/java/org/violetmoon/quark/content/tools/recipe/SmithingRuneRecipe.java index 687731b84a..62948a7406 100644 --- a/src/main/java/org/violetmoon/quark/content/tools/recipe/SmithingRuneRecipe.java +++ b/src/main/java/org/violetmoon/quark/content/tools/recipe/SmithingRuneRecipe.java @@ -1,15 +1,8 @@ package org.violetmoon.quark.content.tools.recipe; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonSyntaxException; import net.minecraft.core.HolderLookup; -import net.minecraft.core.RegistryAccess; import net.minecraft.core.component.DataComponents; -import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.chat.Component; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.util.GsonHelper; import net.minecraft.util.RandomSource; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; @@ -38,7 +31,6 @@ public final class SmithingRuneRecipe extends SmithingTrimRecipe { // Extends to allow JEI to pick it up public static final Serializer SERIALIZER = new Serializer(); - private final ResourceLocation id; private final Ingredient template; private final Ingredient addition; private final RuneColor runeColor; @@ -78,9 +70,8 @@ private static Ingredient createBaseIngredient() { return used; } - private SmithingRuneRecipe(ResourceLocation id, Ingredient template, Ingredient addition, RuneColor runeColor) { - super(id, template, createBaseIngredient(), addition); - this.id = id; + private SmithingRuneRecipe(Ingredient template, Ingredient addition, RuneColor runeColor) { + super(template, createBaseIngredient(), addition); this.template = template; this.addition = addition; this.runeColor = runeColor; @@ -110,7 +101,6 @@ public ItemStack assemble(SmithingRecipeInput input, HolderLookup.Provider provi public ItemStack getResultItem(@Nonnull HolderLookup.Provider provider) { ItemStack displayStack = makeEnchantedDisplayItem(new ItemStack(Items.IRON_CHESTPLATE)); ColorRunesModule.withRune(displayStack, runeColor); - return displayStack; } @@ -126,50 +116,12 @@ public boolean isBaseIngredient(@Nonnull ItemStack stack) { @Override public boolean isAdditionIngredient(@Nonnull ItemStack stack) { - if (this.addition.isEmpty()) - return stack.isEmpty(); - return this.addition.test(stack); + return this.addition.isEmpty() ? stack.isEmpty() : this.addition.test(stack); } @Nonnull @Override public RecipeSerializer getSerializer() { - return SERIALIZER; - } - - public static class Serializer implements RecipeSerializer { - - @Nonnull - @Override - public SmithingRuneRecipe fromJson(@Nonnull ResourceLocation id, @Nonnull JsonObject serialized) { - Ingredient template = Ingredient.fromJson(GsonHelper.getNonNull(serialized, "template")); - - JsonElement additionElement = serialized.get("addition"); - Ingredient addition = additionElement != null && !additionElement.isJsonNull() ? Ingredient.fromJson(additionElement) : Ingredient.EMPTY; - - RuneColor runeColor = RuneColor.byName(GsonHelper.getAsString(serialized, "color")); - if (runeColor == null) - throw new JsonSyntaxException("Rune color must be a valid dye color, rainbow, or blank"); - return new SmithingRuneRecipe(id, template, addition, runeColor); - } - - @Override - public SmithingRuneRecipe fromNetwork(@Nonnull ResourceLocation id, @Nonnull FriendlyByteBuf buf) { - Ingredient template = Ingredient.fromNetwork(buf); - Ingredient addition = buf.readBoolean() ? Ingredient.EMPTY : Ingredient.fromNetwork(buf); - RuneColor runeColor = RuneColor.byName(buf.readUtf()); - return new SmithingRuneRecipe(id, template, addition, runeColor); - } - - @Override - public void toNetwork(@Nonnull FriendlyByteBuf buf, SmithingRuneRecipe recipe) { - recipe.template.toNetwork(buf); - boolean additionIsEmpty = recipe.addition.isEmpty(); - buf.writeBoolean(additionIsEmpty); - if (!additionIsEmpty) - recipe.addition.toNetwork(buf); - - buf.writeUtf(recipe.runeColor.getSerializedName()); - } + return RecipeSerializer.SMITHING_TRIM; } } diff --git a/src/main/java/org/violetmoon/quark/content/tweaks/block/WaterPetalBlock.java b/src/main/java/org/violetmoon/quark/content/tweaks/block/WaterPetalBlock.java index 9f5bfda40b..0c89f719ee 100644 --- a/src/main/java/org/violetmoon/quark/content/tweaks/block/WaterPetalBlock.java +++ b/src/main/java/org/violetmoon/quark/content/tweaks/block/WaterPetalBlock.java @@ -13,7 +13,6 @@ import net.minecraft.core.BlockPos; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; -import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.LevelReader; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.PinkPetalsBlock; diff --git a/src/main/java/org/violetmoon/quark/content/tweaks/client/layer/ArmorStandFakePlayerLayer.java b/src/main/java/org/violetmoon/quark/content/tweaks/client/layer/ArmorStandFakePlayerLayer.java index 886e252e73..7f13594ad9 100644 --- a/src/main/java/org/violetmoon/quark/content/tweaks/client/layer/ArmorStandFakePlayerLayer.java +++ b/src/main/java/org/violetmoon/quark/content/tweaks/client/layer/ArmorStandFakePlayerLayer.java @@ -4,7 +4,6 @@ import com.mojang.authlib.minecraft.MinecraftProfileTexture; import com.mojang.authlib.minecraft.MinecraftProfileTexture.Type; import com.mojang.blaze3d.vertex.PoseStack; - import net.minecraft.client.Minecraft; import net.minecraft.client.model.EntityModel; import net.minecraft.client.model.PlayerModel; @@ -27,9 +26,7 @@ import net.minecraft.world.item.Items; import net.minecraft.world.item.enchantment.EnchantmentHelper; import net.minecraft.world.level.block.SkullBlock; - import org.jetbrains.annotations.NotNull; - import org.violetmoon.quark.content.client.module.UsesForCursesModule; import org.violetmoon.zeta.util.ItemNBTHelper; @@ -47,8 +44,7 @@ public ArmorStandFakePlayerLayer(RenderLayerParent parent, Entity @Override public void render(@NotNull PoseStack pose, @NotNull MultiBufferSource buffer, int light, @NotNull ArmorStand armor, float p_117353_, float p_117354_, float p_117355_, float p_117356_, float p_117357_, float p_117358_) { - if(!UsesForCursesModule.staticEnabled || !UsesForCursesModule.bindArmorStandsWithPlayerHeads) - return; + if(!UsesForCursesModule.staticEnabled || !UsesForCursesModule.bindArmorStandsWithPlayerHeads) return; ItemStack head = armor.getItemBySlot(EquipmentSlot.HEAD); if(head.is(Items.PLAYER_HEAD) && EnchantmentHelper.hasBindingCurse(head)) { diff --git a/src/main/java/org/violetmoon/quark/content/tweaks/compat/BetterElytraRocketCuriosCompat.java b/src/main/java/org/violetmoon/quark/content/tweaks/compat/BetterElytraRocketCuriosCompat.java index 469f37c2fe..0ea36066de 100644 --- a/src/main/java/org/violetmoon/quark/content/tweaks/compat/BetterElytraRocketCuriosCompat.java +++ b/src/main/java/org/violetmoon/quark/content/tweaks/compat/BetterElytraRocketCuriosCompat.java @@ -1,7 +1,7 @@ package org.violetmoon.quark.content.tweaks.compat; import net.minecraft.world.entity.player.Player; -import net.minecraftforge.items.IItemHandlerModifiable; +import net.neoforged.neoforge.items.IItemHandlerModifiable; import top.theillusivec4.curios.api.CuriosApi; import top.theillusivec4.curios.api.type.capability.ICuriosItemHandler; @@ -9,7 +9,7 @@ public class BetterElytraRocketCuriosCompat { public static boolean hasCuriosElytra(Player player) { - Optional curiosApi = CuriosApi.getCuriosInventory(player).resolve(); + Optional curiosApi = CuriosApi.getCuriosInventory(player); if (curiosApi.isPresent()) { IItemHandlerModifiable curios = curiosApi.get().getEquippedCurios(); for (int slot = 0; slot < curios.getSlots(); slot++) { diff --git a/src/main/java/org/violetmoon/quark/content/tweaks/compat/TotemOfHoldingCuriosCompat.java b/src/main/java/org/violetmoon/quark/content/tweaks/compat/TotemOfHoldingCuriosCompat.java index 9425685907..7b9906a4a7 100644 --- a/src/main/java/org/violetmoon/quark/content/tweaks/compat/TotemOfHoldingCuriosCompat.java +++ b/src/main/java/org/violetmoon/quark/content/tweaks/compat/TotemOfHoldingCuriosCompat.java @@ -2,7 +2,7 @@ import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; -import net.minecraftforge.items.IItemHandlerModifiable; +import net.neoforged.neoforge.items.IItemHandlerModifiable; import org.violetmoon.quark.addons.oddities.entity.TotemOfHoldingEntity; import top.theillusivec4.curios.api.CuriosApi; import top.theillusivec4.curios.api.type.capability.ICuriosItemHandler; @@ -14,7 +14,7 @@ public class TotemOfHoldingCuriosCompat { public static ItemStack equipCurios(Player player, List equipedCurios, ItemStack stack) { - Optional curiosApi = CuriosApi.getCuriosInventory(player).resolve(); + Optional curiosApi = CuriosApi.getCuriosInventory(player); if (curiosApi.isPresent()) { for (int j = 0; j < equipedCurios.size(); j++) { ItemStack curiosItem = equipedCurios.get(j); @@ -31,7 +31,7 @@ public static ItemStack equipCurios(Player player, List equipedCurios } public static void saveCurios(Player player, TotemOfHoldingEntity totem) { - Optional curiosApi = CuriosApi.getCuriosInventory(player).resolve(); + Optional curiosApi = CuriosApi.getCuriosInventory(player); curiosApi.ifPresent(iCuriosItemHandler -> iCuriosItemHandler.getCurios().forEach((a, b) -> IntStream.range(0, b.getStacks().getSlots()).mapToObj(i -> b.getStacks().getPreviousStackInSlot(i)).forEach(totem::addCurios))); diff --git a/src/main/java/org/violetmoon/quark/content/tweaks/module/AutomaticRecipeUnlockModule.java b/src/main/java/org/violetmoon/quark/content/tweaks/module/AutomaticRecipeUnlockModule.java index 8c0d251753..6b2a7e21a8 100644 --- a/src/main/java/org/violetmoon/quark/content/tweaks/module/AutomaticRecipeUnlockModule.java +++ b/src/main/java/org/violetmoon/quark/content/tweaks/module/AutomaticRecipeUnlockModule.java @@ -1,7 +1,6 @@ package org.violetmoon.quark.content.tweaks.module; import com.google.common.collect.Lists; - import net.minecraft.advancements.Advancement; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.components.ImageButton; @@ -17,8 +16,8 @@ import net.minecraft.world.entity.player.Player; import net.minecraft.world.inventory.RecipeBookType; import net.minecraft.world.item.crafting.Recipe; +import net.minecraft.world.item.crafting.RecipeHolder; import net.minecraft.world.level.GameRules; - import org.violetmoon.quark.base.Quark; import org.violetmoon.zeta.client.event.play.ZClientTick; import org.violetmoon.zeta.client.event.play.ZScreen; @@ -132,7 +131,7 @@ public void clientTick(ZClientTick event) { Queue toastQueue = toasts.queued; for(Toast toast : toastQueue) if(toast instanceof RecipeToast recipeToast) { - List> stacks = recipeToast.recipes; + List> stacks = recipeToast.recipes; if(stacks.size() > 100) { toastQueue.remove(toast); return; diff --git a/src/main/java/org/violetmoon/quark/content/tweaks/module/CompassesWorkEverywhereModule.java b/src/main/java/org/violetmoon/quark/content/tweaks/module/CompassesWorkEverywhereModule.java index da5ab3c53a..41c37991c0 100644 --- a/src/main/java/org/violetmoon/quark/content/tweaks/module/CompassesWorkEverywhereModule.java +++ b/src/main/java/org/violetmoon/quark/content/tweaks/module/CompassesWorkEverywhereModule.java @@ -4,7 +4,6 @@ import net.minecraft.core.BlockPos; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.MutableComponent; -import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.Item; 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 9da0262cc5..edf4e10f17 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 @@ -3,15 +3,11 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.player.Input; import net.minecraft.core.BlockPos; -import net.minecraft.core.Direction; import net.minecraft.core.registries.Registries; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.MutableComponent; -import net.minecraft.resources.ResourceLocation; import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; -import net.minecraft.tags.BlockTags; -import net.minecraft.tags.ItemTags; import net.minecraft.tags.TagKey; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; diff --git a/src/main/java/org/violetmoon/quark/content/tweaks/module/GlassShardModule.java b/src/main/java/org/violetmoon/quark/content/tweaks/module/GlassShardModule.java index 9eb1c03666..42b4239d63 100644 --- a/src/main/java/org/violetmoon/quark/content/tweaks/module/GlassShardModule.java +++ b/src/main/java/org/violetmoon/quark/content/tweaks/module/GlassShardModule.java @@ -5,7 +5,6 @@ import net.minecraft.core.registries.Registries; import org.violetmoon.quark.base.Quark; -import org.violetmoon.quark.content.experimental.module.VariantSelectorModule; import org.violetmoon.quark.content.tweaks.block.DirtyGlassBlock; import org.violetmoon.zeta.block.ZetaBlock; import org.violetmoon.zeta.block.ZetaInheritedPaneBlock; @@ -18,8 +17,6 @@ import org.violetmoon.zeta.registry.CreativeTabManager; import org.violetmoon.zeta.util.MiscUtil; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.tags.ItemTags; import net.minecraft.tags.TagKey; import net.minecraft.world.item.CreativeModeTabs; import net.minecraft.world.item.DyeColor; diff --git a/src/main/java/org/violetmoon/quark/content/tweaks/module/GoldToolsHaveFortuneModule.java b/src/main/java/org/violetmoon/quark/content/tweaks/module/GoldToolsHaveFortuneModule.java index 5d2d6cf624..0dc5864941 100644 --- a/src/main/java/org/violetmoon/quark/content/tweaks/module/GoldToolsHaveFortuneModule.java +++ b/src/main/java/org/violetmoon/quark/content/tweaks/module/GoldToolsHaveFortuneModule.java @@ -6,6 +6,7 @@ import it.unimi.dsi.fastutil.objects.Object2IntMap; import net.minecraft.ChatFormatting; +import net.minecraft.core.Holder; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.ListTag; @@ -154,7 +155,7 @@ public static boolean shouldShowEnchantments(ItemStack stack) { public static void fakeEnchantmentTooltip(ItemStack stack, List components) { if(staticEnabled && displayBakedEnchantmentsInTooltip) - for(Map.Entry entry : Quark.ZETA.itemExtensions.get(stack).getAllEnchantmentsZeta(stack).entrySet()) { + for(Object2IntMap.Entry> entry : Quark.ZETA.itemExtensions.get(stack).getAllEnchantmentsZeta(stack).entrySet()) { int actualLevel = EnchantmentHelper.getTagEnchantmentLevel(entry.getKey(), stack); if(actualLevel != entry.getValue()) { Component comp = entry.getKey().getFullname(entry.getValue()); @@ -173,9 +174,9 @@ public static void fakeEnchantmentTooltip(ItemStack stack, List compo public static ListTag hideSmallerEnchantments(ItemStack stack, ListTag tag) { if(staticEnabled && displayBakedEnchantmentsInTooltip) { List toRemove = Lists.newArrayList(); - for(Map.Entry entry : Quark.ZETA.itemExtensions.get(stack).getAllEnchantmentsZeta(stack).entrySet()) { + for(Object2IntMap.Entry> entry : Quark.ZETA.itemExtensions.get(stack).getAllEnchantmentsZeta(stack).entrySet()) { int actualLevel = EnchantmentHelper.getTagEnchantmentLevel(entry.getKey(), stack); - if(actualLevel != entry.getValue() && actualLevel != 0) { + if(actualLevel != entry.getIntValue() && actualLevel != 0) { toRemove.add(EnchantmentHelper.getEnchantmentId(entry.getKey())); } } diff --git a/src/main/java/org/violetmoon/quark/content/tweaks/module/LockRotationModule.java b/src/main/java/org/violetmoon/quark/content/tweaks/module/LockRotationModule.java index 64ecd8781a..db17de2a46 100644 --- a/src/main/java/org/violetmoon/quark/content/tweaks/module/LockRotationModule.java +++ b/src/main/java/org/violetmoon/quark/content/tweaks/module/LockRotationModule.java @@ -6,7 +6,6 @@ import java.util.UUID; import com.mojang.blaze3d.platform.GlStateManager; -import org.lwjgl.opengl.GL11; import org.violetmoon.quark.api.IRotationLockable; import org.violetmoon.quark.base.Quark; import org.violetmoon.quark.base.QuarkClient; @@ -33,7 +32,6 @@ import net.minecraft.client.KeyMapping; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiGraphics; -import net.minecraft.client.renderer.GameRenderer; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.Direction.Axis; diff --git a/src/main/java/org/violetmoon/quark/content/tweaks/module/MapWashingModule.java b/src/main/java/org/violetmoon/quark/content/tweaks/module/MapWashingModule.java index 2cc6e61734..e59b7918f1 100644 --- a/src/main/java/org/violetmoon/quark/content/tweaks/module/MapWashingModule.java +++ b/src/main/java/org/violetmoon/quark/content/tweaks/module/MapWashingModule.java @@ -1,7 +1,6 @@ package org.violetmoon.quark.content.tweaks.module; import net.minecraft.core.cauldron.CauldronInteraction; -import net.minecraft.world.InteractionResult; import net.minecraft.world.ItemInteractionResult; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; diff --git a/src/main/java/org/violetmoon/quark/content/tweaks/module/NoDurabilityOnCosmeticsModule.java b/src/main/java/org/violetmoon/quark/content/tweaks/module/NoDurabilityOnCosmeticsModule.java index 7ac5feba21..2ec79e0e76 100644 --- a/src/main/java/org/violetmoon/quark/content/tweaks/module/NoDurabilityOnCosmeticsModule.java +++ b/src/main/java/org/violetmoon/quark/content/tweaks/module/NoDurabilityOnCosmeticsModule.java @@ -1,8 +1,6 @@ package org.violetmoon.quark.content.tweaks.module; import net.minecraft.core.registries.Registries; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.tags.ItemTags; import net.minecraft.tags.TagKey; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; diff --git a/src/main/java/org/violetmoon/quark/content/tweaks/module/PigLittersModule.java b/src/main/java/org/violetmoon/quark/content/tweaks/module/PigLittersModule.java index 027e2cbf72..ae787b9fca 100644 --- a/src/main/java/org/violetmoon/quark/content/tweaks/module/PigLittersModule.java +++ b/src/main/java/org/violetmoon/quark/content/tweaks/module/PigLittersModule.java @@ -1,6 +1,5 @@ package org.violetmoon.quark.content.tweaks.module; -import net.minecraft.world.entity.Entity; import org.violetmoon.quark.base.Quark; import org.violetmoon.zeta.config.Config; import org.violetmoon.zeta.event.bus.PlayEvent; @@ -17,7 +16,6 @@ import net.minecraft.stats.Stats; import net.minecraft.util.RandomSource; import net.minecraft.world.entity.AgeableMob; -import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.ai.goal.TemptGoal; import net.minecraft.world.entity.ai.goal.WrappedGoal; diff --git a/src/main/java/org/violetmoon/quark/content/tweaks/module/ReacharoundPlacingModule.java b/src/main/java/org/violetmoon/quark/content/tweaks/module/ReacharoundPlacingModule.java index fa4694a166..628138dfbf 100644 --- a/src/main/java/org/violetmoon/quark/content/tweaks/module/ReacharoundPlacingModule.java +++ b/src/main/java/org/violetmoon/quark/content/tweaks/module/ReacharoundPlacingModule.java @@ -15,7 +15,6 @@ import net.minecraft.resources.ResourceLocation; import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundSource; -import net.minecraft.tags.ItemTags; import net.minecraft.tags.TagKey; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; diff --git a/src/main/java/org/violetmoon/quark/content/tweaks/module/RenewableSporeBlossomsModule.java b/src/main/java/org/violetmoon/quark/content/tweaks/module/RenewableSporeBlossomsModule.java index ec081135a5..4fed4a05c8 100644 --- a/src/main/java/org/violetmoon/quark/content/tweaks/module/RenewableSporeBlossomsModule.java +++ b/src/main/java/org/violetmoon/quark/content/tweaks/module/RenewableSporeBlossomsModule.java @@ -8,7 +8,6 @@ import org.violetmoon.zeta.config.Config; import org.violetmoon.zeta.event.bus.PlayEvent; -import org.violetmoon.zeta.event.bus.ZResult; import org.violetmoon.zeta.event.play.ZBonemeal; import org.violetmoon.zeta.module.ZetaLoadModule; import org.violetmoon.zeta.module.ZetaModule; diff --git a/src/main/java/org/violetmoon/quark/content/tweaks/module/ShulkerPackingModule.java b/src/main/java/org/violetmoon/quark/content/tweaks/module/ShulkerPackingModule.java index 8c0e8506bc..1684042232 100644 --- a/src/main/java/org/violetmoon/quark/content/tweaks/module/ShulkerPackingModule.java +++ b/src/main/java/org/violetmoon/quark/content/tweaks/module/ShulkerPackingModule.java @@ -1,6 +1,7 @@ package org.violetmoon.quark.content.tweaks.module; import net.minecraft.core.BlockPos; +import net.minecraft.core.component.DataComponents; import net.minecraft.network.chat.Component; import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; @@ -17,8 +18,8 @@ import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.ShulkerBoxBlockEntity; import net.minecraft.world.level.block.state.BlockState; -import net.minecraftforge.items.ItemHandlerHelper; import net.neoforged.neoforge.common.Tags; +import net.neoforged.neoforge.items.ItemHandlerHelper; import org.violetmoon.zeta.event.bus.PlayEvent; import org.violetmoon.zeta.event.play.entity.player.ZRightClickBlock; import org.violetmoon.zeta.module.ZetaLoadModule; @@ -66,7 +67,7 @@ public void callFedEnd(ZRightClickBlock event) { Component component = nameable.getCustomName(); if(component != null) { shulkerBoxData.setCustomName(component); - newShulkerBox.setHoverName(component); + newShulkerBox.set(DataComponents.CUSTOM_NAME, component); } } diff --git a/src/main/java/org/violetmoon/quark/content/tweaks/recipe/ElytraDuplicationRecipe.java b/src/main/java/org/violetmoon/quark/content/tweaks/recipe/ElytraDuplicationRecipe.java index 93393577b2..ae9bc54310 100644 --- a/src/main/java/org/violetmoon/quark/content/tweaks/recipe/ElytraDuplicationRecipe.java +++ b/src/main/java/org/violetmoon/quark/content/tweaks/recipe/ElytraDuplicationRecipe.java @@ -2,9 +2,6 @@ import net.minecraft.core.HolderLookup; import net.minecraft.core.NonNullList; -import net.minecraft.core.RegistryAccess; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.inventory.CraftingContainer; import net.minecraft.world.item.ElytraItem; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; diff --git a/src/main/java/org/violetmoon/quark/content/world/feature/AncientTreeTopperDecorator.java b/src/main/java/org/violetmoon/quark/content/world/feature/AncientTreeTopperDecorator.java index c0fbdc5ce8..64bb1eb8ca 100644 --- a/src/main/java/org/violetmoon/quark/content/world/feature/AncientTreeTopperDecorator.java +++ b/src/main/java/org/violetmoon/quark/content/world/feature/AncientTreeTopperDecorator.java @@ -1,7 +1,6 @@ package org.violetmoon.quark.content.world.feature; import com.google.common.collect.ImmutableSet; -import com.mojang.serialization.Codec; import com.mojang.serialization.MapCodec; import net.minecraft.core.BlockPos; diff --git a/src/main/java/org/violetmoon/quark/content/world/gen/BlossomTreeGenerator.java b/src/main/java/org/violetmoon/quark/content/world/gen/BlossomTreeGenerator.java index b1e3fb3957..efa6715b82 100644 --- a/src/main/java/org/violetmoon/quark/content/world/gen/BlossomTreeGenerator.java +++ b/src/main/java/org/violetmoon/quark/content/world/gen/BlossomTreeGenerator.java @@ -2,7 +2,6 @@ import java.util.Optional; -import net.neoforged.neoforge.common.util.TriState; import org.violetmoon.quark.content.world.config.BlossomTreeConfig; import org.violetmoon.zeta.world.generator.Generator; @@ -14,7 +13,6 @@ import net.minecraft.server.level.WorldGenRegion; import net.minecraft.util.RandomSource; import net.minecraft.world.level.block.Blocks; -import net.minecraft.world.level.block.SaplingBlock; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.chunk.ChunkGenerator; import net.minecraft.world.level.levelgen.Heightmap.Types; diff --git a/src/main/java/org/violetmoon/quark/content/world/gen/FallenLogGenerator.java b/src/main/java/org/violetmoon/quark/content/world/gen/FallenLogGenerator.java index 6363ad8df3..a5fbed01a0 100644 --- a/src/main/java/org/violetmoon/quark/content/world/gen/FallenLogGenerator.java +++ b/src/main/java/org/violetmoon/quark/content/world/gen/FallenLogGenerator.java @@ -5,10 +5,8 @@ import net.minecraft.core.Holder; import net.minecraft.server.level.WorldGenRegion; import net.minecraft.tags.BlockTags; -import net.minecraft.tags.TagKey; import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; -import net.minecraft.world.level.FoliageColor; import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.biome.Biome; import net.minecraft.world.level.block.*; diff --git a/src/main/java/org/violetmoon/quark/content/world/gen/ObsidianSpikeGenerator.java b/src/main/java/org/violetmoon/quark/content/world/gen/ObsidianSpikeGenerator.java index 9e0dcb21bd..45ce3adbd9 100644 --- a/src/main/java/org/violetmoon/quark/content/world/gen/ObsidianSpikeGenerator.java +++ b/src/main/java/org/violetmoon/quark/content/world/gen/ObsidianSpikeGenerator.java @@ -2,7 +2,6 @@ import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.storage.loot.BuiltInLootTables; -import net.minecraft.world.level.storage.loot.LootTable; import org.violetmoon.quark.base.Quark; import org.violetmoon.quark.content.building.module.CompressedBlocksModule; import org.violetmoon.quark.content.world.module.NetherObsidianSpikesModule; @@ -12,7 +11,6 @@ import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; -import net.minecraft.resources.ResourceLocation; import net.minecraft.server.level.WorldGenRegion; import net.minecraft.util.RandomSource; import net.minecraft.world.entity.EntityType; diff --git a/src/main/java/org/violetmoon/quark/content/world/module/CorundumModule.java b/src/main/java/org/violetmoon/quark/content/world/module/CorundumModule.java index 6ed60a3e50..fce4668a9e 100644 --- a/src/main/java/org/violetmoon/quark/content/world/module/CorundumModule.java +++ b/src/main/java/org/violetmoon/quark/content/world/module/CorundumModule.java @@ -33,9 +33,7 @@ import net.minecraft.core.BlockPos; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.MutableComponent; -import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.BiomeTags; -import net.minecraft.tags.BlockTags; import net.minecraft.tags.TagKey; import net.minecraft.world.item.CreativeModeTabs; import net.minecraft.world.level.Level; diff --git a/src/main/java/org/violetmoon/quark/content/world/module/GlimmeringWealdModule.java b/src/main/java/org/violetmoon/quark/content/world/module/GlimmeringWealdModule.java index 7aa64432bf..05a6eb1496 100644 --- a/src/main/java/org/violetmoon/quark/content/world/module/GlimmeringWealdModule.java +++ b/src/main/java/org/violetmoon/quark/content/world/module/GlimmeringWealdModule.java @@ -5,7 +5,6 @@ import net.minecraft.core.registries.Registries; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; -import net.minecraft.tags.ItemTags; import net.minecraft.tags.TagKey; import net.minecraft.world.item.CreativeModeTabs; import net.minecraft.world.item.Item; @@ -16,8 +15,6 @@ import net.minecraft.world.level.block.ComposterBlock; import net.minecraft.world.level.levelgen.placement.PlacedFeature; import org.violetmoon.quark.base.Quark; -import org.violetmoon.quark.content.client.module.UsageTickerModule; -import org.violetmoon.quark.content.mobs.client.model.ShibaModel; import org.violetmoon.quark.content.world.block.GlowLichenGrowthBlock; import org.violetmoon.quark.content.world.block.GlowShroomBlock; import org.violetmoon.quark.content.world.block.GlowShroomRingBlock; @@ -25,7 +22,6 @@ import org.violetmoon.quark.content.world.feature.GlowExtrasFeature; import org.violetmoon.quark.content.world.feature.GlowShroomsFeature; import org.violetmoon.zeta.advancement.modifier.AdventuringTimeModifier; -import org.violetmoon.zeta.config.Config; import org.violetmoon.zeta.event.bus.LoadEvent; import org.violetmoon.zeta.event.load.ZCommonSetup; import org.violetmoon.zeta.event.load.ZRegister; diff --git a/src/main/java/org/violetmoon/quark/content/world/module/PermafrostModule.java b/src/main/java/org/violetmoon/quark/content/world/module/PermafrostModule.java index 386db71c95..35fa153bce 100644 --- a/src/main/java/org/violetmoon/quark/content/world/module/PermafrostModule.java +++ b/src/main/java/org/violetmoon/quark/content/world/module/PermafrostModule.java @@ -20,7 +20,6 @@ import org.violetmoon.zeta.world.WorldGenHandler; import net.minecraft.world.item.CreativeModeTabs; -import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.SoundType; import net.minecraft.world.level.levelgen.GenerationStep; diff --git a/src/main/java/org/violetmoon/quark/content/world/undergroundstyle/base/UndergroundStyle.java b/src/main/java/org/violetmoon/quark/content/world/undergroundstyle/base/UndergroundStyle.java index 48519b6050..39c6f9d65b 100644 --- a/src/main/java/org/violetmoon/quark/content/world/undergroundstyle/base/UndergroundStyle.java +++ b/src/main/java/org/violetmoon/quark/content/world/undergroundstyle/base/UndergroundStyle.java @@ -7,8 +7,6 @@ import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.tags.BlockTags; import net.minecraft.tags.TagKey; import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.block.Block; diff --git a/src/main/java/org/violetmoon/quark/datagen/QuarkBlockLootTableProvider.java b/src/main/java/org/violetmoon/quark/datagen/QuarkBlockLootTableProvider.java index 66a59651f7..bb098f369a 100644 --- a/src/main/java/org/violetmoon/quark/datagen/QuarkBlockLootTableProvider.java +++ b/src/main/java/org/violetmoon/quark/datagen/QuarkBlockLootTableProvider.java @@ -1,21 +1,15 @@ package org.violetmoon.quark.datagen; import net.minecraft.core.HolderLookup; -import net.minecraft.core.component.DataComponents; import net.minecraft.data.loot.BlockLootSubProvider; import net.minecraft.world.flag.FeatureFlags; import net.minecraft.world.item.Items; -import net.minecraft.world.level.ItemLike; -import net.minecraft.world.level.block.BeehiveBlock; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.storage.loot.LootPool; import net.minecraft.world.level.storage.loot.LootTable; import net.minecraft.world.level.storage.loot.entries.LootItem; -import net.minecraft.world.level.storage.loot.functions.CopyBlockState; -import net.minecraft.world.level.storage.loot.functions.CopyComponentsFunction; import net.minecraft.world.level.storage.loot.functions.SetItemCountFunction; import net.minecraft.world.level.storage.loot.providers.number.ConstantValue; -import net.minecraft.world.level.storage.loot.providers.number.UniformGenerator; import org.violetmoon.quark.content.automation.module.ChuteModule; import org.violetmoon.quark.content.building.module.*; import org.violetmoon.quark.content.tools.module.BottledCloudModule; diff --git a/src/main/java/org/violetmoon/quark/datagen/QuarkDatagen.java b/src/main/java/org/violetmoon/quark/datagen/QuarkDatagen.java index 4d8656d68f..a277838d8b 100644 --- a/src/main/java/org/violetmoon/quark/datagen/QuarkDatagen.java +++ b/src/main/java/org/violetmoon/quark/datagen/QuarkDatagen.java @@ -4,7 +4,6 @@ import net.minecraft.data.DataGenerator; import net.minecraft.data.PackOutput; import net.minecraft.data.loot.LootTableProvider; -import net.minecraft.world.level.storage.loot.parameters.LootContextParamSet; import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets; import net.neoforged.bus.api.SubscribeEvent; import net.neoforged.fml.common.EventBusSubscriber; diff --git a/src/main/java/org/violetmoon/quark/datagen/QuarkEntityLootTableProvider.java b/src/main/java/org/violetmoon/quark/datagen/QuarkEntityLootTableProvider.java index 2398caf125..f4345d3764 100644 --- a/src/main/java/org/violetmoon/quark/datagen/QuarkEntityLootTableProvider.java +++ b/src/main/java/org/violetmoon/quark/datagen/QuarkEntityLootTableProvider.java @@ -4,8 +4,6 @@ import net.minecraft.data.loot.EntityLootSubProvider; import net.minecraft.world.flag.FeatureFlags; -import java.util.Set; - public class QuarkEntityLootTableProvider extends EntityLootSubProvider { protected QuarkEntityLootTableProvider(HolderLookup.Provider registries) { diff --git a/src/main/java/org/violetmoon/quark/datagen/QuarkItemModelProvider.java b/src/main/java/org/violetmoon/quark/datagen/QuarkItemModelProvider.java index b15d1441d3..29446b45b3 100644 --- a/src/main/java/org/violetmoon/quark/datagen/QuarkItemModelProvider.java +++ b/src/main/java/org/violetmoon/quark/datagen/QuarkItemModelProvider.java @@ -4,7 +4,6 @@ import net.neoforged.neoforge.client.model.generators.ItemModelProvider; import net.neoforged.neoforge.common.data.ExistingFileHelper; import org.violetmoon.quark.base.Quark; -import org.violetmoon.quark.content.automation.module.ChuteModule; import org.violetmoon.quark.content.tools.module.AbacusModule; public class QuarkItemModelProvider extends ItemModelProvider { diff --git a/src/main/java/org/violetmoon/quark/datagen/builder/QuarkShapedRecipeBuilder.java b/src/main/java/org/violetmoon/quark/datagen/builder/QuarkShapedRecipeBuilder.java index 1dd7664a91..31409dffca 100644 --- a/src/main/java/org/violetmoon/quark/datagen/builder/QuarkShapedRecipeBuilder.java +++ b/src/main/java/org/violetmoon/quark/datagen/builder/QuarkShapedRecipeBuilder.java @@ -1,20 +1,14 @@ package org.violetmoon.quark.datagen.builder; -import net.minecraft.advancements.Advancement; -import net.minecraft.advancements.AdvancementRequirements; -import net.minecraft.advancements.AdvancementRewards; -import net.minecraft.advancements.critereon.RecipeUnlockedTrigger; import net.minecraft.data.recipes.RecipeBuilder; import net.minecraft.data.recipes.RecipeCategory; import net.minecraft.data.recipes.RecipeOutput; import net.minecraft.data.recipes.ShapedRecipeBuilder; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.crafting.ShapedRecipe; -import net.minecraft.world.item.crafting.ShapedRecipePattern; import net.minecraft.world.level.ItemLike; import javax.annotation.Nullable; -import java.util.Map; import java.util.Objects; public class QuarkShapedRecipeBuilder extends ShapedRecipeBuilder { diff --git a/src/main/java/org/violetmoon/quark/integration/jei/InfluenceEntry.java b/src/main/java/org/violetmoon/quark/integration/jei/InfluenceEntry.java index 77ca042453..30e26484a0 100644 --- a/src/main/java/org/violetmoon/quark/integration/jei/InfluenceEntry.java +++ b/src/main/java/org/violetmoon/quark/integration/jei/InfluenceEntry.java @@ -3,6 +3,7 @@ import mezz.jei.api.recipe.category.extensions.IRecipeCategoryExtension; import net.minecraft.ChatFormatting; import net.minecraft.core.NonNullList; +import net.minecraft.core.component.DataComponents; import net.minecraft.network.chat.Component; import net.minecraft.world.item.EnchantedBookItem; import net.minecraft.world.item.ItemStack; @@ -55,11 +56,11 @@ private static ItemStack getEnchantedBook(List enchantments, RuneCo for(Enchantment enchantment : enchantments) { if(!EnchantmentsBegoneModule.shouldBegone(enchantment)) { if(stack.isEmpty()) { - stack = ColorRunesModule.withRune(new ItemStack(Items.ENCHANTED_BOOK), runeColor) - .setHoverName(Component.translatable(locKey).withStyle(chatColor)); + stack = ColorRunesModule.withRune(new ItemStack(Items.ENCHANTED_BOOK), runeColor); + stack.set(DataComponents.CUSTOM_NAME, Component.translatable(locKey).withStyle(chatColor)); ItemNBTHelper.setBoolean(stack, EnchantedBookTooltips.TABLE_ONLY_DISPLAY, true); } - EnchantedBookItem.addEnchantment(stack, new EnchantmentInstance(enchantment, enchantment.getMaxLevel())); + EnchantedBookItem.createForEnchantment(stack, new EnchantmentInstance(enchantment, enchantment.getMaxLevel())); } } diff --git a/src/main/java/org/violetmoon/quark/integration/jei/QuarkJeiPlugin.java b/src/main/java/org/violetmoon/quark/integration/jei/QuarkJeiPlugin.java index 919b866947..9ce81011bf 100644 --- a/src/main/java/org/violetmoon/quark/integration/jei/QuarkJeiPlugin.java +++ b/src/main/java/org/violetmoon/quark/integration/jei/QuarkJeiPlugin.java @@ -58,8 +58,8 @@ public void registerItemSubtypes(@NotNull ISubtypeRegistration registration) { @Override public void registerVanillaCategoryExtensions(@NotNull IVanillaCategoryExtensionRegistration registration) { - registration.getCraftingCategory().addCategoryExtension(ElytraDuplicationRecipe.class, ElytraDuplicationExtension::new); - registration.getCraftingCategory().addCategoryExtension(SlabToBlockRecipe.class, SlabToBlockExtension::new); + registration.getCraftingCategory().addExtension(ElytraDuplicationRecipe.class, ElytraDuplicationExtension::new); + registration.getCraftingCategory().addExtension(SlabToBlockRecipe.class, SlabToBlockExtension::new); } private boolean matrix() { diff --git a/src/main/java/org/violetmoon/quark/integration/jei/SlabToBlockExtension.java b/src/main/java/org/violetmoon/quark/integration/jei/SlabToBlockExtension.java index 28f6d0a6ad..3e9b3904f7 100644 --- a/src/main/java/org/violetmoon/quark/integration/jei/SlabToBlockExtension.java +++ b/src/main/java/org/violetmoon/quark/integration/jei/SlabToBlockExtension.java @@ -5,15 +5,11 @@ import mezz.jei.api.gui.ingredient.ICraftingGridHelper; import mezz.jei.api.recipe.IFocusGroup; import mezz.jei.api.recipe.category.extensions.vanilla.crafting.ICraftingCategoryExtension; - -import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; - import net.minecraft.world.item.crafting.CraftingRecipe; +import net.minecraft.world.item.crafting.RecipeHolder; import org.apache.commons.compress.utils.Lists; -import org.jetbrains.annotations.NotNull; - import org.violetmoon.quark.content.tweaks.module.SlabsToBlocksModule; import org.violetmoon.quark.content.tweaks.recipe.SlabToBlockRecipe; @@ -21,10 +17,10 @@ import java.util.List; import java.util.Map.Entry; -public record SlabToBlockExtension(SlabToBlockRecipe recipe) implements ICraftingCategoryExtension { +public record SlabToBlockExtension(SlabToBlockRecipe recipe) implements ICraftingCategoryExtension { @Override - public void setRecipe(@NotNull IRecipeLayoutBuilder builder, @NotNull ICraftingGridHelper craftingGridHelper, @NotNull IFocusGroup focuses) { + public void setRecipe(RecipeHolder recipeHolder, IRecipeLayoutBuilder builder, ICraftingGridHelper craftingGridHelper, IFocusGroup focuses) { List input1 = Lists.newArrayList(); List input2 = Lists.newArrayList(); List outputs = Lists.newArrayList(); @@ -42,9 +38,4 @@ public void setRecipe(@NotNull IRecipeLayoutBuilder builder, @NotNull ICraftingG gridSlots.get(0), gridSlots.get(1), outSlot }); } - - @Override - public ResourceLocation getRegistryName() { - return recipe.getId(); - } } diff --git a/src/main/java/org/violetmoon/quark/integration/lootr/LootrVariantChestBlock.java b/src/main/java/org/violetmoon/quark/integration/lootr/LootrVariantChestBlock.java index fd6cd99fb8..f4620f683f 100644 --- a/src/main/java/org/violetmoon/quark/integration/lootr/LootrVariantChestBlock.java +++ b/src/main/java/org/violetmoon/quark/integration/lootr/LootrVariantChestBlock.java @@ -129,7 +129,7 @@ public int getAnalogOutputSignal(BlockState pBlockState, Level pLevel, BlockPos @Override @Nullable public BlockEntityTicker getTicker(Level pLevel, BlockState pState, BlockEntityType pBlockEntityType) { - return pLevel.isClientSide ? LootrChestBlockEntity::lootrLidAnimateTick : null; + return pLevel.isClientSide ? LootrChestBlockEntity::lidAnimateTick : null; } @Override diff --git a/src/main/java/org/violetmoon/quark/integration/lootr/LootrVariantChestBlockEntity.java b/src/main/java/org/violetmoon/quark/integration/lootr/LootrVariantChestBlockEntity.java index af44690415..a39784891b 100644 --- a/src/main/java/org/violetmoon/quark/integration/lootr/LootrVariantChestBlockEntity.java +++ b/src/main/java/org/violetmoon/quark/integration/lootr/LootrVariantChestBlockEntity.java @@ -3,7 +3,6 @@ import net.minecraft.core.BlockPos; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.phys.AABB; import noobanidus.mods.lootr.common.block.entity.LootrChestBlockEntity; import org.violetmoon.quark.base.Quark; @@ -20,9 +19,4 @@ public LootrVariantChestBlockEntity(BlockEntityType type, BlockPos pos, Block public LootrVariantChestBlockEntity(BlockPos pWorldPosition, BlockState pBlockState) { this(Quark.LOOTR_INTEGRATION.chestTE(), pWorldPosition, pBlockState); } - - @Override - public AABB getRenderBoundingBox() { - return new AABB(worldPosition.offset(-1, 0, -1), worldPosition.offset(2, 2, 2)); - } } diff --git a/src/main/java/org/violetmoon/quark/integration/lootr/LootrVariantTrappedChestBlock.java b/src/main/java/org/violetmoon/quark/integration/lootr/LootrVariantTrappedChestBlock.java index b80418070a..151c616579 100644 --- a/src/main/java/org/violetmoon/quark/integration/lootr/LootrVariantTrappedChestBlock.java +++ b/src/main/java/org/violetmoon/quark/integration/lootr/LootrVariantTrappedChestBlock.java @@ -22,19 +22,16 @@ import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.VoxelShape; - +import noobanidus.mods.lootr.common.block.entity.LootrChestBlockEntity; +import noobanidus.mods.lootr.config.ConfigManager; +import noobanidus.mods.lootr.util.ChestUtil; import org.jetbrains.annotations.Nullable; - import org.violetmoon.quark.content.building.block.VariantTrappedChestBlock; import org.violetmoon.zeta.module.ZetaModule; import org.violetmoon.zeta.registry.IZetaBlockItemProvider; import java.util.function.Supplier; -import noobanidus.mods.lootr.block.entities.LootrChestBlockEntity; -import noobanidus.mods.lootr.config.ConfigManager; -import noobanidus.mods.lootr.util.ChestUtil; - /** * Copy of * https://github.com/noobanidus/Lootr/blob/ded29b761ebf271f53a1b976cf859e0f4bfc8d60/src/main/java/noobanidus/mods/lootr/block/LootrVariantTrappedChestBlock.java diff --git a/src/main/java/org/violetmoon/quark/integration/lootr/client/LootrVariantChestRenderer.java b/src/main/java/org/violetmoon/quark/integration/lootr/client/LootrVariantChestRenderer.java index 690ab70ac5..06bf6b58ab 100644 --- a/src/main/java/org/violetmoon/quark/integration/lootr/client/LootrVariantChestRenderer.java +++ b/src/main/java/org/violetmoon/quark/integration/lootr/client/LootrVariantChestRenderer.java @@ -4,20 +4,17 @@ import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider; import net.minecraft.client.renderer.blockentity.ChestRenderer; import net.minecraft.client.resources.model.Material; -import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.player.Player; -import net.minecraft.world.inventory.InventoryMenu; import net.minecraft.world.level.block.state.properties.ChestType; - +import net.minecraft.world.phys.AABB; +import noobanidus.mods.lootr.common.client.ClientHooks; +import noobanidus.mods.lootr.neoforge.config.ConfigManager; import org.violetmoon.quark.base.Quark; import org.violetmoon.quark.content.building.module.VariantChestsModule; import org.violetmoon.quark.integration.lootr.LootrVariantChestBlockEntity; import java.util.UUID; -import noobanidus.mods.lootr.config.ConfigManager; -import noobanidus.mods.lootr.util.Getter; - public class LootrVariantChestRenderer extends ChestRenderer { private UUID playerIdCache = null; @@ -35,12 +32,12 @@ public Material getMaterial(T tile, ChestType type) { //lazy-init pattern if(playerIdCache == null) { - Player player = Getter.getPlayer(); + Player player = ClientHooks.getPlayer(); if(player != null) playerIdCache = player.getUUID(); } - boolean opened = tile.isOpened() || tile.getOpeners().contains(playerIdCache); + boolean opened = tile.isClientOpened() || (tile.getClientOpeners() != null && tile.getClientOpeners().contains(playerIdCache)); //apply the texture naming convention StringBuilder tex = new StringBuilder(v.getTextureFolder()) @@ -65,4 +62,9 @@ else if(opened) return new Material(Sheets.CHEST_SHEET, Quark.asResource(tex.toString())); } + + @Override + public AABB getRenderBoundingBox(T blockEntity) { + return new AABB(blockEntity.getBlockPos().offset(-1, 0, -1), blockEntity.getBlockPos().offset(2, 2, 2)); + } } diff --git a/src/main/java/org/violetmoon/quark/mixin/mixins/DamageEnchantmentMixin.java b/src/main/java/org/violetmoon/quark/mixin/mixins/DamageEnchantmentMixin.java deleted file mode 100644 index aca0e031e8..0000000000 --- a/src/main/java/org/violetmoon/quark/mixin/mixins/DamageEnchantmentMixin.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.violetmoon.quark.mixin.mixins; - -import com.llamalad7.mixinextras.injector.ModifyReturnValue; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.enchantment.DamageEnchantment; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.violetmoon.quark.content.tools.item.PickarangItem; - -@Mixin(DamageEnchantment.class) -public class DamageEnchantmentMixin { - - @ModifyReturnValue(method = "canEnchant", at = @At("RETURN")) - private boolean canEnchant(boolean prev, ItemStack stack) { - return prev || stack.getItem() instanceof PickarangItem; - } -} diff --git a/src/main/java/org/violetmoon/quark/mixin/mixins/EnchantmentMixin.java b/src/main/java/org/violetmoon/quark/mixin/mixins/EnchantmentMixin.java index 41abc78313..b1aa14ee7f 100644 --- a/src/main/java/org/violetmoon/quark/mixin/mixins/EnchantmentMixin.java +++ b/src/main/java/org/violetmoon/quark/mixin/mixins/EnchantmentMixin.java @@ -4,13 +4,11 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.enchantment.Enchantment; -import net.minecraft.world.item.enchantment.Enchantments; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.violetmoon.quark.content.experimental.module.EnchantmentsBegoneModule; -import org.violetmoon.quark.content.tools.item.PickarangItem; @Mixin(Enchantment.class) public class EnchantmentMixin { diff --git a/src/main/java/org/violetmoon/quark/mixin/mixins/HarvestFarmlandMixin.java b/src/main/java/org/violetmoon/quark/mixin/mixins/HarvestFarmlandMixin.java index 503263cdd6..66265f82f4 100644 --- a/src/main/java/org/violetmoon/quark/mixin/mixins/HarvestFarmlandMixin.java +++ b/src/main/java/org/violetmoon/quark/mixin/mixins/HarvestFarmlandMixin.java @@ -9,8 +9,6 @@ import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.ai.behavior.HarvestFarmland; import net.minecraft.world.entity.npc.Villager; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.level.block.state.BlockState; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; diff --git a/src/main/java/org/violetmoon/quark/mixin/mixins/IForgeItemMixin.java b/src/main/java/org/violetmoon/quark/mixin/mixins/IForgeItemMixin.java index 20237ac640..d8e23c643f 100644 --- a/src/main/java/org/violetmoon/quark/mixin/mixins/IForgeItemMixin.java +++ b/src/main/java/org/violetmoon/quark/mixin/mixins/IForgeItemMixin.java @@ -1,14 +1,12 @@ package org.violetmoon.quark.mixin.mixins; -import net.minecraftforge.common.extensions.IForgeItem; - +import net.neoforged.neoforge.common.extensions.IItemExtension; import org.spongepowered.asm.mixin.Mixin; - +import org.violetmoon.quark.mixin.delegates.ForgeItemDelegate; import org.violetmoon.zeta.mixin.plugin.DelegateInterfaceMixin; import org.violetmoon.zeta.mixin.plugin.DelegateReturnValueModifier; -import org.violetmoon.quark.mixin.delegates.ForgeItemDelegate; -@Mixin(IForgeItem.class) +@Mixin(IItemExtension.class) @DelegateInterfaceMixin( delegate = ForgeItemDelegate.class, methods = { @DelegateReturnValueModifier( diff --git a/src/main/java/org/violetmoon/quark/mixin/mixins/ItemStackMixin.java b/src/main/java/org/violetmoon/quark/mixin/mixins/ItemStackMixin.java index fc8ec3a4a0..16f601902e 100644 --- a/src/main/java/org/violetmoon/quark/mixin/mixins/ItemStackMixin.java +++ b/src/main/java/org/violetmoon/quark/mixin/mixins/ItemStackMixin.java @@ -1,19 +1,15 @@ package org.violetmoon.quark.mixin.mixins; -import com.google.common.collect.ImmutableMultimap; import com.google.common.collect.LinkedHashMultimap; import com.google.common.collect.Multimap; import com.llamalad7.mixinextras.injector.ModifyExpressionValue; -import com.llamalad7.mixinextras.injector.ModifyReceiver; import com.llamalad7.mixinextras.injector.ModifyReturnValue; -import com.llamalad7.mixinextras.sugar.Local; import com.llamalad7.mixinextras.sugar.Share; import com.llamalad7.mixinextras.sugar.ref.LocalBooleanRef; import com.mojang.datafixers.util.Pair; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.ListTag; import net.minecraft.network.chat.Component; -import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.ai.attributes.Attribute; import net.minecraft.world.entity.ai.attributes.AttributeModifier; import net.minecraft.world.entity.player.Player; @@ -28,7 +24,6 @@ import org.spongepowered.asm.mixin.injection.ModifyArg; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import org.violetmoon.quark.content.client.hax.PseudoAccessorItemStack; -import org.violetmoon.quark.content.client.module.ImprovedTooltipsModule; import org.violetmoon.quark.content.client.resources.AttributeSlot; import org.violetmoon.quark.content.tools.module.AncientTomesModule; import org.violetmoon.quark.content.tweaks.module.GoldToolsHaveFortuneModule; @@ -66,7 +61,7 @@ private boolean hasTagIfBaked(boolean hasTag, @Share("removedEnchantments") Loca } @Inject(method = "getTooltipLines", at = @At("RETURN")) - private void removeTagIfBaked(Player player, TooltipFlag flag, CallbackInfoReturnable> cir, @Share("removedEnchantments") LocalBooleanRef ref) { + private void removeTagIfBaked(Item.TooltipContext context, Player p_41652_, TooltipFlag p_41653_, CallbackInfoReturnable> cir, @Share("removedEnchantments") LocalBooleanRef ref) { ItemStack self = (ItemStack) (Object) this; if(ref.get()) self.setTag(null); @@ -101,10 +96,11 @@ private List appendEnchantmentNames(List components) { } @Inject(method = "getTooltipLines", at = @At("HEAD")) - private void clearCapturedTooltip(Player player, TooltipFlag flag, CallbackInfoReturnable> cir) { + private void clearCapturedTooltip(Item.TooltipContext context, Player player, TooltipFlag flag, CallbackInfoReturnable> cir) { capturedAttributes = new HashMap<>(); } + /* TODO: Find where this needs to go @ModifyReceiver(method = "getTooltipLines", at = @At(value = "INVOKE", target = "Lcom/google/common/collect/Multimap;isEmpty()Z", remap = false)) private Multimap overrideAttributeTooltips(Multimap attributes, @Local EquipmentSlot slot) { if(ImprovedTooltipsModule.shouldHideAttributes()) { @@ -113,4 +109,5 @@ private Multimap overrideAttributeTooltips(Multima } return attributes; } + */ } diff --git a/src/main/java/org/violetmoon/quark/mixin/mixins/LadderBlockMixin.java b/src/main/java/org/violetmoon/quark/mixin/mixins/LadderBlockMixin.java index 3bcabe5376..3d841892f3 100644 --- a/src/main/java/org/violetmoon/quark/mixin/mixins/LadderBlockMixin.java +++ b/src/main/java/org/violetmoon/quark/mixin/mixins/LadderBlockMixin.java @@ -1,16 +1,12 @@ package org.violetmoon.quark.mixin.mixins; -import com.llamalad7.mixinextras.injector.ModifyExpressionValue; import com.llamalad7.mixinextras.injector.ModifyReturnValue; -import com.llamalad7.mixinextras.injector.wrapoperation.Operation; -import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.server.level.ServerLevel; import net.minecraft.util.RandomSource; import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.LevelReader; -import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.LadderBlock; import net.minecraft.world.level.block.state.BlockState; diff --git a/src/main/java/org/violetmoon/quark/mixin/mixins/TemptGoalMixin.java b/src/main/java/org/violetmoon/quark/mixin/mixins/TemptGoalMixin.java index d39de5b788..87cf47fd11 100644 --- a/src/main/java/org/violetmoon/quark/mixin/mixins/TemptGoalMixin.java +++ b/src/main/java/org/violetmoon/quark/mixin/mixins/TemptGoalMixin.java @@ -9,10 +9,8 @@ import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import org.violetmoon.quark.content.automation.module.FeedingTroughModule; diff --git a/src/main/java/org/violetmoon/quark/mixin/mixins/TemptingSensorMixin.java b/src/main/java/org/violetmoon/quark/mixin/mixins/TemptingSensorMixin.java index 853b5b8f78..be572b4d98 100644 --- a/src/main/java/org/violetmoon/quark/mixin/mixins/TemptingSensorMixin.java +++ b/src/main/java/org/violetmoon/quark/mixin/mixins/TemptingSensorMixin.java @@ -9,7 +9,6 @@ import net.minecraft.world.entity.animal.Animal; import net.minecraft.world.entity.player.Player; import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; import org.violetmoon.quark.content.automation.module.FeedingTroughModule; diff --git a/src/main/java/org/violetmoon/quark/mixin/mixins/VillagerTradesMixin.java b/src/main/java/org/violetmoon/quark/mixin/mixins/VillagerTradesMixin.java index 912cd07855..5c3bdfc96f 100644 --- a/src/main/java/org/violetmoon/quark/mixin/mixins/VillagerTradesMixin.java +++ b/src/main/java/org/violetmoon/quark/mixin/mixins/VillagerTradesMixin.java @@ -5,7 +5,6 @@ import net.minecraft.world.entity.npc.VillagerTrades; import net.minecraft.world.entity.npc.VillagerType; import net.minecraft.world.item.Item; -import net.minecraft.world.item.Items; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.violetmoon.quark.content.tweaks.module.MoreVillagersModule; diff --git a/src/main/java/org/violetmoon/quark/mixin/mixins/accessor/AccessorBlockItem.java b/src/main/java/org/violetmoon/quark/mixin/mixins/accessor/AccessorBlockItem.java index b86fb00b8e..1bf585f1bc 100644 --- a/src/main/java/org/violetmoon/quark/mixin/mixins/accessor/AccessorBlockItem.java +++ b/src/main/java/org/violetmoon/quark/mixin/mixins/accessor/AccessorBlockItem.java @@ -1,8 +1,6 @@ package org.violetmoon.quark.mixin.mixins.accessor; -import net.minecraft.world.entity.projectile.AbstractArrow; import net.minecraft.world.item.BlockItem; -import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.level.block.state.BlockState; import org.spongepowered.asm.mixin.Mixin; diff --git a/src/main/java/org/violetmoon/quark/mixin/mixins/accessor/AccessorChunkAccess.java b/src/main/java/org/violetmoon/quark/mixin/mixins/accessor/AccessorChunkAccess.java index 9126a69215..8c92217308 100644 --- a/src/main/java/org/violetmoon/quark/mixin/mixins/accessor/AccessorChunkAccess.java +++ b/src/main/java/org/violetmoon/quark/mixin/mixins/accessor/AccessorChunkAccess.java @@ -1,11 +1,7 @@ package org.violetmoon.quark.mixin.mixins.accessor; -import com.mojang.datafixers.util.Either; -import net.minecraft.resources.ResourceLocation; import net.minecraft.world.level.LevelHeightAccessor; import net.minecraft.world.level.chunk.ChunkAccess; -import net.minecraft.world.level.levelgen.structure.pools.SinglePoolElement; -import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.gen.Accessor; diff --git a/src/main/java/org/violetmoon/quark/mixin/mixins/accessor/AccessorSinglePoolElement.java b/src/main/java/org/violetmoon/quark/mixin/mixins/accessor/AccessorSinglePoolElement.java index 273a5835ba..bc6a8a7d36 100644 --- a/src/main/java/org/violetmoon/quark/mixin/mixins/accessor/AccessorSinglePoolElement.java +++ b/src/main/java/org/violetmoon/quark/mixin/mixins/accessor/AccessorSinglePoolElement.java @@ -4,7 +4,6 @@ import net.minecraft.resources.ResourceLocation; import net.minecraft.world.level.levelgen.structure.pools.SinglePoolElement; import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate; -import org.checkerframework.checker.units.qual.A; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.gen.Accessor; diff --git a/src/main/java/org/violetmoon/quark/mixin/mixins/self/IZetaItemMixin_FAKE.java b/src/main/java/org/violetmoon/quark/mixin/mixins/self/IZetaItemMixin_FAKE.java index 224bb6dc14..8ec5a2a111 100644 --- a/src/main/java/org/violetmoon/quark/mixin/mixins/self/IZetaItemMixin_FAKE.java +++ b/src/main/java/org/violetmoon/quark/mixin/mixins/self/IZetaItemMixin_FAKE.java @@ -15,6 +15,8 @@ import net.minecraft.world.item.enchantment.Enchantment; import net.minecraft.world.item.enchantment.ItemEnchantments; import net.minecraft.world.level.LevelReader; +import net.neoforged.neoforge.common.ItemAbilities; +import net.neoforged.neoforge.common.ItemAbility; import net.neoforged.neoforge.common.extensions.IItemExtension; import org.jetbrains.annotations.Nullable; import org.spongepowered.asm.mixin.Mixin; @@ -73,11 +75,8 @@ public int getMaxDamage(ItemStack stack) { */ @Override - public boolean canPerformAction(ItemStack stack, ToolAction toolAction) { - if(toolAction == ToolActions.SHEARS_CARVE) - return canShearZeta(stack); - else - return false; + public boolean canPerformAction(ItemStack stack, ItemAbility itemAbility) { + return (itemAbility == ItemAbilities.SHEARS_CARVE); } @Override diff --git a/src/main/resources/META-INF/accesstransformer.cfg b/src/main/resources/META-INF/accesstransformer.cfg index 953e1b266d..27c0c5d9c0 100644 --- a/src/main/resources/META-INF/accesstransformer.cfg +++ b/src/main/resources/META-INF/accesstransformer.cfg @@ -18,13 +18,13 @@ public net.minecraft.world.entity.LivingEntity f_20922_ # ticksSinceLastSwing public net.minecraft.world.entity.ai.goal.TemptGoal items # items public net.minecraft.world.entity.ai.gossip.GossipContainer gossips # gossips public net.minecraft.world.entity.ai.gossip.GossipContainer$EntityGossips -public net.minecraft.world.entity.animal.horse.AbstractHorse m_30625_()V # initHorseChest +public net.minecraft.world.entity.animal.horse.AbstractHorse createInventory()V # createInventory public net.minecraft.world.entity.item.FallingBlockEntity blockState # blockState public net.minecraft.world.entity.monster.ZombieVillager gossips # gossips public-f net.minecraft.world.entity.player.Player f_36095_ #container public net.minecraft.world.entity.projectile.ThrownTrident m_7941_()Lnet/minecraft/world/item/ItemStack; # getArrowStack public-f net.minecraft.world.inventory.AbstractContainerMenu f_38840_ # windowId -public-f net.minecraft.world.inventory.Slot f_40221_ # yPos +public-f net.minecraft.world.inventory.Slot y # y public-f net.minecraft.world.item.Item f_41378_ # containerItem public net.minecraft.world.level.block.ButtonBlock m_51115_()I # tickRate public net.minecraft.world.level.block.DispenserBlock f_52661_ # DISPENSE_BEHAVIOR_REGISTRY diff --git a/src/main/resources/quark.mixins.json b/src/main/resources/quark.mixins.json index 0cef4bc307..1f3ada3af2 100644 --- a/src/main/resources/quark.mixins.json +++ b/src/main/resources/quark.mixins.json @@ -24,7 +24,6 @@ "ConcretePowderBlockMixin", "CreativeModeTabsMixin", "CrossbowMultishotMixin", - "DamageEnchantmentMixin", "DamageSourcesMixin", "DiggerItemMixin", "ElytraItemMixin",