Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update to minecraft 1.20 #41

Merged
merged 1 commit into from
Jun 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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