Compare commits
2 Commits
f8a7c5f1e7
...
2fc3eb50f5
Author | SHA1 | Date | |
---|---|---|---|
2fc3eb50f5 | |||
fc44151f2b |
@@ -18,6 +18,9 @@ import java.util.Objects;
|
||||
*/
|
||||
public class DummyPlayerInventory extends InventoryWrapper implements PlayerInventory {
|
||||
|
||||
/**
|
||||
* Total number of item slots in the player inventory.
|
||||
*/
|
||||
public static final int PLAYER_INVENTORY_SIZE = 43; // 36 base inventory + 4 armor slots + 1 off hand + 2 hidden slots (body and saddle)
|
||||
|
||||
private int heldItemSlot;
|
||||
@@ -116,18 +119,34 @@ public class DummyPlayerInventory extends InventoryWrapper implements PlayerInve
|
||||
setItem(36, boots);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the item stack in the SADDLE {@link EquipmentSlot}.
|
||||
* @return the SADDLE item stack.
|
||||
*/
|
||||
public ItemStack getSaddle() {
|
||||
return getItem(42);
|
||||
}
|
||||
|
||||
/**
|
||||
* Puts the provided item stack in the SADDLE {@link EquipmentSlot}.
|
||||
* @param saddle the item.
|
||||
*/
|
||||
public void setSaddle(@Nullable ItemStack saddle) {
|
||||
setItem(42, saddle);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the item stack in the BODY {@link EquipmentSlot}.
|
||||
* @return the BODY item stack.
|
||||
*/
|
||||
public ItemStack getBody() {
|
||||
return getItem(41);
|
||||
}
|
||||
|
||||
/**
|
||||
* Puts the provided item stack in the BODY {@link EquipmentSlot}.
|
||||
* @param body the item.
|
||||
*/
|
||||
public void setBody(@Nullable ItemStack body) {
|
||||
setItem(41, body);
|
||||
}
|
||||
|
@@ -24,7 +24,6 @@ public class CompoundTag extends ReflectWrapper implements Tag {
|
||||
private static final ReflectMethod<?> putInt = wrapEx(() -> REFLECT.method("putInt", String.class, int.class));
|
||||
private static final ReflectMethod<?> putIntArray = wrapEx(() -> REFLECT.method("putIntArray", String.class, int[].class));
|
||||
private static final ReflectMethod<?> putString = wrapEx(() -> REFLECT.method("putString", String.class, String.class));
|
||||
private static final ReflectMethod<?> putUUID = wrapEx(() -> REFLECT.method("putUUID", String.class, UUID.class));
|
||||
private static final ReflectMethod<?> putLong = wrapEx(() -> REFLECT.method("putLong", String.class, long.class));
|
||||
private static final ReflectMethod<?> putLongArray = wrapEx(() -> REFLECT.method("putLongArray", String.class, long[].class));
|
||||
private static final ReflectMethod<?> putShort = wrapEx(() -> REFLECT.method("putShort", String.class, short.class));
|
||||
@@ -84,9 +83,6 @@ public class CompoundTag extends ReflectWrapper implements Tag {
|
||||
public void putString(String key, String value) {
|
||||
wrapReflectEx(() -> putString.invoke(__getRuntimeInstance(), key, value));
|
||||
}
|
||||
public void putUUID(String key, UUID value) {
|
||||
wrapReflectEx(() -> putUUID.invoke(__getRuntimeInstance(), key, value));
|
||||
}
|
||||
public void putLong(String key, long value) {
|
||||
wrapReflectEx(() -> putLong.invoke(__getRuntimeInstance(), key, value));
|
||||
}
|
||||
|
@@ -4,6 +4,7 @@ import com.mojang.serialization.Codec;
|
||||
import fr.pandacube.lib.reflect.Reflect;
|
||||
import fr.pandacube.lib.reflect.ReflectClass;
|
||||
import fr.pandacube.lib.reflect.ReflectMethod;
|
||||
import fr.pandacube.lib.reflect.wrapper.ConcreteWrapper;
|
||||
import fr.pandacube.lib.reflect.wrapper.ReflectWrapper;
|
||||
import fr.pandacube.lib.reflect.wrapper.ReflectWrapperI;
|
||||
|
||||
@@ -11,6 +12,7 @@ import static fr.pandacube.lib.reflect.wrapper.ReflectWrapper.wrap;
|
||||
import static fr.pandacube.lib.util.ThrowableUtil.wrapEx;
|
||||
import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx;
|
||||
|
||||
@ConcreteWrapper(ValueInput.__concrete.class)
|
||||
public interface ValueInput extends ReflectWrapperI {
|
||||
ReflectClass<?> REFLECT = wrapEx(() -> Reflect.ofClass("net.minecraft.world.level.storage.ValueInput"));
|
||||
ReflectMethod<?> listOrEmpty = wrapEx(() -> REFLECT.method("listOrEmpty", String.class, Codec.class));
|
||||
|
@@ -2,11 +2,13 @@ package fr.pandacube.lib.paper.reflect.wrapper.minecraft.world;
|
||||
|
||||
import fr.pandacube.lib.reflect.Reflect;
|
||||
import fr.pandacube.lib.reflect.ReflectClass;
|
||||
import fr.pandacube.lib.reflect.wrapper.ConcreteWrapper;
|
||||
import fr.pandacube.lib.reflect.wrapper.ReflectWrapperTyped;
|
||||
import fr.pandacube.lib.reflect.wrapper.ReflectWrapperTypedI;
|
||||
|
||||
import static fr.pandacube.lib.util.ThrowableUtil.wrapEx;
|
||||
|
||||
@ConcreteWrapper(ValueInputTypedInputList.__concrete.class)
|
||||
public interface ValueInputTypedInputList extends ReflectWrapperTypedI<Iterable<?>> {
|
||||
ReflectClass<?> REFLECT = wrapEx(() -> Reflect.ofClass("net.minecraft.world.level.storage.ValueInput$TypedInputList"));
|
||||
|
||||
|
@@ -4,6 +4,7 @@ import com.mojang.serialization.Codec;
|
||||
import fr.pandacube.lib.reflect.Reflect;
|
||||
import fr.pandacube.lib.reflect.ReflectClass;
|
||||
import fr.pandacube.lib.reflect.ReflectMethod;
|
||||
import fr.pandacube.lib.reflect.wrapper.ConcreteWrapper;
|
||||
import fr.pandacube.lib.reflect.wrapper.ReflectWrapper;
|
||||
import fr.pandacube.lib.reflect.wrapper.ReflectWrapperI;
|
||||
|
||||
@@ -11,6 +12,7 @@ import static fr.pandacube.lib.reflect.wrapper.ReflectWrapper.wrap;
|
||||
import static fr.pandacube.lib.util.ThrowableUtil.wrapEx;
|
||||
import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx;
|
||||
|
||||
@ConcreteWrapper(ValueOutput.__concrete.class)
|
||||
public interface ValueOutput extends ReflectWrapperI {
|
||||
ReflectClass<?> REFLECT = wrapEx(() -> Reflect.ofClass("net.minecraft.world.level.storage.ValueOutput"));
|
||||
ReflectMethod<?> list = wrapEx(() -> REFLECT.method("list", String.class, Codec.class));
|
||||
|
@@ -3,12 +3,14 @@ package fr.pandacube.lib.paper.reflect.wrapper.minecraft.world;
|
||||
import fr.pandacube.lib.reflect.Reflect;
|
||||
import fr.pandacube.lib.reflect.ReflectClass;
|
||||
import fr.pandacube.lib.reflect.ReflectMethod;
|
||||
import fr.pandacube.lib.reflect.wrapper.ConcreteWrapper;
|
||||
import fr.pandacube.lib.reflect.wrapper.ReflectWrapper;
|
||||
import fr.pandacube.lib.reflect.wrapper.ReflectWrapperI;
|
||||
|
||||
import static fr.pandacube.lib.util.ThrowableUtil.wrapEx;
|
||||
import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx;
|
||||
|
||||
@ConcreteWrapper(ValueOutputTypedOutputList.__concrete.class)
|
||||
public interface ValueOutputTypedOutputList extends ReflectWrapperI {
|
||||
ReflectClass<?> REFLECT = wrapEx(() -> Reflect.ofClass("net.minecraft.world.level.storage.ValueOutput$TypedOutputList"));
|
||||
ReflectMethod<?> add = wrapEx(() -> REFLECT.method("add", Object.class));
|
||||
|
Reference in New Issue
Block a user