From 3eeca9fb6b161ac6e5c6fbd3e27033c6d0558692 Mon Sep 17 00:00:00 2001 From: Miguel Enrique Garay <61263845+Thelnfamous1@users.noreply.github.com> Date: Tue, 3 Sep 2024 22:39:49 -0500 Subject: [PATCH] Initial port to 1.20.1. (#1) --- .../itsmeow/imdlib/block/AnimalSkullBlock.java | 4 ++-- .../imdlib/entity/interfaces/IBucketable.java | 2 +- .../itsmeow/imdlib/item/ItemBlockHeadType.java | 4 ++-- .../itsmeow/imdlib/item/ItemBlockSkull.java | 4 ++-- .../imdlib/item/ItemModEntityContainer.java | 8 ++++---- .../itsmeow/imdlib/item/ItemModFishBucket.java | 8 ++++---- .../java/dev/itsmeow/imdlib/util/HeadType.java | 12 ++++++------ fabric/build.gradle | 8 ++++---- forge/build.gradle | 6 +++--- gradle.properties | 18 +++++++++--------- gradle/wrapper/gradle-wrapper.properties | 6 ++++-- 11 files changed, 41 insertions(+), 39 deletions(-) diff --git a/common/src/main/java/dev/itsmeow/imdlib/block/AnimalSkullBlock.java b/common/src/main/java/dev/itsmeow/imdlib/block/AnimalSkullBlock.java index 60cb43d..723e1f3 100644 --- a/common/src/main/java/dev/itsmeow/imdlib/block/AnimalSkullBlock.java +++ b/common/src/main/java/dev/itsmeow/imdlib/block/AnimalSkullBlock.java @@ -13,7 +13,7 @@ import net.minecraft.world.level.block.state.properties.DirectionProperty; import net.minecraft.world.level.material.FluidState; import net.minecraft.world.level.material.Fluids; -import net.minecraft.world.level.material.Material; +import net.minecraft.world.level.material.MapColor; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.VoxelShape; @@ -31,7 +31,7 @@ public abstract class AnimalSkullBlock extends Block implements SimpleWaterlogge Direction.UP, Block.box(4.0D, 0.0D, 4.0D, 12.0D, 8.0D, 12.0D))); public AnimalSkullBlock() { - super(Block.Properties.of(Material.WOOL).sound(SoundType.STONE).strength(0.8F)); + super(Block.Properties.of().mapColor(MapColor.WOOL).sound(SoundType.STONE).strength(0.8F)); this.registerDefaultState(this.stateDefinition.any().setValue(FACING_EXCEPT_DOWN, Direction.NORTH).setValue(BlockStateProperties.WATERLOGGED, false).setValue(TOP_FACING, Direction.NORTH)); } diff --git a/common/src/main/java/dev/itsmeow/imdlib/entity/interfaces/IBucketable.java b/common/src/main/java/dev/itsmeow/imdlib/entity/interfaces/IBucketable.java index 8534bbd..1ca35e6 100644 --- a/common/src/main/java/dev/itsmeow/imdlib/entity/interfaces/IBucketable.java +++ b/common/src/main/java/dev/itsmeow/imdlib/entity/interfaces/IBucketable.java @@ -13,7 +13,7 @@ public interface IBucketable extends IContainable { @Override default void onPickupSuccess(Player player, InteractionHand hand, ItemStack stack) { this.getImplementation().playSound(SoundEvents.BUCKET_FILL_FISH, 1.0F, 1.0F); - if (!this.getImplementation().level.isClientSide) { + if (!this.getImplementation().level().isClientSide) { CriteriaTriggers.FILLED_BUCKET.trigger((ServerPlayer) player, stack); } } diff --git a/common/src/main/java/dev/itsmeow/imdlib/item/ItemBlockHeadType.java b/common/src/main/java/dev/itsmeow/imdlib/item/ItemBlockHeadType.java index c5d6f29..2fa756f 100644 --- a/common/src/main/java/dev/itsmeow/imdlib/item/ItemBlockHeadType.java +++ b/common/src/main/java/dev/itsmeow/imdlib/item/ItemBlockHeadType.java @@ -1,6 +1,6 @@ package dev.itsmeow.imdlib.item; -import dev.architectury.registry.CreativeTabRegistry; +import dev.architectury.registry.registries.DeferredSupplier; import dev.itsmeow.imdlib.entity.util.variant.IVariant; import dev.itsmeow.imdlib.util.HeadType; import net.minecraft.world.item.CreativeModeTab; @@ -12,7 +12,7 @@ public class ItemBlockHeadType extends ItemBlockSkull { private final HeadType type; - public ItemBlockHeadType(Block block, HeadType type, String id, IVariant variant, CreativeTabRegistry.TabSupplier group) { + public ItemBlockHeadType(Block block, HeadType type, String id, IVariant variant, DeferredSupplier group) { this(block, type, id, variant, new Item.Properties().arch$tab(group)); } diff --git a/common/src/main/java/dev/itsmeow/imdlib/item/ItemBlockSkull.java b/common/src/main/java/dev/itsmeow/imdlib/item/ItemBlockSkull.java index e6e1314..840d14f 100644 --- a/common/src/main/java/dev/itsmeow/imdlib/item/ItemBlockSkull.java +++ b/common/src/main/java/dev/itsmeow/imdlib/item/ItemBlockSkull.java @@ -1,6 +1,6 @@ package dev.itsmeow.imdlib.item; -import dev.architectury.registry.CreativeTabRegistry; +import dev.architectury.registry.registries.DeferredSupplier; import dev.itsmeow.imdlib.block.AnimalSkullBlock; import dev.itsmeow.imdlib.entity.util.variant.IVariant; import dev.itsmeow.imdlib.util.HeadType.PlacementType; @@ -28,7 +28,7 @@ public class ItemBlockSkull extends StandingAndWallBlockItem { public final String id; public final IVariant variant; - public ItemBlockSkull(Block block, PlacementType placement, String id, IVariant variant, CreativeTabRegistry.TabSupplier group) { + public ItemBlockSkull(Block block, PlacementType placement, String id, IVariant variant, DeferredSupplier group) { this(block, placement, id, variant, new Item.Properties().arch$tab(group)); } diff --git a/common/src/main/java/dev/itsmeow/imdlib/item/ItemModEntityContainer.java b/common/src/main/java/dev/itsmeow/imdlib/item/ItemModEntityContainer.java index 10ae04e..5783b7e 100644 --- a/common/src/main/java/dev/itsmeow/imdlib/item/ItemModEntityContainer.java +++ b/common/src/main/java/dev/itsmeow/imdlib/item/ItemModEntityContainer.java @@ -1,6 +1,6 @@ package dev.itsmeow.imdlib.item; -import dev.architectury.registry.CreativeTabRegistry; +import dev.architectury.registry.registries.DeferredSupplier; import dev.itsmeow.imdlib.entity.EntityTypeContainer; import dev.itsmeow.imdlib.entity.interfaces.IContainable; import dev.itsmeow.imdlib.entity.util.EntityTypeContainerContainable; @@ -32,11 +32,11 @@ public class ItemModEntityContainer extends Item i protected final EntityTypeContainerContainable> typeContainer; protected final ITooltipFunction tooltip; - public ItemModEntityContainer(EntityTypeContainerContainable> typeContainer, CreativeTabRegistry.TabSupplier group) { + public ItemModEntityContainer(EntityTypeContainerContainable> typeContainer, DeferredSupplier group) { this(typeContainer, IContainerItem.VARIANT_TOOLTIP, group); } - public ItemModEntityContainer(EntityTypeContainerContainable> typeContainer, ITooltipFunction tooltip, CreativeTabRegistry.TabSupplier group) { + public ItemModEntityContainer(EntityTypeContainerContainable> typeContainer, ITooltipFunction tooltip, DeferredSupplier group) { super(new Item.Properties().stacksTo(1).arch$tab(group)); this.typeContainer = typeContainer; this.tooltip = tooltip; @@ -56,7 +56,7 @@ public static BiFunction new ItemModEntityContainer<>(container, tooltip, group); } - public static BiFunction>, ITooltipFunction, ItemModEntityContainer> get(CreativeTabRegistry.TabSupplier group) { + public static BiFunction>, ITooltipFunction, ItemModEntityContainer> get(DeferredSupplier group) { return (container, tooltip) -> new ItemModEntityContainer<>(container, tooltip, group); } diff --git a/common/src/main/java/dev/itsmeow/imdlib/item/ItemModFishBucket.java b/common/src/main/java/dev/itsmeow/imdlib/item/ItemModFishBucket.java index d985416..4e5cf07 100644 --- a/common/src/main/java/dev/itsmeow/imdlib/item/ItemModFishBucket.java +++ b/common/src/main/java/dev/itsmeow/imdlib/item/ItemModFishBucket.java @@ -1,7 +1,7 @@ package dev.itsmeow.imdlib.item; -import dev.architectury.registry.CreativeTabRegistry; +import dev.architectury.registry.registries.DeferredSupplier; import dev.itsmeow.imdlib.entity.EntityTypeContainer; import dev.itsmeow.imdlib.entity.interfaces.IContainable; import dev.itsmeow.imdlib.entity.util.EntityTypeContainerContainable; @@ -29,11 +29,11 @@ public class ItemModFishBucket extends BucketItem private final EntityTypeContainerContainable> typeContainer; private final ITooltipFunction tooltip; - public ItemModFishBucket(EntityTypeContainerContainable> typeContainer, Supplier fluid, CreativeTabRegistry.TabSupplier group) { + public ItemModFishBucket(EntityTypeContainerContainable> typeContainer, Supplier fluid, DeferredSupplier group) { this(typeContainer, fluid, IContainerItem.VARIANT_TOOLTIP, group); } - public ItemModFishBucket(EntityTypeContainerContainable> typeContainer, Supplier fluid, ITooltipFunction tooltip, CreativeTabRegistry.TabSupplier group) { + public ItemModFishBucket(EntityTypeContainerContainable> typeContainer, Supplier fluid, ITooltipFunction tooltip, DeferredSupplier group) { super(fluid.get(), new Item.Properties().stacksTo(1).arch$tab(group)); this.typeContainer = typeContainer; this.tooltip = tooltip; @@ -49,7 +49,7 @@ public ItemModFishBucket(EntityTypeContainerContainable> this.tooltip = tooltip; } - public static BiFunction>, ITooltipFunction, ItemModFishBucket> waterBucket(CreativeTabRegistry.TabSupplier group) { + public static BiFunction>, ITooltipFunction, ItemModFishBucket> waterBucket(DeferredSupplier group) { return (container, tooltip) -> new ItemModFishBucket<>(container, () -> Fluids.WATER, tooltip, group); } diff --git a/common/src/main/java/dev/itsmeow/imdlib/util/HeadType.java b/common/src/main/java/dev/itsmeow/imdlib/util/HeadType.java index b93258b..43bae3d 100644 --- a/common/src/main/java/dev/itsmeow/imdlib/util/HeadType.java +++ b/common/src/main/java/dev/itsmeow/imdlib/util/HeadType.java @@ -1,7 +1,7 @@ package dev.itsmeow.imdlib.util; import dev.architectury.platform.Platform; -import dev.architectury.registry.CreativeTabRegistry; +import dev.architectury.registry.registries.DeferredSupplier; import dev.architectury.registry.registries.RegistrarManager; import dev.architectury.registry.registries.RegistrySupplier; import dev.itsmeow.imdlib.IMDLib; @@ -57,7 +57,7 @@ public class HeadType { private final Map reverseVariantMap = new HashMap<>(); private final Consumer registerVariants; - public HeadType(String modid, CreativeModeTab group, CreativeTabRegistry.TabSupplier group_Supplied, String name, PlacementType placement, HeadIDMapping mapping, @Nullable Function variantMapper, @Nullable IVariant singletonVariant, @Nullable String singletonID, EntityTypeContainer container) { + public HeadType(String modid, CreativeModeTab group, DeferredSupplier group_Supplied, String name, PlacementType placement, HeadIDMapping mapping, @Nullable Function variantMapper, @Nullable IVariant singletonVariant, @Nullable String singletonID, EntityTypeContainer container) { this.name = name; this.modid = modid; this.placement = placement; @@ -104,7 +104,7 @@ public void register(RegistrarManager registries) { registerVariants.accept(registries); } - protected void setupVariant(RegistrarManager registries, IVariant variant, CreativeModeTab group, CreativeTabRegistry.TabSupplier group_Supplied, String id) { + protected void setupVariant(RegistrarManager registries, IVariant variant, CreativeModeTab group, DeferredSupplier group_Supplied, String id) { ResourceLocation rl = new ResourceLocation(this.getMod(), this.getName() + "_" + id); RegistrySupplier block = registries.get(Registries.BLOCK).register(rl, () -> new GenericSkullBlock(this, id)); RegistrySupplier item; @@ -213,7 +213,7 @@ public void drop(Mob entity, int chance) { } public void drop(Mob entity, int chance, IVariant variant) { - if (variant != null && !entity.level.isClientSide && !entity.isBaby()) { + if (variant != null && !entity.level().isClientSide && !entity.isBaby()) { if (entity.getRandom().nextInt(chance) == 0) { ItemStack stack = new ItemStack(this.getItemForVariant(variant).get()); entity.spawnAtLocation(stack, 0.5F); @@ -259,7 +259,7 @@ public static class Builder, B e private IVariant singletonVariant; private String singletonID; private CreativeModeTab group; - private CreativeTabRegistry.TabSupplier group_Supplied; + private DeferredSupplier group_Supplied; public Builder(B initial, String name) { this.initial = initial; @@ -273,7 +273,7 @@ public Builder itemGroup(CreativeModeTab group) { return this; } - public Builder itemGroup(CreativeTabRegistry.TabSupplier group) { + public Builder itemGroup(DeferredSupplier group) { this.group_Supplied = group; return this; } diff --git a/fabric/build.gradle b/fabric/build.gradle index 4a2428b..2a44b51 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -1,5 +1,5 @@ plugins { - id "com.github.johnrengelman.shadow" version "7.1.1" + id "com.github.johnrengelman.shadow" version "7.1.2" } architectury { @@ -66,7 +66,7 @@ processResources { shadowJar { configurations = [project.configurations.shadowCommon, project.configurations.shadowImplementation, project.configurations.shadowModApi] - classifier "dev-shadow" + archiveClassifier = "dev-shadow" relocate "io.fablabsmc.fablabs", "dev.itsmeow.imdlib.shadow.fablabs" relocate "me.shedaniel.fiber2cloth", "dev.itsmeow.imdlib.shadow.fiber2cloth" } @@ -74,11 +74,11 @@ shadowJar { remapJar { input.set shadowJar.archiveFile dependsOn shadowJar - classifier "fabric" + archiveClassifier = "fabric" } jar { - classifier "dev" + archiveClassifier = "dev" manifest { attributes( "Maven-Artifact": "${rootProject.maven_group}:${rootProject.mod_id}-${project.name}:${rootProject.version}", diff --git a/forge/build.gradle b/forge/build.gradle index d53df1a..85e6021 100644 --- a/forge/build.gradle +++ b/forge/build.gradle @@ -24,17 +24,17 @@ dependencies { shadowJar { configurations = [project.configurations.shadowCommon] - classifier "dev-shadow" + archiveClassifier = "dev-shadow" } remapJar { input.set shadowJar.archiveFile dependsOn shadowJar - classifier "forge" + archiveClassifier = "forge" } jar { - classifier "dev" + archiveClassifier = "dev" manifest { attributes( "Maven-Artifact": "${rootProject.maven_group}:${rootProject.mod_id}-${project.name}:${rootProject.version}", diff --git a/gradle.properties b/gradle.properties index 248ac61..922ae0f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,11 +3,11 @@ maven_group = dev.itsmeow.imdlib # API Versions - mc_version = 1.19.3 - forge_version = 44.0.37 - architectury_version = 7.0.66 - fabric_loader_version = 0.14.12 - fabric_api_version = 0.69.1+1.19.3 + mc_version = 1.20.1 + forge_version = 47.2.30 + architectury_version = 9.2.14 + fabric_loader_version = 0.15.10 + fabric_api_version = 0.92.1+1.20.1 # Publishing github = itsmeow/IMDLib @@ -15,14 +15,14 @@ url = https://github.com/itsmeow/IMDLib # Toolchain Versions - loom_version = 0.12.0-SNAPSHOT + loom_version = 1.7-SNAPSHOT architectury_plugin_version = 3.4-SNAPSHOT # Misc org.gradle.jvmargs=-Xmx6G org.gradle.daemon=true fiber_version=0.23.0-SNAPSHOT - # 9.0.94 - cloth_config_version=4147099 + # 11.1.118 + cloth_config_version=4973440 fiber2cloth_version=3.3.0 - modmenu_version=5.0.2 + modmenu_version=7.2.2 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 2e6e589..dab2a01 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip +networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists +zipStorePath=wrapper/dists \ No newline at end of file