Skip to content

Commit

Permalink
Merge pull request #47 from demkom58/1.20.4-update
Browse files Browse the repository at this point in the history
feat: support for 1.20.4
  • Loading branch information
demkom58 authored Dec 24, 2023
2 parents 763415f + 11b26f3 commit edf331a
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import com.demkom58.divinedrop.version.V19R3.V19R3;
import com.demkom58.divinedrop.version.V20R1.V20R1;
import com.demkom58.divinedrop.version.V20R2.V20R2;
import com.demkom58.divinedrop.version.V20R3.V20R3;
import com.demkom58.divinedrop.version.V8R3.V8R3;
import com.demkom58.divinedrop.version.V8R3.V8ResourceClient;
import com.demkom58.divinedrop.version.V9R1.V9R1;
Expand Down Expand Up @@ -54,6 +55,7 @@ public enum SupportedVersion {
V19R3(V19R3.class, new V13ResourceClient("1.19.4"), "v1_19_R3", V19R3::new),
V20R1(V20R1.class, new V13ResourceClient("1.20"), "v1_20_R1", V20R1::new),
V20R2(V20R2.class, new V13ResourceClient("1.20.2"), "v1_20_R2", V20R2::new),
V20R3(V20R3.class, new V13ResourceClient("1.20.4"), "v1_20_R3", V20R3::new),
;

private static final Map<String, SupportedVersion> NMS_VERSION_MAP = new HashMap<String, SupportedVersion>(){{
Expand Down
34 changes: 34 additions & 0 deletions src/main/java/com/demkom58/divinedrop/version/V20R3/V20R3.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package com.demkom58.divinedrop.version.V20R3;

import com.demkom58.divinedrop.drop.ItemHandler;
import com.demkom58.divinedrop.version.V13R1.V13NmsHandleNameVersion;
import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.NotNull;

import java.lang.invoke.MethodHandles;
import java.lang.invoke.MethodType;

public class V20R3 extends V13NmsHandleNameVersion {
public V20R3(@NotNull final ResourceClient client, @NotNull final ItemHandler manager) throws Exception {
super(client, manager,
MethodHandles.lookup()
.findStatic(
Class.forName("org.bukkit.craftbukkit.v1_20_R3.inventory.CraftItemStack"),
"asNMSCopy",
MethodType.methodType(Class.forName("net.minecraft.world.item.ItemStack"), ItemStack.class)
),
MethodHandles.lookup()
.findVirtual(
Class.forName("net.minecraft.world.item.ItemStack"),
"d",
MethodType.methodType(Class.forName("net.minecraft.world.item.Item"))
),
MethodHandles.lookup()
.findVirtual(
Class.forName("net.minecraft.world.item.Item"),
"a",
MethodType.methodType(String.class)
)
);
}
}
2 changes: 1 addition & 1 deletion src/main/resources/cache.json

Large diffs are not rendered by default.

0 comments on commit edf331a

Please sign in to comment.