Skip to content

Commit

Permalink
Add version 1.20.2 support
Browse files Browse the repository at this point in the history
  • Loading branch information
stefvanschie committed Oct 24, 2023
1 parent b70f390 commit 3140721
Show file tree
Hide file tree
Showing 26 changed files with 2,035 additions and 44 deletions.
8 changes: 7 additions & 1 deletion IF/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,13 @@
</dependency>
<dependency>
<groupId>com.github.stefvanschie.inventoryframework</groupId>
<artifactId>1_20</artifactId>
<artifactId>1_20_0-1</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.github.stefvanschie.inventoryframework</groupId>
<artifactId>1_20_2</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,16 +121,36 @@ public enum Version {
V1_19_4,

/**
* Version 1.20
* Version 1.20.0 - 1.20.1
*
* @since 0.10.10
*/
V1_20;
V1_20_0_1,

/**
* Version 1.20.2
*
* @since 0.10.12
*/
V1_20_2;

/**
* A collection of versions on which modern smithing tables are available.
*/
private static final Collection<Version> MODERN_SMITHING_TABLE_VERSIONS = EnumSet.of(V1_19_4, V1_20);
private static final Collection<Version> MODERN_SMITHING_TABLE_VERSIONS = EnumSet.of(V1_19_4, V1_20_0_1, V1_20_2);

/**
* A collection of versions on which legacy smithing tables ae available.
*/
@NotNull
private static final Collection<@NotNull Version> LEGACY_SMITHING_TABLE_VERSIONS = EnumSet.of(
V1_14,
V1_15,
V1_16_1, V1_16_2_3, V1_16_4_5,
V1_17_0, V1_17_1,
V1_18_0, V1_18_1, V1_18_2,
V1_19_0, V1_19_1, V1_19_2, V1_19_3, V1_19_4
);

/**
* Checks whether modern smithing tables exist on this version. Returns true if they do, otherwise false.
Expand All @@ -150,7 +170,7 @@ boolean existsModernSmithingTable() {
*/
@Contract(pure = true)
boolean existsLegacySmithingTable() {
return this != V1_20;
return LEGACY_SMITHING_TABLE_VERSIONS.contains(this);
}

/**
Expand Down Expand Up @@ -206,7 +226,9 @@ public static Version getVersion() {
return V1_19_4;
case "1.20":
case "1.20.1":
return V1_20;
return V1_20_0_1;
case "1.20.2":
return V1_20_2;
default:
throw new UnsupportedVersionException("The server version provided is not supported");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -305,8 +305,10 @@ public static StonecutterInventory newStonecutterInventory(@NotNull Version vers
com.github.stefvanschie.inventoryframework.nms.v1_19_3.AnvilInventoryImpl.class);
ANVIL_INVENTORIES.put(Version.V1_19_4,
com.github.stefvanschie.inventoryframework.nms.v1_19_4.AnvilInventoryImpl.class);
ANVIL_INVENTORIES.put(Version.V1_20,
com.github.stefvanschie.inventoryframework.nms.v1_20.AnvilInventoryImpl.class);
ANVIL_INVENTORIES.put(Version.V1_20_0_1,
com.github.stefvanschie.inventoryframework.nms.v1_20_0_1.AnvilInventoryImpl.class);
ANVIL_INVENTORIES.put(Version.V1_20_2,
com.github.stefvanschie.inventoryframework.nms.v1_20_2.AnvilInventoryImpl.class);

BEACON_INVENTORIES = new EnumMap<>(Version.class);
BEACON_INVENTORIES.put(Version.V1_14,
Expand Down Expand Up @@ -339,8 +341,10 @@ public static StonecutterInventory newStonecutterInventory(@NotNull Version vers
com.github.stefvanschie.inventoryframework.nms.v1_19_3.BeaconInventoryImpl.class);
BEACON_INVENTORIES.put(Version.V1_19_4,
com.github.stefvanschie.inventoryframework.nms.v1_19_4.BeaconInventoryImpl.class);
BEACON_INVENTORIES.put(Version.V1_20,
com.github.stefvanschie.inventoryframework.nms.v1_20.BeaconInventoryImpl.class);
BEACON_INVENTORIES.put(Version.V1_20_0_1,
com.github.stefvanschie.inventoryframework.nms.v1_20_0_1.BeaconInventoryImpl.class);
BEACON_INVENTORIES.put(Version.V1_20_2,
com.github.stefvanschie.inventoryframework.nms.v1_20_2.BeaconInventoryImpl.class);

CARTOGRAPHY_TABLE_INVENTORIES = new EnumMap<>(Version.class);
CARTOGRAPHY_TABLE_INVENTORIES.put(Version.V1_14,
Expand Down Expand Up @@ -373,8 +377,10 @@ public static StonecutterInventory newStonecutterInventory(@NotNull Version vers
com.github.stefvanschie.inventoryframework.nms.v1_19_3.CartographyTableInventoryImpl.class);
CARTOGRAPHY_TABLE_INVENTORIES.put(Version.V1_19_4,
com.github.stefvanschie.inventoryframework.nms.v1_19_4.CartographyTableInventoryImpl.class);
CARTOGRAPHY_TABLE_INVENTORIES.put(Version.V1_20,
com.github.stefvanschie.inventoryframework.nms.v1_20.CartographyTableInventoryImpl.class);
CARTOGRAPHY_TABLE_INVENTORIES.put(Version.V1_20_0_1,
com.github.stefvanschie.inventoryframework.nms.v1_20_0_1.CartographyTableInventoryImpl.class);
CARTOGRAPHY_TABLE_INVENTORIES.put(Version.V1_20_2,
com.github.stefvanschie.inventoryframework.nms.v1_20_2.CartographyTableInventoryImpl.class);

ENCHANTING_TABLE_INVENTORIES = new EnumMap<>(Version.class);
ENCHANTING_TABLE_INVENTORIES.put(Version.V1_14,
Expand Down Expand Up @@ -407,8 +413,10 @@ public static StonecutterInventory newStonecutterInventory(@NotNull Version vers
com.github.stefvanschie.inventoryframework.nms.v1_19_3.EnchantingTableInventoryImpl.class);
ENCHANTING_TABLE_INVENTORIES.put(Version.V1_19_4,
com.github.stefvanschie.inventoryframework.nms.v1_19_4.EnchantingTableInventoryImpl.class);
ENCHANTING_TABLE_INVENTORIES.put(Version.V1_20,
com.github.stefvanschie.inventoryframework.nms.v1_20.EnchantingTableInventoryImpl.class);
ENCHANTING_TABLE_INVENTORIES.put(Version.V1_20_0_1,
com.github.stefvanschie.inventoryframework.nms.v1_20_0_1.EnchantingTableInventoryImpl.class);
ENCHANTING_TABLE_INVENTORIES.put(Version.V1_20_2,
com.github.stefvanschie.inventoryframework.nms.v1_20_2.EnchantingTableInventoryImpl.class);

GRINDSTONE_INVENTORIES = new EnumMap<>(Version.class);
GRINDSTONE_INVENTORIES.put(Version.V1_14,
Expand Down Expand Up @@ -441,8 +449,10 @@ public static StonecutterInventory newStonecutterInventory(@NotNull Version vers
com.github.stefvanschie.inventoryframework.nms.v1_19_3.GrindstoneInventoryImpl.class);
GRINDSTONE_INVENTORIES.put(Version.V1_19_4,
com.github.stefvanschie.inventoryframework.nms.v1_19_4.GrindstoneInventoryImpl.class);
GRINDSTONE_INVENTORIES.put(Version.V1_20,
com.github.stefvanschie.inventoryframework.nms.v1_20.GrindstoneInventoryImpl.class);
GRINDSTONE_INVENTORIES.put(Version.V1_20_0_1,
com.github.stefvanschie.inventoryframework.nms.v1_20_0_1.GrindstoneInventoryImpl.class);
GRINDSTONE_INVENTORIES.put(Version.V1_20_2,
com.github.stefvanschie.inventoryframework.nms.v1_20_2.GrindstoneInventoryImpl.class);

MERCHANT_INVENTORIES = new EnumMap<>(Version.class);
MERCHANT_INVENTORIES.put(Version.V1_14,
Expand Down Expand Up @@ -475,14 +485,18 @@ public static StonecutterInventory newStonecutterInventory(@NotNull Version vers
com.github.stefvanschie.inventoryframework.nms.v1_19_3.MerchantInventoryImpl.class);
MERCHANT_INVENTORIES.put(Version.V1_19_4,
com.github.stefvanschie.inventoryframework.nms.v1_19_4.MerchantInventoryImpl.class);
MERCHANT_INVENTORIES.put(Version.V1_20,
com.github.stefvanschie.inventoryframework.nms.v1_20.MerchantInventoryImpl.class);
MERCHANT_INVENTORIES.put(Version.V1_20_0_1,
com.github.stefvanschie.inventoryframework.nms.v1_20_0_1.MerchantInventoryImpl.class);
MERCHANT_INVENTORIES.put(Version.V1_20_2,
com.github.stefvanschie.inventoryframework.nms.v1_20_2.MerchantInventoryImpl.class);

SMITHING_TABLE_INVENTORIES = new EnumMap<>(Version.class);
SMITHING_TABLE_INVENTORIES.put(Version.V1_19_4,
com.github.stefvanschie.inventoryframework.nms.v1_19_4.SmithingTableInventoryImpl.class);
SMITHING_TABLE_INVENTORIES.put(Version.V1_20,
com.github.stefvanschie.inventoryframework.nms.v1_20.SmithingTableInventoryImpl.class);
SMITHING_TABLE_INVENTORIES.put(Version.V1_20_0_1,
com.github.stefvanschie.inventoryframework.nms.v1_20_0_1.SmithingTableInventoryImpl.class);
SMITHING_TABLE_INVENTORIES.put(Version.V1_20_2,
com.github.stefvanschie.inventoryframework.nms.v1_20_2.SmithingTableInventoryImpl.class);

LEGACY_SMITHING_TABLE_INVENTORIES = new EnumMap<>(Version.class);
LEGACY_SMITHING_TABLE_INVENTORIES.put(Version.V1_16_1,
Expand Down Expand Up @@ -543,7 +557,9 @@ public static StonecutterInventory newStonecutterInventory(@NotNull Version vers
com.github.stefvanschie.inventoryframework.nms.v1_19_3.StonecutterInventoryImpl.class);
STONECUTTER_INVENTORIES.put(Version.V1_19_4,
com.github.stefvanschie.inventoryframework.nms.v1_19_4.StonecutterInventoryImpl.class);
STONECUTTER_INVENTORIES.put(Version.V1_20,
com.github.stefvanschie.inventoryframework.nms.v1_20.StonecutterInventoryImpl.class);
STONECUTTER_INVENTORIES.put(Version.V1_20_0_1,
com.github.stefvanschie.inventoryframework.nms.v1_20_0_1.StonecutterInventoryImpl.class);
STONECUTTER_INVENTORIES.put(Version.V1_20_2,
com.github.stefvanschie.inventoryframework.nms.v1_20_2.StonecutterInventoryImpl.class);
}
}
2 changes: 1 addition & 1 deletion nms/1_20/pom.xml → nms/1_20_0-1/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<relativePath>../../pom.xml</relativePath>
</parent>

<artifactId>1_20</artifactId>
<artifactId>1_20_0-1</artifactId>

<properties>
<maven.deploy.skip>true</maven.deploy.skip>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.github.stefvanschie.inventoryframework.nms.v1_20;
package com.github.stefvanschie.inventoryframework.nms.v1_20_0_1;

import com.github.stefvanschie.inventoryframework.abstraction.AnvilInventory;
import com.github.stefvanschie.inventoryframework.adventuresupport.TextHolder;
import com.github.stefvanschie.inventoryframework.nms.v1_20.util.CustomInventoryUtil;
import com.github.stefvanschie.inventoryframework.nms.v1_20.util.TextHolderUtil;
import com.github.stefvanschie.inventoryframework.nms.v1_20_0_1.util.CustomInventoryUtil;
import com.github.stefvanschie.inventoryframework.nms.v1_20_0_1.util.TextHolderUtil;
import net.minecraft.core.BlockPos;
import net.minecraft.core.NonNullList;
import net.minecraft.network.chat.Component;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.stefvanschie.inventoryframework.nms.v1_20;
package com.github.stefvanschie.inventoryframework.nms.v1_20_0_1;

import com.github.stefvanschie.inventoryframework.abstraction.BeaconInventory;
import net.minecraft.core.NonNullList;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.github.stefvanschie.inventoryframework.nms.v1_20;
package com.github.stefvanschie.inventoryframework.nms.v1_20_0_1;

import com.github.stefvanschie.inventoryframework.abstraction.CartographyTableInventory;
import com.github.stefvanschie.inventoryframework.adventuresupport.TextHolder;
import com.github.stefvanschie.inventoryframework.nms.v1_20.util.CustomInventoryUtil;
import com.github.stefvanschie.inventoryframework.nms.v1_20.util.TextHolderUtil;
import com.github.stefvanschie.inventoryframework.nms.v1_20_0_1.util.CustomInventoryUtil;
import com.github.stefvanschie.inventoryframework.nms.v1_20_0_1.util.TextHolderUtil;
import net.minecraft.core.NonNullList;
import net.minecraft.network.chat.Component;
import net.minecraft.network.protocol.game.ClientboundContainerSetContentPacket;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.github.stefvanschie.inventoryframework.nms.v1_20;
package com.github.stefvanschie.inventoryframework.nms.v1_20_0_1;

import com.github.stefvanschie.inventoryframework.abstraction.EnchantingTableInventory;
import com.github.stefvanschie.inventoryframework.adventuresupport.TextHolder;
import com.github.stefvanschie.inventoryframework.nms.v1_20.util.TextHolderUtil;
import com.github.stefvanschie.inventoryframework.nms.v1_20_0_1.util.TextHolderUtil;
import net.minecraft.core.NonNullList;
import net.minecraft.network.chat.Component;
import net.minecraft.network.protocol.game.ClientboundContainerSetContentPacket;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.github.stefvanschie.inventoryframework.nms.v1_20;
package com.github.stefvanschie.inventoryframework.nms.v1_20_0_1;

import com.github.stefvanschie.inventoryframework.abstraction.GrindstoneInventory;
import com.github.stefvanschie.inventoryframework.adventuresupport.TextHolder;
import com.github.stefvanschie.inventoryframework.nms.v1_20.util.CustomInventoryUtil;
import com.github.stefvanschie.inventoryframework.nms.v1_20.util.TextHolderUtil;
import com.github.stefvanschie.inventoryframework.nms.v1_20_0_1.util.CustomInventoryUtil;
import com.github.stefvanschie.inventoryframework.nms.v1_20_0_1.util.TextHolderUtil;
import net.minecraft.core.NonNullList;
import net.minecraft.network.chat.Component;
import net.minecraft.network.protocol.game.ClientboundContainerSetContentPacket;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.stefvanschie.inventoryframework.nms.v1_20;
package com.github.stefvanschie.inventoryframework.nms.v1_20_0_1;

import com.github.stefvanschie.inventoryframework.abstraction.MerchantInventory;
import net.minecraft.server.level.ServerPlayer;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.github.stefvanschie.inventoryframework.nms.v1_20;
package com.github.stefvanschie.inventoryframework.nms.v1_20_0_1;

import com.github.stefvanschie.inventoryframework.abstraction.SmithingTableInventory;
import com.github.stefvanschie.inventoryframework.adventuresupport.TextHolder;
import com.github.stefvanschie.inventoryframework.nms.v1_20.util.CustomInventoryUtil;
import com.github.stefvanschie.inventoryframework.nms.v1_20.util.TextHolderUtil;
import com.github.stefvanschie.inventoryframework.nms.v1_20_0_1.util.CustomInventoryUtil;
import com.github.stefvanschie.inventoryframework.nms.v1_20_0_1.util.TextHolderUtil;
import net.minecraft.core.BlockPos;
import net.minecraft.core.NonNullList;
import net.minecraft.network.chat.Component;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.github.stefvanschie.inventoryframework.nms.v1_20;
package com.github.stefvanschie.inventoryframework.nms.v1_20_0_1;

import com.github.stefvanschie.inventoryframework.abstraction.StonecutterInventory;
import com.github.stefvanschie.inventoryframework.adventuresupport.TextHolder;
import com.github.stefvanschie.inventoryframework.nms.v1_20.util.TextHolderUtil;
import com.github.stefvanschie.inventoryframework.nms.v1_20_0_1.util.TextHolderUtil;
import net.minecraft.core.NonNullList;
import net.minecraft.network.chat.Component;
import net.minecraft.network.protocol.game.ClientboundContainerSetContentPacket;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.stefvanschie.inventoryframework.nms.v1_20.util;
package com.github.stefvanschie.inventoryframework.nms.v1_20_0_1.util;

import net.minecraft.core.NonNullList;
import net.minecraft.world.item.ItemStack;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.stefvanschie.inventoryframework.nms.v1_20.util;
package com.github.stefvanschie.inventoryframework.nms.v1_20_0_1.util;

import com.github.stefvanschie.inventoryframework.adventuresupport.ComponentHolder;
import com.github.stefvanschie.inventoryframework.adventuresupport.StringHolder;
Expand Down
59 changes: 59 additions & 0 deletions nms/1_20_2/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.github.stefvanschie.inventoryframework</groupId>
<artifactId>IF-parent</artifactId>
<version>0.10.12-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

<artifactId>1_20_2</artifactId>

<properties>
<maven.deploy.skip>true</maven.deploy.skip>
</properties>

<dependencies>
<dependency>
<groupId>com.github.stefvanschie.inventoryframework</groupId>
<artifactId>abstraction</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>ca.bkaw</groupId>
<artifactId>paper-nms</artifactId>
<version>1.20.2-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>ca.bkaw</groupId>
<artifactId>paper-nms-maven-plugin</artifactId>
<version>1.4.1</version>
<executions>
<execution>
<phase>process-classes</phase>
<goals>
<goal>remap</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

<pluginRepositories>
<pluginRepository>
<id>bytecode.space</id>
<url>https://repo.bytecode.space/repository/maven-public/</url>
</pluginRepository>
</pluginRepositories>

</project>
Loading

0 comments on commit 3140721

Please sign in to comment.