forked from SteamWar/SteamWar
Fix REntity for 1.15.2-1.21.3
<1.15.2: Untested
This commit is contained in:
@@ -21,9 +21,7 @@ package de.steamwar.bausystem.utils;
|
||||
|
||||
import com.comphenix.tinyprotocol.Reflection;
|
||||
import de.steamwar.bausystem.features.util.NoClipCommand;
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.core.component.DataComponents;
|
||||
import net.minecraft.core.particles.ParticleParam;
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
@@ -36,8 +34,6 @@ import net.minecraft.world.entity.player.EntityHuman;
|
||||
import net.minecraft.world.entity.player.PlayerAbilities;
|
||||
import net.minecraft.world.item.component.CustomData;
|
||||
import net.minecraft.world.level.EnumGamemode;
|
||||
import net.minecraft.world.level.Explosion;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.craftbukkit.v1_21_R2.entity.CraftPlayer;
|
||||
@@ -45,7 +41,6 @@ import org.bukkit.craftbukkit.v1_21_R2.inventory.CraftItemStack;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
public class NMSWrapper21 implements NMSWrapper {
|
||||
@@ -132,12 +127,15 @@ public class NMSWrapper21 implements NMSWrapper {
|
||||
return invalid;
|
||||
}
|
||||
|
||||
private final Class<?> explosionPacket = Reflection.getClass("{nms.network.protocol.game}.PacketPlayOutExplosion");
|
||||
private final Reflection.FieldAccessor<Optional> explosionKnockback = Reflection.getField(explosionPacket, Optional.class, 0);
|
||||
|
||||
@Override
|
||||
public Object resetExplosionKnockback(Object packet) {
|
||||
explosionKnockback.set(packet, Optional.empty());
|
||||
return packet;
|
||||
PacketPlayOutExplosion explosion = (PacketPlayOutExplosion) packet;
|
||||
|
||||
return new PacketPlayOutExplosion(
|
||||
explosion.b(),
|
||||
Optional.empty(),
|
||||
explosion.f(),
|
||||
explosion.g()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user