Skip to content

Commit

Permalink
Update to MC 1.21
Browse files Browse the repository at this point in the history
  • Loading branch information
rubensworks committed Jul 12, 2024
1 parent d7483b4 commit 698fda3
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 27 deletions.
6 changes: 4 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'net.neoforged.gradle.userdev' version '7.0.97'
id 'net.neoforged.gradle.userdev' version '7.0.145'
id 'net.darkhax.curseforgegradle' version '1.0.8'
id 'com.github.kt3k.coveralls' version '2.8.2'
id 'com.diffplug.spotless' version '5.14.3'
Expand Down Expand Up @@ -32,7 +32,7 @@ base {
}

// Set Java details
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
java.toolchain.languageVersion = JavaLanguageVersion.of(21)
compileJava.options.compilerArgs << "-Xmaxerrs" << "9999"
println('Java: ' + System.getProperty('java.version') + ' JVM: ' + System.getProperty('java.vm.version') + '(' + System.getProperty('java.vendor') + ') Arch: ' + System.getProperty('os.arch'))

Expand Down Expand Up @@ -274,6 +274,8 @@ publishing {

idea {
module {
downloadSources = true
downloadJavadoc = true
for (String excludeDirName in ["run", "out", "logs", "gradle"]) {
File excludeDir = new File(projectDir, excludeDirName)
excludeDirs.add(excludeDir)
Expand Down
14 changes: 7 additions & 7 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
mod_id=integratedterminals-compat
mod_version=1.0.0
minecraft_version=1.20.4
neoforge_version=20.4.160-beta
cyclopscore_version=1.19.0-423
minecraft_version=1.21
neoforge_version=21.0.43-beta
cyclopscore_version=1.19.1-462
release_type=release
fingerprint=bd0353b3e8a2810d60dd584e256e364bc3bedd44

integrateddynamics_version=1.21.2-740
integratedterminals_version=1.4.12-326
commoncapabilities_version=2.9.1-116
integrateddynamics_version=1.21.4-773
integratedterminals_version=1.4.13-340
commoncapabilities_version=2.9.1-126
curios_version=7.3.4+1.20.4
jei_version=17.3.0.52
jei_version=19.5.0.31

# Workaround for Spotless bug
# https://github.com/diffplug/spotless/issues/834
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public static int getItemStackMatchCondition(ItemStack itemStack) {
// So if we would run into problems with this, this filtering is what we'd need to do.

String subTypeInfo = JEIIntegratedTerminalsConfig.subTypeManager.getSubtypeInfo(VanillaTypes.ITEM_STACK, itemStack, UidContext.Ingredient);
return subTypeInfo == null ? ItemMatch.ITEM : ItemMatch.ITEM | ItemMatch.TAG;
return subTypeInfo == null ? ItemMatch.ITEM : ItemMatch.ITEM | ItemMatch.DATA;
}

@Override
Expand Down Expand Up @@ -94,7 +94,7 @@ public void registerRecipeCatalysts(IRecipeCatalystRegistration registration) {

@Override
public ResourceLocation getPluginUid() {
return new ResourceLocation(Reference.MOD_ID, "main");
return ResourceLocation.fromNamespaceAndPath(Reference.MOD_ID, "main");
}

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

import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.network.RegistryFriendlyByteBuf;
import net.minecraft.network.codec.StreamCodec;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.entity.player.Player;
Expand Down Expand Up @@ -33,9 +34,10 @@
* @author rubensworks
*
*/
public class TerminalStorageIngredientItemStackCraftingGridSetRecipe extends PacketCodec {
public class TerminalStorageIngredientItemStackCraftingGridSetRecipe extends PacketCodec<TerminalStorageIngredientItemStackCraftingGridSetRecipe> {

public static final ResourceLocation ID = new ResourceLocation(Reference.MOD_ID, "terminal_storage_ingredient_itemstack_crafting_grid_set_recipe");
public static final Type<TerminalStorageIngredientItemStackCraftingGridSetRecipe> ID = new Type<>(ResourceLocation.fromNamespaceAndPath(Reference.MOD_ID, "terminal_storage_ingredient_itemstack_crafting_grid_set_recipe"));
public static final StreamCodec<RegistryFriendlyByteBuf, TerminalStorageIngredientItemStackCraftingGridSetRecipe> CODEC = getCodec(TerminalStorageIngredientItemStackCraftingGridSetRecipe::new);

@CodecField
private String tabId;
Expand All @@ -62,14 +64,14 @@ public TerminalStorageIngredientItemStackCraftingGridSetRecipe(String tabId, int
}

@Override
public void encode(FriendlyByteBuf output) {
public void encode(RegistryFriendlyByteBuf output) {
super.encode(output);

// slottedIngredientsFromPlayer and slottedIngredientsFromStorage are encoded manually for more space efficiency
output.writeInt(slottedIngredientsFromPlayer.size());
for (Map.Entry<Integer, Pair<ItemStack, Integer>> entry : slottedIngredientsFromPlayer.entrySet()) {
output.writeInt(entry.getKey());
output.writeItem(entry.getValue().getLeft());
ItemStack.OPTIONAL_STREAM_CODEC.encode(output, entry.getValue().getLeft());
output.writeInt(entry.getValue().getRight());
}

Expand All @@ -78,21 +80,21 @@ public void encode(FriendlyByteBuf output) {
output.writeInt(entry.getKey());
output.writeInt(entry.getValue().size());
for (Pair<ItemStack, Integer> subEntry : entry.getValue()) {
output.writeItem(subEntry.getLeft());
ItemStack.OPTIONAL_STREAM_CODEC.encode(output, subEntry.getLeft());
output.writeInt(subEntry.getRight());
}
}
}

@Override
public void decode(FriendlyByteBuf input) {
public void decode(RegistryFriendlyByteBuf input) {
super.decode(input);

// slottedIngredientsFromPlayer and slottedIngredientsFromStorage are encoded manually for more space efficiency
int entriesSlottedIngredientsFromPlayer = input.readInt();
this.slottedIngredientsFromPlayer = Maps.newHashMap();
for (int i = 0; i < entriesSlottedIngredientsFromPlayer; i++) {
this.slottedIngredientsFromPlayer.put(input.readInt(), Pair.of(input.readItem(), input.readInt()));
this.slottedIngredientsFromPlayer.put(input.readInt(), Pair.of(ItemStack.OPTIONAL_STREAM_CODEC.decode(input), input.readInt()));
}

int entriesSlottedIngredientsFromStorage = input.readInt();
Expand All @@ -102,7 +104,7 @@ public void decode(FriendlyByteBuf input) {
int entries = input.readInt();
List<Pair<ItemStack, Integer>> alternatives = Lists.newArrayListWithExpectedSize(entries);
for (int j = 0; j < entries; j++) {
alternatives.add(Pair.of(input.readItem(), input.readInt()));
alternatives.add(Pair.of(ItemStack.OPTIONAL_STREAM_CODEC.decode(input), input.readInt()));
}
this.slottedIngredientsFromStorage.put(key, alternatives);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ public ModBase getMod() {
public void registerPacketHandlers(PacketHandler packetHandler) {
super.registerPacketHandlers(packetHandler);

packetHandler.register(TerminalStorageIngredientItemStackCraftingGridSetRecipe.ID, TerminalStorageIngredientItemStackCraftingGridSetRecipe::new);
packetHandler.register(TerminalStorageIngredientItemStackCraftingGridSetRecipe.ID, TerminalStorageIngredientItemStackCraftingGridSetRecipe.CODEC);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,25 @@ Integrated Terminals compatibility with other mods. This mod is automatically pa
[[dependencies.integratedterminalscompat]]
modId="cyclopscore"
type="required"
versionRange="[1.19.0,)"
versionRange="[1.19.1,)"
ordering="NONE"
side="BOTH"
[[dependencies.integratedterminalscompat]]
modId="integrateddynamics"
type="required"
versionRange="[1.16.7,)"
versionRange="[1.21.4,)"
ordering="NONE"
side="BOTH"
[[dependencies.integratedterminalscompat]]
modId="commoncapabilities"
type="required"
versionRange="[2.9.0,)"
versionRange="[2.9.1,)"
ordering="NONE"
side="BOTH"
[[dependencies.integratedterminalscompat]]
modId="neoforge"
type="required"
versionRange="[20.4,)"
versionRange="[21.0.43-beta,)"
ordering="NONE"
side="BOTH"
[[dependencies.integratedterminalscompat]]
Expand All @@ -45,6 +45,6 @@ Integrated Terminals compatibility with other mods. This mod is automatically pa
[[dependencies.integratedterminalscompat]]
modId="minecraft"
type="required"
versionRange="[1.20.4,]"
versionRange="[1.21,]"
ordering="NONE"
side="BOTH"

0 comments on commit 698fda3

Please sign in to comment.