Skip to content

Commit

Permalink
Merge pull request #41 from demkom58/1.20-update
Browse files Browse the repository at this point in the history
fix: update to minecraft 1.20
  • Loading branch information
demkom58 authored Jun 9, 2023
2 parents 8dd1514 + 6a28115 commit f5d9ff0
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import com.demkom58.divinedrop.version.V19R1.V19R1;
import com.demkom58.divinedrop.version.V19R2.V19R2;
import com.demkom58.divinedrop.version.V19R3.V19R3;
import com.demkom58.divinedrop.version.V20R1.V20R1;
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 @@ -49,7 +50,8 @@ public enum SupportedVersion {
V18R2(V18R2.class, new V13ResourceClient("1.18.2"), "v1_18_R2", V18R2::new),
V19R1(V19R1.class, new V13ResourceClient("1.19"), "v1_19_R1", V19R1::new),
V19R2(V19R2.class, new V13ResourceClient("1.19.3"), "v1_19_R2", V19R2::new),
V19R3(V19R3.class, new V13ResourceClient("1.19.4"), "v1_19_R3", V19R3::new)
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)
;

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/V20R1/V20R1.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package com.demkom58.divinedrop.version.V20R1;

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 V20R1 extends V13NmsHandleNameVersion {
public V20R1(@NotNull final ResourceClient client, @NotNull final ItemHandler manager) throws Exception {
super(client, manager,
MethodHandles.lookup()
.findStatic(
Class.forName("org.bukkit.craftbukkit.v1_20_R1.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.

2 changes: 1 addition & 1 deletion src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: DivineDrop
main: com.demkom58.divinedrop.DivineDrop
description: Awesome removal of items from the ground
website: https://www.spigotmc.org/members/98068/
version: 2.11
version: 2.12
authors:
- demkom58
- GdemkomG
Expand Down

0 comments on commit f5d9ff0

Please sign in to comment.