Skip to content

Commit

Permalink
Update to 1.21
Browse files Browse the repository at this point in the history
  • Loading branch information
Choonster committed Jun 15, 2024
1 parent b30c371 commit a17718b
Show file tree
Hide file tree
Showing 73 changed files with 490 additions and 440 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ dependencies {

implementation fg.deobf("curse.maven:jade-324717:${jade_file_id}")

implementation "com.github.glitchfiend:TerraBlender-forge:1.20.6-${terrablender_version}"
implementation "com.github.glitchfiend:TerraBlender-forge:1.21-${terrablender_version}"

// Example mod dependency using a mod jar from ./libs with a flat dir repository
// This maps to ./libs/coolmod-${mc_version}-${coolmod_version}.jar
Expand All @@ -190,7 +190,7 @@ dependencies {
// http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
// http://www.gradle.org/docs/current/userguide/dependency_management.html

// Hack fix for now, force jopt-simple to be exactly 5.0.4 because Mojang ships that version, but some transtive dependencies request 6.0+
// Hack fix for now, force jopt-simple to be exactly 5.0.4 because Mojang ships that version, but some transitive dependencies request 6.0+
implementation('net.sf.jopt-simple:jopt-simple:5.0.4') { version { strictly '5.0.4' } }
}

Expand Down
12 changes: 6 additions & 6 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ org.gradle.daemon=false
## Environment Properties

# The Minecraft version must agree with the Forge version to get a valid artifact
minecraft_version=1.20.6
minecraft_version=1.21

# The Minecraft version range can use any release version of Minecraft as bounds.
# Snapshots, pre-releases, and release candidates are not guaranteed to sort properly
# as they do not follow standard versioning conventions.
minecraft_version_range=[1.20.6,1.21)
minecraft_version_range=[1.21,1.22)

# The Forge version must agree with the Minecraft version to get a valid artifact
forge_version=50.0.13
forge_version=51.0.5

# The Forge version range can use any version of Forge as bounds or match the loader version range
forge_version_range=[0,)
Expand All @@ -40,14 +40,14 @@ mapping_channel=official

# The mapping version to query from the mapping channel.
# This must match the format required by the mapping channel.
mapping_version=1.20.6
mapping_version=1.21

jei_version=17.3.0.49

# 1.20.4-forge-13.2.1
jade_file_id=4978952

terrablender_version=3.5.0.3
terrablender_version=4.0.0.0

# Minecraft uses Apache HTTP Client 4.5.13, so we have to use the same version of the Fluent API
httpclient_version=4.5.13
Expand All @@ -65,7 +65,7 @@ mod_name=TestMod3
mod_license=MIT

# The mod version. See https://semver.org/
mod_version=19.0.0
mod_version=20.0.0

# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
# This should match the base package used for the mod sources.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

import com.google.common.base.Preconditions;
import net.minecraft.core.Direction;
import net.minecraft.core.HolderLookup;
import net.minecraft.nbt.Tag;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.capabilities.ICapabilityProvider;
import net.minecraftforge.common.util.INBTSerializable;

import org.jetbrains.annotations.Nullable;

/**
Expand Down Expand Up @@ -36,13 +36,12 @@ public SerializableCapabilityProvider(final Capability<HANDLER> capability, @Nul
}

@Override
public Tag serializeNBT() {
return serializableInstance.serializeNBT();
public Tag serializeNBT(final HolderLookup.Provider registries) {
return serializableInstance.serializeNBT(registries);
}

@Override
public void deserializeNBT(final Tag tag) {
serializableInstance.deserializeNBT(tag);
public void deserializeNBT(final HolderLookup.Provider registries, final Tag tag) {
serializableInstance.deserializeNBT(registries, tag);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public class ChunkEnergyCapability {
/**
* The ID of this capability.
*/
public static final ResourceLocation ID = new ResourceLocation(TestMod3.MODID, "chunk_energy");
public static final ResourceLocation ID = ResourceLocation.fromNamespaceAndPath(TestMod3.MODID, "chunk_energy");

public static void register(final RegisterCapabilitiesEvent event) {
event.register(IChunkEnergy.class);
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/choonster/testmod3/capability/lock/Lock.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package choonster.testmod3.capability.lock;

import choonster.testmod3.api.capability.lock.ILock;
import net.minecraft.core.HolderLookup;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component;
import net.minecraft.world.LockCode;
Expand Down Expand Up @@ -45,7 +46,7 @@ public void setLockCode(final LockCode code) {
}

@Override
public CompoundTag serializeNBT() {
public CompoundTag serializeNBT(final HolderLookup.Provider registries) {
final CompoundTag tagCompound = new CompoundTag();

code.addToTag(tagCompound);
Expand All @@ -54,7 +55,7 @@ public CompoundTag serializeNBT() {
}

@Override
public void deserializeNBT(final CompoundTag nbt) {
public void deserializeNBT(final HolderLookup.Provider registries, final CompoundTag nbt) {
code = LockCode.fromTag(nbt);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public final class LockCapability {
/**
* The ID of this capability.
*/
public static final ResourceLocation ID = new ResourceLocation(TestMod3.MODID, "lock");
public static final ResourceLocation ID = ResourceLocation.fromNamespaceAndPath(TestMod3.MODID, "lock");

public static void register(final RegisterCapabilitiesEvent event) {
event.register(ILock.class);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
package choonster.testmod3.capability.maxhealth;

import choonster.testmod3.TestMod3;
import choonster.testmod3.api.capability.maxhealth.IMaxHealth;
import com.mojang.logging.LogUtils;
import net.minecraft.core.HolderLookup;
import net.minecraft.nbt.FloatTag;
import net.minecraft.network.protocol.game.ClientboundUpdateAttributesPacket;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.ai.attributes.AttributeModifier;
Expand All @@ -14,7 +17,6 @@

import java.util.Collections;
import java.util.Objects;
import java.util.UUID;

/**
* Default implementation of {@link IMaxHealth}.
Expand All @@ -27,12 +29,7 @@ public class MaxHealth implements IMaxHealth, INBTSerializable<FloatTag> {
/**
* The ID of the {@link AttributeModifier}.
*/
protected static final UUID MODIFIER_ID = UUID.fromString("d5d0d878-b3c2-469b-ba89-ac01c0635a9c");

/**
* The name of the {@link AttributeModifier}.
*/
protected static final String MODIFIER_NAME = "Bonus Max Health";
protected static final ResourceLocation MODIFIER_ID = ResourceLocation.fromNamespaceAndPath(TestMod3.MODID, "bonus_max_health");

/**
* The entity this is attached to.
Expand Down Expand Up @@ -95,12 +92,12 @@ public void synchronise() {
}

@Override
public FloatTag serializeNBT() {
public FloatTag serializeNBT(final HolderLookup.Provider registries) {
return FloatTag.valueOf(bonusMaxHealth);
}

@Override
public void deserializeNBT(final FloatTag tag) {
public void deserializeNBT(final HolderLookup.Provider registries, final FloatTag tag) {
bonusMaxHealth = tag.getAsFloat();
}

Expand All @@ -110,7 +107,7 @@ public void deserializeNBT(final FloatTag tag) {
* @return The AttributeModifier
*/
protected AttributeModifier createModifier() {
return new AttributeModifier(MODIFIER_ID, MODIFIER_NAME, getBonusMaxHealth(), AttributeModifier.Operation.ADD_VALUE);
return new AttributeModifier(MODIFIER_ID, getBonusMaxHealth(), AttributeModifier.Operation.ADD_VALUE);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public final class MaxHealthCapability {
/**
* The ID of this capability.
*/
public static final ResourceLocation ID = new ResourceLocation(TestMod3.MODID, "max_health");
public static final ResourceLocation ID = ResourceLocation.fromNamespaceAndPath(TestMod3.MODID, "max_health");

public static final Marker LOG_MARKER = ModLogUtils.getMarker("MaxHealth");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList;
import com.mojang.logging.LogUtils;
import net.minecraft.core.HolderLookup;
import net.minecraft.nbt.IntTag;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent;
import net.minecraft.world.level.Level;
import net.minecraftforge.common.util.INBTSerializable;
import org.jetbrains.annotations.Nullable;
import org.slf4j.Logger;

import org.jetbrains.annotations.Nullable;
import java.util.List;

/**
Expand Down Expand Up @@ -72,12 +73,12 @@ public List<MutableComponent> getTooltipLines() {
}

@Override
public IntTag serializeNBT() {
public IntTag serializeNBT(final HolderLookup.Provider registries) {
return IntTag.valueOf(numPigs);
}

@Override
public void deserializeNBT(final IntTag tag) {
public void deserializeNBT(final HolderLookup.Provider registries, final IntTag tag) {
numPigs = tag.getAsInt();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import choonster.testmod3.text.TestMod3Lang;
import com.google.common.collect.ImmutableList;
import net.minecraft.core.HolderLookup;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent;
Expand All @@ -28,13 +29,13 @@ public List<MutableComponent> getTooltipLines() {
}

@Override
public CompoundTag serializeNBT() {
public CompoundTag serializeNBT(final HolderLookup.Provider registries) {
// No-op
return new CompoundTag();
}

@Override
public void deserializeNBT(final CompoundTag nbt) {
public void deserializeNBT(final HolderLookup.Provider registries, final CompoundTag nbt) {
// No-op
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public final class PigSpawnerCapability {
/**
* The ID of the capability.
*/
public static final ResourceLocation ID = new ResourceLocation(TestMod3.MODID, "pig_spawner");
public static final ResourceLocation ID = ResourceLocation.fromNamespaceAndPath(TestMod3.MODID, "pig_spawner");

public static final Marker LOG_MARKER = ModLogUtils.getMarker("PIG_SPAWNER");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import choonster.testmod3.init.ModItems;
import choonster.testmod3.text.TestMod3Lang;
import choonster.testmod3.util.CapabilityNotPresentException;
import net.minecraft.client.DeltaTracker;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.LayeredDraw;
Expand All @@ -23,7 +24,7 @@ public ChunkEnergyGuiOverlay(final Minecraft minecraft) {
}

@Override
public void render(final GuiGraphics guiGraphics, final float partialTick) {
public void render(final GuiGraphics guiGraphics, final DeltaTracker timer) {
if (minecraft.level == null || minecraft.player == null) {
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class ModChestScreen extends AbstractContainerScreen<ModChestMenu> {
/**
* The ResourceLocation containing the chest GUI texture.
*/
private static final ResourceLocation CHEST_GUI_TEXTURE = new ResourceLocation("minecraft", "textures/gui/container/generic_54.png");
private static final ResourceLocation CHEST_GUI_TEXTURE = ResourceLocation.withDefaultNamespace("textures/gui/container/generic_54.png");

/**
* The number of rows in the chest inventory, used to calculate the window height.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class RevealHiddenBlocksItemPropertyFunction {
/**
* The ID of this function.
*/
public static final ResourceLocation ID = new ResourceLocation(TestMod3.MODID, "reveal_hidden_blocks");
public static final ResourceLocation ID = ResourceLocation.fromNamespaceAndPath(TestMod3.MODID, "reveal_hidden_blocks");

/**
* The function.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class TicksSinceLastUseItemPropertyFunction {
/**
* The ID of this function.
*/
public static final ResourceLocation ID = new ResourceLocation(TestMod3.MODID, "ticks_since_last_use");
public static final ResourceLocation ID = ResourceLocation.fromNamespaceAndPath(TestMod3.MODID, "ticks_since_last_use");

/**
* The function.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
public class ModRenderers {
@SubscribeEvent
public static void register(final EntityRenderersEvent.RegisterRenderers event) {
event.registerEntityRenderer(ModEntities.MOD_ARROW.get(), context -> new RenderModArrow(context, new ResourceLocation(TestMod3.MODID, "textures/entity/arrow.png")));
event.registerEntityRenderer(ModEntities.BLOCK_DETECTION_ARROW.get(), renderManager -> new RenderModArrow(renderManager, new ResourceLocation(TestMod3.MODID, "textures/entity/block_detection_arrow.png")));
event.registerEntityRenderer(ModEntities.MOD_ARROW.get(), context -> new RenderModArrow(context, ResourceLocation.fromNamespaceAndPath(TestMod3.MODID, "textures/entity/arrow.png")));
event.registerEntityRenderer(ModEntities.BLOCK_DETECTION_ARROW.get(), renderManager -> new RenderModArrow(renderManager, ResourceLocation.fromNamespaceAndPath(TestMod3.MODID, "textures/entity/block_detection_arrow.png")));
event.registerEntityRenderer(ModEntities.PLAYER_AVOIDING_CREEPER.get(), CreeperRenderer::new);
}
}
2 changes: 1 addition & 1 deletion src/main/java/choonster/testmod3/compat/HudProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public enum HudProvider {

HudProvider(final String name) {
this.name = name;
id = new ResourceLocation(TestMod3.MODID, name);
id = ResourceLocation.fromNamespaceAndPath(TestMod3.MODID, name);
}

public String getName() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public class TestMod3BlockStateProvider extends BlockStateProvider {
private static final Logger LOGGER = LogUtils.getLogger();

private static final int DEFAULT_ANGLE_OFFSET = 180;
private static final ResourceLocation RENDER_TYPE_CUTOUT = new ResourceLocation("cutout");
private static final ResourceLocation RENDER_TYPE_CUTOUT = ResourceLocation.withDefaultNamespace("cutout");

private final List<String> errors = new ArrayList<>();

Expand Down Expand Up @@ -599,7 +599,7 @@ private ModelFile existingModel(final Item item) {
* @return The model
*/
private ModelFile existingMcModel(final String name) {
return models().getExistingFile(new ResourceLocation("minecraft", name));
return models().getExistingFile(ResourceLocation.withDefaultNamespace(name));
}

private void simpleBlockItem(final Block block) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ protected void registerModels() {

withExistingParent(ModItems.ENTITY_TEST.get(), Items.PORKCHOP);

withExistingParent(ModItems.RECORD_SOLARIS.get(), Items.MUSIC_DISC_13);
withExistingParent(ModItems.MUSIC_DISC_SOLARIS.get(), Items.MUSIC_DISC_13);

withExistingParent(ModItems.HEAVY.get(), Items.BRICK);

Expand Down Expand Up @@ -281,7 +281,7 @@ private String name(final Item item) {

private ResourceLocation itemTexture(final Item item) {
final var name = key(item);
return new ResourceLocation(name.getNamespace(), ITEM_FOLDER + "/" + name.getPath());
return ResourceLocation.fromNamespaceAndPath(name.getNamespace(), ITEM_FOLDER + "/" + name.getPath());
}

private ItemModelBuilder withExistingParent(final Item item, final Item modelItem) {
Expand Down Expand Up @@ -357,7 +357,7 @@ private void bucketItem(final FluidGroup<?, ?, ?, ?, ?> fluidGroup) {
final var fluid = item instanceof BucketItem ? ((BucketItem) item).getFluid() : Fluids.EMPTY;

getBuilder(name(item))
.parent(getExistingFile(new ResourceLocation("forge", "bucket")))
.parent(getExistingFile(ResourceLocation.fromNamespaceAndPath("forge", "bucket")))
.customLoader(DynamicFluidContainerModelBuilder::begin)
.fluid(fluid)
.flipGas(true)
Expand All @@ -368,7 +368,7 @@ private void bucketItem(final Item item) {
final var baseTexture = itemTexture(item) + "_base";

getBuilder(name(item))
.parent(getExistingFile(new ResourceLocation("forge", "bucket")))
.parent(getExistingFile(ResourceLocation.fromNamespaceAndPath("forge", "bucket")))
.texture("base", baseTexture)
.texture("particle", baseTexture)
.customLoader(DynamicFluidContainerModelBuilder::begin)
Expand Down
Loading

0 comments on commit a17718b

Please sign in to comment.