Skip to content

Commit

Permalink
Initial port to 1.20.1. (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
Thelnfamous1 authored Sep 4, 2024
1 parent 2ac0ebc commit 3eeca9f
Show file tree
Hide file tree
Showing 11 changed files with 41 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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<CreativeModeTab> group) {
this(block, type, id, variant, new Item.Properties().arch$tab(group));
}

Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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<CreativeModeTab> group) {
this(block, placement, id, variant, new Item.Properties().arch$tab(group));
}

Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -32,11 +32,11 @@ public class ItemModEntityContainer<T extends Mob & IContainable> extends Item i
protected final EntityTypeContainerContainable<T, ItemModEntityContainer<T>> typeContainer;
protected final ITooltipFunction tooltip;

public ItemModEntityContainer(EntityTypeContainerContainable<T, ItemModEntityContainer<T>> typeContainer, CreativeTabRegistry.TabSupplier group) {
public ItemModEntityContainer(EntityTypeContainerContainable<T, ItemModEntityContainer<T>> typeContainer, DeferredSupplier<CreativeModeTab> group) {
this(typeContainer, IContainerItem.VARIANT_TOOLTIP, group);
}

public ItemModEntityContainer(EntityTypeContainerContainable<T, ItemModEntityContainer<T>> typeContainer, ITooltipFunction tooltip, CreativeTabRegistry.TabSupplier group) {
public ItemModEntityContainer(EntityTypeContainerContainable<T, ItemModEntityContainer<T>> typeContainer, ITooltipFunction tooltip, DeferredSupplier<CreativeModeTab> group) {
super(new Item.Properties().stacksTo(1).arch$tab(group));
this.typeContainer = typeContainer;
this.tooltip = tooltip;
Expand All @@ -56,7 +56,7 @@ public static <T extends Mob & IContainable> BiFunction<EntityTypeContainerConta
return (container, tooltip) -> new ItemModEntityContainer<>(container, tooltip, group);
}

public static <T extends Mob & IContainable> BiFunction<EntityTypeContainerContainable<T, ItemModEntityContainer<T>>, ITooltipFunction, ItemModEntityContainer<T>> get(CreativeTabRegistry.TabSupplier group) {
public static <T extends Mob & IContainable> BiFunction<EntityTypeContainerContainable<T, ItemModEntityContainer<T>>, ITooltipFunction, ItemModEntityContainer<T>> get(DeferredSupplier<CreativeModeTab> group) {
return (container, tooltip) -> new ItemModEntityContainer<>(container, tooltip, group);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -29,11 +29,11 @@ public class ItemModFishBucket<T extends Mob & IContainable> extends BucketItem
private final EntityTypeContainerContainable<T, ItemModFishBucket<T>> typeContainer;
private final ITooltipFunction tooltip;

public ItemModFishBucket(EntityTypeContainerContainable<T, ItemModFishBucket<T>> typeContainer, Supplier<? extends Fluid> fluid, CreativeTabRegistry.TabSupplier group) {
public ItemModFishBucket(EntityTypeContainerContainable<T, ItemModFishBucket<T>> typeContainer, Supplier<? extends Fluid> fluid, DeferredSupplier<CreativeModeTab> group) {
this(typeContainer, fluid, IContainerItem.VARIANT_TOOLTIP, group);
}

public ItemModFishBucket(EntityTypeContainerContainable<T, ItemModFishBucket<T>> typeContainer, Supplier<? extends Fluid> fluid, ITooltipFunction tooltip, CreativeTabRegistry.TabSupplier group) {
public ItemModFishBucket(EntityTypeContainerContainable<T, ItemModFishBucket<T>> typeContainer, Supplier<? extends Fluid> fluid, ITooltipFunction tooltip, DeferredSupplier<CreativeModeTab> group) {
super(fluid.get(), new Item.Properties().stacksTo(1).arch$tab(group));
this.typeContainer = typeContainer;
this.tooltip = tooltip;
Expand All @@ -49,7 +49,7 @@ public ItemModFishBucket(EntityTypeContainerContainable<T, ItemModFishBucket<T>>
this.tooltip = tooltip;
}

public static <T extends Mob & IContainable> BiFunction<EntityTypeContainerContainable<T, ItemModFishBucket<T>>, ITooltipFunction, ItemModFishBucket<T>> waterBucket(CreativeTabRegistry.TabSupplier group) {
public static <T extends Mob & IContainable> BiFunction<EntityTypeContainerContainable<T, ItemModFishBucket<T>>, ITooltipFunction, ItemModFishBucket<T>> waterBucket(DeferredSupplier<CreativeModeTab> group) {
return (container, tooltip) -> new ItemModFishBucket<>(container, () -> Fluids.WATER, tooltip, group);
}

Expand Down
12 changes: 6 additions & 6 deletions common/src/main/java/dev/itsmeow/imdlib/util/HeadType.java
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -57,7 +57,7 @@ public class HeadType {
private final Map<ResourceLocation, IVariant> reverseVariantMap = new HashMap<>();
private final Consumer<RegistrarManager> registerVariants;

public HeadType(String modid, CreativeModeTab group, CreativeTabRegistry.TabSupplier group_Supplied, String name, PlacementType placement, HeadIDMapping mapping, @Nullable Function<IVariant, String> variantMapper, @Nullable IVariant singletonVariant, @Nullable String singletonID, EntityTypeContainer<? extends LivingEntity> container) {
public HeadType(String modid, CreativeModeTab group, DeferredSupplier<CreativeModeTab> group_Supplied, String name, PlacementType placement, HeadIDMapping mapping, @Nullable Function<IVariant, String> variantMapper, @Nullable IVariant singletonVariant, @Nullable String singletonID, EntityTypeContainer<? extends LivingEntity> container) {
this.name = name;
this.modid = modid;
this.placement = placement;
Expand Down Expand Up @@ -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<CreativeModeTab> group_Supplied, String id) {
ResourceLocation rl = new ResourceLocation(this.getMod(), this.getName() + "_" + id);
RegistrySupplier<GenericSkullBlock> block = registries.get(Registries.BLOCK).register(rl, () -> new GenericSkullBlock(this, id));
RegistrySupplier<ItemBlockHeadType> item;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -259,7 +259,7 @@ public static class Builder<T extends Mob, C extends EntityTypeContainer<T>, B e
private IVariant singletonVariant;
private String singletonID;
private CreativeModeTab group;
private CreativeTabRegistry.TabSupplier group_Supplied;
private DeferredSupplier<CreativeModeTab> group_Supplied;

public Builder(B initial, String name) {
this.initial = initial;
Expand All @@ -273,7 +273,7 @@ public Builder<T, C, B> itemGroup(CreativeModeTab group) {
return this;
}

public Builder<T, C, B> itemGroup(CreativeTabRegistry.TabSupplier group) {
public Builder<T, C, B> itemGroup(DeferredSupplier<CreativeModeTab> group) {
this.group_Supplied = group;
return this;
}
Expand Down
8 changes: 4 additions & 4 deletions fabric/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id "com.github.johnrengelman.shadow" version "7.1.1"
id "com.github.johnrengelman.shadow" version "7.1.2"
}

architectury {
Expand Down Expand Up @@ -66,19 +66,19 @@ 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"
}

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}",
Expand Down
6 changes: 3 additions & 3 deletions forge/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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}",
Expand Down
18 changes: 9 additions & 9 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,26 @@
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
name = IMDLib
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
6 changes: 4 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 3eeca9f

Please sign in to comment.