mirror of
https://github.com/Flowsqy/ShopChest.git
synced 2024-11-22 00:25:34 +01:00
Add 1.20.5 nms module
This commit is contained in:
parent
418cb352b2
commit
2a6875af25
@ -17,3 +17,4 @@ You need to run the BuildTools for the following versions:
|
|||||||
- 1.20.1
|
- 1.20.1
|
||||||
- 1.20.2
|
- 1.20.2
|
||||||
- 1.20.4
|
- 1.20.4
|
||||||
|
- 1.20.5
|
||||||
|
@ -68,6 +68,10 @@
|
|||||||
<groupId>de.epiceric</groupId>
|
<groupId>de.epiceric</groupId>
|
||||||
<artifactId>shopchest-nms-v1_20_R3</artifactId>
|
<artifactId>shopchest-nms-v1_20_R3</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>de.epiceric</groupId>
|
||||||
|
<artifactId>shopchest-nms-v1_20_R4</artifactId>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
@ -0,0 +1,4 @@
|
|||||||
|
package de.epiceric.shopchest.nms;
|
||||||
|
|
||||||
|
public class DefaultTextComponentHelper implements TextComponentHelper {
|
||||||
|
}
|
@ -6,6 +6,8 @@ public interface Platform {
|
|||||||
|
|
||||||
FakeItem createFakeItem();
|
FakeItem createFakeItem();
|
||||||
|
|
||||||
TextComponentHelper getTextComponentHelper();
|
default TextComponentHelper getTextComponentHelper() {
|
||||||
|
return new DefaultTextComponentHelper();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
@ -28,7 +29,12 @@ public interface TextComponentHelper {
|
|||||||
* @param itemStack The item stack that will be displayed
|
* @param itemStack The item stack that will be displayed
|
||||||
* @return A string representing a json object of the 'tag'
|
* @return A string representing a json object of the 'tag'
|
||||||
*/
|
*/
|
||||||
String getNbt(ItemStack itemStack);
|
default String getNbt(ItemStack itemStack) {
|
||||||
|
if(!itemStack.hasItemMeta()) {
|
||||||
|
return "{}";
|
||||||
|
}
|
||||||
|
return Objects.requireNonNull(itemStack.getItemMeta()).getAsString();
|
||||||
|
}
|
||||||
|
|
||||||
default Consumer<Player> getSendableItemInfo(String message, String itemPlaceHolder, ItemStack itemStack, String productName){
|
default Consumer<Player> getSendableItemInfo(String message, String itemPlaceHolder, ItemStack itemStack, String productName){
|
||||||
final TextComponent baseComponent = new TextComponent();
|
final TextComponent baseComponent = new TextComponent();
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
<module>v1_20_R1</module>
|
<module>v1_20_R1</module>
|
||||||
<module>v1_20_R2</module>
|
<module>v1_20_R2</module>
|
||||||
<module>v1_20_R3</module>
|
<module>v1_20_R3</module>
|
||||||
|
<module>v1_20_R4</module>
|
||||||
<module>all</module>
|
<module>all</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
@ -111,6 +112,12 @@
|
|||||||
<version>1.0.0</version>
|
<version>1.0.0</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>de.epiceric</groupId>
|
||||||
|
<artifactId>shopchest-nms-v1_20_R4</artifactId>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</dependencyManagement>
|
</dependencyManagement>
|
||||||
|
|
||||||
|
@ -15,10 +15,13 @@ public class FakeItemImpl extends FakeEntityImpl implements FakeItem {
|
|||||||
private final Class<?> packetPlayOutEntityVelocityClass = nmsClassResolver.resolveSilent("network.protocol.game.PacketPlayOutEntityVelocity");
|
private final Class<?> packetPlayOutEntityVelocityClass = nmsClassResolver.resolveSilent("network.protocol.game.PacketPlayOutEntityVelocity");
|
||||||
private final Class<?> vec3dClass = nmsClassResolver.resolveSilent("world.phys.Vec3D");
|
private final Class<?> vec3dClass = nmsClassResolver.resolveSilent("world.phys.Vec3D");
|
||||||
private final Class<?> craftItemStackClass = obcClassResolver.resolveSilent("inventory.CraftItemStack");
|
private final Class<?> craftItemStackClass = obcClassResolver.resolveSilent("inventory.CraftItemStack");
|
||||||
|
private final EntityType DROPPED_ITEM;
|
||||||
|
|
||||||
public FakeItemImpl(ShopChestDebug debug) {
|
public FakeItemImpl(ShopChestDebug debug) {
|
||||||
super(debug);
|
super(debug);
|
||||||
|
|
||||||
|
DROPPED_ITEM = loadDroppedItemsEntityType();
|
||||||
|
|
||||||
Class<?> nmsItemStackClass = nmsClassResolver.resolveSilent("world.item.ItemStack");
|
Class<?> nmsItemStackClass = nmsClassResolver.resolveSilent("world.item.ItemStack");
|
||||||
|
|
||||||
Class<?>[] requiredClasses = new Class<?>[] {
|
Class<?>[] requiredClasses = new Class<?>[] {
|
||||||
@ -34,6 +37,16 @@ public class FakeItemImpl extends FakeEntityImpl implements FakeItem {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private EntityType loadDroppedItemsEntityType() {
|
||||||
|
// The constant name changed in 1.20.5
|
||||||
|
// Doing this ensure compatibility with older version when using reflection nms module
|
||||||
|
try {
|
||||||
|
return EntityType.valueOf("DROPPED_ITEM");
|
||||||
|
} catch (IllegalArgumentException e) {
|
||||||
|
return EntityType.ITEM;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void sendData(ItemStack item, Iterable<Player> receivers) {
|
public void sendData(ItemStack item, Iterable<Player> receivers) {
|
||||||
try {
|
try {
|
||||||
@ -72,7 +85,7 @@ public class FakeItemImpl extends FakeEntityImpl implements FakeItem {
|
|||||||
@Override
|
@Override
|
||||||
public void spawn(UUID uuid, Location location, Iterable<Player> receivers) {
|
public void spawn(UUID uuid, Location location, Iterable<Player> receivers) {
|
||||||
for(Player receiver : receivers) {
|
for(Player receiver : receivers) {
|
||||||
ReflectionUtils.sendPacket(debug, ReflectionUtils.createPacketSpawnEntity(debug, entityId, uuid, location, EntityType.DROPPED_ITEM), receiver);
|
ReflectionUtils.sendPacket(debug, ReflectionUtils.createPacketSpawnEntity(debug, entityId, uuid, location, DROPPED_ITEM), receiver);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
41
nms/v1_20_R4/pom.xml
Normal file
41
nms/v1_20_R4/pom.xml
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
<?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">
|
||||||
|
<parent>
|
||||||
|
<artifactId>shopchest-nms</artifactId>
|
||||||
|
<groupId>de.epiceric</groupId>
|
||||||
|
<version>1.0.1</version>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<artifactId>shopchest-nms-v1_20_R4</artifactId>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<spigot.version>1.20.5-R0.1-SNAPSHOT</spigot.version>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.spigotmc</groupId>
|
||||||
|
<artifactId>spigot</artifactId>
|
||||||
|
<classifier>remapped-mojang</classifier>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>de.epiceric</groupId>
|
||||||
|
<artifactId>shopchest-nms-interface</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>net.md-5</groupId>
|
||||||
|
<artifactId>specialsource-maven-plugin</artifactId>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
</project>
|
@ -0,0 +1,94 @@
|
|||||||
|
package de.epiceric.shopchest.nms.v1_20_R3;
|
||||||
|
|
||||||
|
import de.epiceric.shopchest.nms.FakeArmorStand;
|
||||||
|
import io.netty.buffer.Unpooled;
|
||||||
|
import net.minecraft.network.FriendlyByteBuf;
|
||||||
|
import net.minecraft.network.chat.Component;
|
||||||
|
import net.minecraft.network.protocol.game.ClientboundTeleportEntityPacket;
|
||||||
|
import net.minecraft.network.syncher.EntityDataAccessor;
|
||||||
|
import net.minecraft.network.syncher.SynchedEntityData;
|
||||||
|
import net.minecraft.world.entity.Entity;
|
||||||
|
import net.minecraft.world.entity.EntityType;
|
||||||
|
import net.minecraft.world.entity.decoration.ArmorStand;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.craftbukkit.v1_20_R4.util.CraftChatMessage;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
public class FakeArmorStandImpl extends FakeEntityImpl<String> implements FakeArmorStand {
|
||||||
|
|
||||||
|
private final static byte INVISIBLE_FLAG = 0b100000;
|
||||||
|
private final static byte MARKER_FLAG = 0b10000;
|
||||||
|
private final static EntityDataAccessor<Byte> DATA_SHARED_FLAGS_ID;
|
||||||
|
private final static EntityDataAccessor<Optional<Component>> DATA_CUSTOM_NAME;
|
||||||
|
private final static EntityDataAccessor<Boolean> DATA_CUSTOM_NAME_VISIBLE;
|
||||||
|
private final static float MARKER_ARMOR_STAND_OFFSET = 1.975f;
|
||||||
|
|
||||||
|
static {
|
||||||
|
try {
|
||||||
|
final Field dataSharedFlagsId = Entity.class.getDeclaredField(ObfuscatedFieldNames.DATA_SHARED_FLAGS_ID);
|
||||||
|
dataSharedFlagsId.setAccessible(true);
|
||||||
|
DATA_SHARED_FLAGS_ID = forceCast(dataSharedFlagsId.get(null));
|
||||||
|
final Field dataCustomNameField = Entity.class.getDeclaredField(ObfuscatedFieldNames.DATA_CUSTOM_NAME);
|
||||||
|
dataCustomNameField.setAccessible(true);
|
||||||
|
DATA_CUSTOM_NAME = forceCast(dataCustomNameField.get(null));
|
||||||
|
final Field dataCustomNameVisibleField = Entity.class.getDeclaredField(ObfuscatedFieldNames.DATA_CUSTOM_NAME_VISIBLE);
|
||||||
|
dataCustomNameVisibleField.setAccessible(true);
|
||||||
|
DATA_CUSTOM_NAME_VISIBLE = forceCast(dataCustomNameVisibleField.get(null));
|
||||||
|
} catch (ReflectiveOperationException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public FakeArmorStandImpl() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void sendData(String name, Iterable<Player> receivers) {
|
||||||
|
sendData(receivers, name);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected EntityType<?> getEntityType() {
|
||||||
|
return EntityType.ARMOR_STAND;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected float getSpawnOffSet() {
|
||||||
|
return MARKER_ARMOR_STAND_OFFSET;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getDataItemCount() {
|
||||||
|
return 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void addSpecificData(List<SynchedEntityData.DataValue<?>> packedItems, String name) {
|
||||||
|
packedItems.add(SynchedEntityData.DataValue.create(DATA_SHARED_FLAGS_ID, INVISIBLE_FLAG));
|
||||||
|
packedItems.add(SynchedEntityData.DataValue.create(DATA_CUSTOM_NAME, Optional.ofNullable(
|
||||||
|
CraftChatMessage.fromStringOrNull(name)
|
||||||
|
)));
|
||||||
|
packedItems.add(SynchedEntityData.DataValue.create(DATA_CUSTOM_NAME_VISIBLE, true));
|
||||||
|
packedItems.add(SynchedEntityData.DataValue.create(ArmorStand.DATA_CLIENT_FLAGS, MARKER_FLAG));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setLocation(Location location, Iterable<Player> receivers) {
|
||||||
|
final FriendlyByteBuf buffer = new FriendlyByteBuf(Unpooled.buffer());
|
||||||
|
buffer.writeVarInt(entityId);
|
||||||
|
buffer.writeDouble(location.getX());
|
||||||
|
buffer.writeDouble(location.getY() + MARKER_ARMOR_STAND_OFFSET);
|
||||||
|
buffer.writeDouble(location.getZ());
|
||||||
|
buffer.writeByte(0);
|
||||||
|
buffer.writeByte(0);
|
||||||
|
buffer.writeBoolean(false);
|
||||||
|
final ClientboundTeleportEntityPacket positionPacket = ClientboundTeleportEntityPacket.STREAM_CODEC.decode(buffer);
|
||||||
|
sendPacket(positionPacket, receivers);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,115 @@
|
|||||||
|
package de.epiceric.shopchest.nms.v1_20_R3;
|
||||||
|
|
||||||
|
import de.epiceric.shopchest.nms.FakeEntity;
|
||||||
|
import net.minecraft.network.protocol.Packet;
|
||||||
|
import net.minecraft.network.protocol.game.ClientboundAddEntityPacket;
|
||||||
|
import net.minecraft.network.protocol.game.ClientboundRemoveEntitiesPacket;
|
||||||
|
import net.minecraft.network.protocol.game.ClientboundSetEntityDataPacket;
|
||||||
|
import net.minecraft.network.syncher.EntityDataAccessor;
|
||||||
|
import net.minecraft.network.syncher.SynchedEntityData;
|
||||||
|
import net.minecraft.world.entity.Entity;
|
||||||
|
import net.minecraft.world.entity.EntityType;
|
||||||
|
import net.minecraft.world.phys.Vec3;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.craftbukkit.v1_20_R4.entity.CraftPlayer;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
|
public abstract class FakeEntityImpl<T> implements FakeEntity {
|
||||||
|
|
||||||
|
private final static AtomicInteger ENTITY_COUNTER;
|
||||||
|
private final static EntityDataAccessor<Boolean> DATA_NO_GRAVITY;
|
||||||
|
private final static EntityDataAccessor<Boolean> DATA_SILENT;
|
||||||
|
|
||||||
|
static {
|
||||||
|
try {
|
||||||
|
final Field entityCounterField = Entity.class.getDeclaredField(ObfuscatedFieldNames.ENTITY_COUNTER);
|
||||||
|
entityCounterField.setAccessible(true);
|
||||||
|
ENTITY_COUNTER = (AtomicInteger) entityCounterField.get(null);
|
||||||
|
final Field dataNoGravityField = Entity.class.getDeclaredField(ObfuscatedFieldNames.DATA_NO_GRAVITY);
|
||||||
|
dataNoGravityField.setAccessible(true);
|
||||||
|
DATA_NO_GRAVITY = forceCast(dataNoGravityField.get(null));
|
||||||
|
final Field dataSilentField = Entity.class.getDeclaredField(ObfuscatedFieldNames.DATA_SILENT);
|
||||||
|
dataSilentField.setAccessible(true);
|
||||||
|
DATA_SILENT = forceCast(dataSilentField.get(null));
|
||||||
|
} catch (ReflectiveOperationException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected final int entityId;
|
||||||
|
|
||||||
|
public FakeEntityImpl() {
|
||||||
|
entityId = ENTITY_COUNTER.incrementAndGet();
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
protected static <T> T forceCast(Object o) {
|
||||||
|
return (T) o;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getEntityId() {
|
||||||
|
return entityId;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void sendPacket(Packet<?> packet, Iterable<Player> receivers) {
|
||||||
|
for (Player receiver : receivers) {
|
||||||
|
((CraftPlayer) receiver).getHandle().connection.send(packet);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void spawn(UUID uuid, Location location, Iterable<Player> receivers) {
|
||||||
|
final ClientboundAddEntityPacket spawnPacket = new ClientboundAddEntityPacket(
|
||||||
|
entityId,
|
||||||
|
uuid,
|
||||||
|
location.getX(),
|
||||||
|
location.getY() + getSpawnOffSet(),
|
||||||
|
location.getZ(),
|
||||||
|
0f,
|
||||||
|
0f,
|
||||||
|
getEntityType(),
|
||||||
|
0,
|
||||||
|
Vec3.ZERO,
|
||||||
|
0d
|
||||||
|
);
|
||||||
|
sendPacket(spawnPacket, receivers);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void remove(Iterable<Player> receivers) {
|
||||||
|
final ClientboundRemoveEntitiesPacket removePacket = new ClientboundRemoveEntitiesPacket(entityId);
|
||||||
|
sendPacket(removePacket, receivers);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void sendData(Iterable<Player> receivers, T data) {
|
||||||
|
// Create packet
|
||||||
|
final List<SynchedEntityData.DataValue<?>> packedItems = new LinkedList<>();
|
||||||
|
final ClientboundSetEntityDataPacket dataPacket = new ClientboundSetEntityDataPacket(entityId, packedItems);
|
||||||
|
|
||||||
|
// Setup data
|
||||||
|
packedItems.add(SynchedEntityData.DataValue.create(DATA_NO_GRAVITY, true));
|
||||||
|
packedItems.add(SynchedEntityData.DataValue.create(DATA_SILENT, true));
|
||||||
|
addSpecificData(packedItems, data);
|
||||||
|
|
||||||
|
// Send packet
|
||||||
|
sendPacket(dataPacket, receivers);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected abstract EntityType<?> getEntityType();
|
||||||
|
|
||||||
|
protected float getSpawnOffSet() {
|
||||||
|
return 0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected abstract int getDataItemCount();
|
||||||
|
|
||||||
|
protected abstract void addSpecificData(List<SynchedEntityData.DataValue<?>> packedItems, T data);
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,60 @@
|
|||||||
|
package de.epiceric.shopchest.nms.v1_20_R3;
|
||||||
|
|
||||||
|
import de.epiceric.shopchest.nms.FakeItem;
|
||||||
|
import net.minecraft.network.protocol.game.ClientboundSetEntityMotionPacket;
|
||||||
|
import net.minecraft.network.syncher.EntityDataAccessor;
|
||||||
|
import net.minecraft.network.syncher.SynchedEntityData;
|
||||||
|
import net.minecraft.world.entity.EntityType;
|
||||||
|
import net.minecraft.world.entity.item.ItemEntity;
|
||||||
|
import net.minecraft.world.phys.Vec3;
|
||||||
|
import org.bukkit.craftbukkit.v1_20_R4.inventory.CraftItemStack;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class FakeItemImpl extends FakeEntityImpl<ItemStack> implements FakeItem {
|
||||||
|
|
||||||
|
private final static EntityDataAccessor<net.minecraft.world.item.ItemStack> DATA_ITEM;
|
||||||
|
|
||||||
|
static {
|
||||||
|
try {
|
||||||
|
final Field dataItemField = ItemEntity.class.getDeclaredField(ObfuscatedFieldNames.DATA_ITEM);
|
||||||
|
dataItemField.setAccessible(true);
|
||||||
|
DATA_ITEM = forceCast(dataItemField.get(null));
|
||||||
|
} catch (ReflectiveOperationException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public FakeItemImpl() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void sendData(ItemStack item, Iterable<Player> receivers) {
|
||||||
|
sendData(receivers, item);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void resetVelocity(Iterable<Player> receivers) {
|
||||||
|
final ClientboundSetEntityMotionPacket velocityPacket = new ClientboundSetEntityMotionPacket(entityId, Vec3.ZERO);
|
||||||
|
sendPacket(velocityPacket, receivers);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected EntityType<?> getEntityType() {
|
||||||
|
return EntityType.ITEM;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getDataItemCount() {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void addSpecificData(List<SynchedEntityData.DataValue<?>> packedItems, ItemStack data) {
|
||||||
|
packedItems.add(SynchedEntityData.DataValue.create(DATA_ITEM, CraftItemStack.asNMSCopy(data)));
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
package de.epiceric.shopchest.nms.v1_20_R3;
|
||||||
|
|
||||||
|
public class ObfuscatedFieldNames {
|
||||||
|
|
||||||
|
// Entity
|
||||||
|
public static final String ENTITY_COUNTER = "c";
|
||||||
|
public static final String DATA_NO_GRAVITY = "aV";
|
||||||
|
public static final String DATA_SILENT = "aU";
|
||||||
|
public static final String DATA_SHARED_FLAGS_ID = "ap";
|
||||||
|
public static final String DATA_CUSTOM_NAME = "aS";
|
||||||
|
public static final String DATA_CUSTOM_NAME_VISIBLE = "aT";
|
||||||
|
// ItemEntity
|
||||||
|
public static final String DATA_ITEM = "d";
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
package de.epiceric.shopchest.nms.v1_20_R3;
|
||||||
|
|
||||||
|
import de.epiceric.shopchest.nms.FakeArmorStand;
|
||||||
|
import de.epiceric.shopchest.nms.FakeItem;
|
||||||
|
import de.epiceric.shopchest.nms.Platform;
|
||||||
|
import de.epiceric.shopchest.nms.TextComponentHelper;
|
||||||
|
|
||||||
|
public class PlatformImpl implements Platform {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FakeArmorStand createFakeArmorStand() {
|
||||||
|
return new FakeArmorStandImpl();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FakeItem createFakeItem() {
|
||||||
|
return new FakeItemImpl();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -97,6 +97,8 @@ public class PlatformLoader {
|
|||||||
return new de.epiceric.shopchest.nms.v1_20_R2.PlatformImpl();
|
return new de.epiceric.shopchest.nms.v1_20_R2.PlatformImpl();
|
||||||
case "60a2bb6bf2684dc61c56b90d7c41bddc": //1.20.4 (1.20.3 virtually does not exist)
|
case "60a2bb6bf2684dc61c56b90d7c41bddc": //1.20.4 (1.20.3 virtually does not exist)
|
||||||
return new de.epiceric.shopchest.nms.v1_20_R3.PlatformImpl();
|
return new de.epiceric.shopchest.nms.v1_20_R3.PlatformImpl();
|
||||||
|
case "ad1a88fd7eaf2277f2507bf34d7b994c": // 1.20.5
|
||||||
|
return new de.epiceric.shopchest.nms.v1_20_R4.PlatformImpl();
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
4
pom.xml
4
pom.xml
@ -123,7 +123,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.spigotmc</groupId>
|
<groupId>org.spigotmc</groupId>
|
||||||
<artifactId>spigot-api</artifactId>
|
<artifactId>spigot-api</artifactId>
|
||||||
<version>1.20.1-R0.1-SNAPSHOT</version>
|
<version>1.20.5-R0.1-SNAPSHOT</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
@ -433,7 +433,7 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>net.md-5</groupId>
|
<groupId>net.md-5</groupId>
|
||||||
<artifactId>specialsource-maven-plugin</artifactId>
|
<artifactId>specialsource-maven-plugin</artifactId>
|
||||||
<version>1.2.4</version>
|
<version>2.0.3</version>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<artifactId>maven-assembly-plugin</artifactId>
|
<artifactId>maven-assembly-plugin</artifactId>
|
||||||
|
Loading…
Reference in New Issue
Block a user