Skip to content

Commit

Permalink
Update Forge to 1.17.1 RB
Browse files Browse the repository at this point in the history
- Update Forge to 37.1.0, Parchment to 2021.10.31
- Update mods.toml to lock this release to Forge 37.x since
  38.x contains refactoring that will break this mod in 1.18
- Update constant value locations to remove deprecated references.
- Fully qualify `net.minecraft.tags.Tag` in javadocs to prevent
  collision with `net.minecraft.nbt.Tag`. Thanks Mojang for identically
  naming two separate classes that could so easily collide.
- Remove redundant finals from a couple of declarations.

Signed-off-by: srs-bsns <[email protected]>
  • Loading branch information
srs-bsns committed Dec 1, 2021
1 parent 56073c1 commit cb8c9e6
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 15 deletions.
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
vendor = srsCode

mc_version = 1.17.1
forge_version = 37.0.59
parchment_version = 2021.08.29-1.17.1
forge_version = 37.1.0
parchment_version = 2021.10.31-1.17.1
mixinAP_version = 0.8.4
17 changes: 8 additions & 9 deletions src/main/java/srscode/fallthru/BlockConfigMap.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,13 @@

import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.ListTag;
import net.minecraft.nbt.Tag;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.Tag;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.material.Material;

import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.common.util.Constants;
import net.minecraftforge.fml.DistExecutor;
import net.minecraftforge.registries.ForgeRegistries;

Expand Down Expand Up @@ -201,7 +200,7 @@ void fromNBT(final CompoundTag blocklist)
{
addAll(
blocklist
.getList(NBT_CONFIG_TAG, Constants.NBT.TAG_COMPOUND)
.getList(NBT_CONFIG_TAG, Tag.TAG_COMPOUND)
.stream()
.map(CompoundTag.class::cast)
.map(BlockConfig::fromNBT)
Expand Down Expand Up @@ -307,7 +306,7 @@ private static int getHash(@Nonnull final Block block)
* A class to store the configuration of passable blocks.
* With the exception of the {@link Block} referenced, all of the class members are immutable.
*/
public final record BlockConfig(@Nonnull Block block, double speedMult, double damageMult, boolean allowNative, boolean hasCollision, boolean canOcclude)
public record BlockConfig(@Nonnull Block block, double speedMult, double damageMult, boolean allowNative, boolean hasCollision, boolean canOcclude)
{
public BlockConfig
{
Expand All @@ -316,7 +315,7 @@ public final record BlockConfig(@Nonnull Block block, double speedMult, double d

/**
* An enum for discerning if a configuration string from {@link CommonConfig#passableBlocks}
* is for a {@link Tag} or a {@link Block}.
* is for a {@link net.minecraft.tags.Tag} or a {@link Block}.
*/
enum ItemType
{
Expand Down Expand Up @@ -370,9 +369,9 @@ static BlockConfig.ItemType get(final String type)
};

/**
* A {@link Comparator} to sort the config strings so that all {@link Tag} entries are processed before {@link Block}
* entries, so that if a Block entry is also the member of a Tag entry, the singular Block entry will take precedence
* and override the Tag entry. This is so that users can special-case some blocks if they want to.
* A {@link Comparator} to sort the config strings so that all {@link net.minecraft.tags.Tag} entries are processed before {@link Block}
* entries, so that if a Block entry is also the member of a BlockTag, the singular Block entry will take precedence
* and override the BlockTag entry. This is so that users can special-case some blocks if they want to.
*/
static final Comparator<String> CFGSTR_SORTER = (cfgstr1, cfgstr2) -> {
final var pattern = Pattern.compile("^\\s*" + BlockConfig.PATTERN_ITEMTYPE + "\\/\\w.*$", Pattern.CASE_INSENSITIVE);
Expand Down Expand Up @@ -435,7 +434,7 @@ static BlockConfig.ItemType get(final String type)
})
.collect(Collectors.toSet());
if (tagBlocks.isEmpty()) {
FallThru.LOGGER.error(MARKER_BLOCKCFG, "Could not find any blocks for Tag, or Tag does not exist: {}", resloc);
FallThru.LOGGER.error(MARKER_BLOCKCFG, "Could not find any blocks for BlockTag, or BlockTag does not exist: {}", resloc);
}
blocks.addAll(tagBlocks);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ static S2CFallThruUpdatePacket decode(final FriendlyByteBuf input)
*
* @param output The {@link FriendlyByteBuf} to write the serialized BlockConfigMap to.
*/
final void encode(final FriendlyByteBuf output)
void encode(final FriendlyByteBuf output)
{
output.writeNbt(configBlocks);
}
Expand Down
6 changes: 3 additions & 3 deletions src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
modLoader = "javafml"
loaderVersion = "[37,)"
loaderVersion = "[37,38)"
license = "MIT License"
issueTrackerURL = "https://github.com/srscode/FallThru/issues/"

Expand All @@ -21,13 +21,13 @@ The configuration is versatile and each block can be configured individually.
[[dependencies.fallthru]]
modId = "forge"
mandatory = true
versionRange = "[37.0.59,)" # 37.0.59 is the minimum version for Mixin
versionRange = "[37.0.59,38)" # 37.0.59 is the minimum version for Mixin, 38.x contains breaking refactors
ordering = "NONE"
side = "BOTH"

[[dependencies.fallthru]]
modId = "minecraft"
mandatory = true
versionRange = "[1.17.1,)"
versionRange = "[1.17.1,1.18)"
ordering = "NONE"
side = "BOTH"

0 comments on commit cb8c9e6

Please sign in to comment.