Skip to content

Commit

Permalink
md_5 thought it would be funny to bump _R2 to _R3 and then reverse it…
Browse files Browse the repository at this point in the history
… back to R2 a few hours later
  • Loading branch information
mcmonkey4eva committed Nov 3, 2020
1 parent 1b62b2b commit f80bb65
Show file tree
Hide file tree
Showing 41 changed files with 169 additions and 167 deletions.
2 changes: 1 addition & 1 deletion paper/pom.xml
Expand Up @@ -29,7 +29,7 @@
<dependency>
<groupId>com.destroystokyo.paper</groupId>
<artifactId>paper-api</artifactId>
<version>1.16.3-R0.1-SNAPSHOT</version>
<version>1.16.4-R0.1-SNAPSHOT</version>
<scope>provided</scope>
<exclusions>
<exclusion>
Expand Down
Expand Up @@ -55,6 +55,8 @@ public AttachCommand() {
//
// Optionally specify 'no_rotate' to retain the attached entity's own rotation and ignore the target rotation.
//
// Note that attaches involving a player will not be properly visible to that player, but will still be visible to *other* players.
//
// @Tags
// None.
//
Expand Down
Expand Up @@ -27,16 +27,16 @@
import net.md_5.bungee.api.chat.hover.content.Item;
import net.md_5.bungee.api.chat.hover.content.Text;
import net.md_5.bungee.chat.ComponentSerializer;
import net.minecraft.server.v1_16_R3.*;
import net.minecraft.server.v1_16_R2.*;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.block.Biome;
import org.bukkit.craftbukkit.v1_16_R3.CraftServer;
import org.bukkit.craftbukkit.v1_16_R3.entity.CraftPlayer;
import org.bukkit.craftbukkit.v1_16_R3.inventory.CraftInventory;
import org.bukkit.craftbukkit.v1_16_R3.inventory.CraftInventoryCustom;
import org.bukkit.craftbukkit.v1_16_R3.util.CraftChatMessage;
import org.bukkit.craftbukkit.v1_16_R3.util.CraftMagicNumbers;
import org.bukkit.craftbukkit.v1_16_R2.CraftServer;
import org.bukkit.craftbukkit.v1_16_R2.entity.CraftPlayer;
import org.bukkit.craftbukkit.v1_16_R2.inventory.CraftInventory;
import org.bukkit.craftbukkit.v1_16_R2.inventory.CraftInventoryCustom;
import org.bukkit.craftbukkit.v1_16_R2.util.CraftChatMessage;
import org.bukkit.craftbukkit.v1_16_R2.util.CraftMagicNumbers;
import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
Expand Down
Expand Up @@ -4,12 +4,12 @@
import com.denizenscript.denizencore.utilities.ReflectionHelper;
import com.denizenscript.denizen.nms.v1_16.Handler;
import com.denizenscript.denizen.utilities.FormattedTextHelper;
import net.minecraft.server.v1_16_R3.*;
import net.minecraft.server.v1_16_R2.*;
import org.bukkit.Bukkit;
import org.bukkit.NamespacedKey;
import org.bukkit.craftbukkit.v1_16_R3.CraftServer;
import org.bukkit.craftbukkit.v1_16_R3.entity.CraftPlayer;
import org.bukkit.craftbukkit.v1_16_R3.inventory.CraftItemStack;
import org.bukkit.craftbukkit.v1_16_R2.CraftServer;
import org.bukkit.craftbukkit.v1_16_R2.entity.CraftPlayer;
import org.bukkit.craftbukkit.v1_16_R2.inventory.CraftItemStack;
import org.bukkit.entity.Player;

import java.util.Collections;
Expand Down
@@ -1,9 +1,9 @@
package com.denizenscript.denizen.nms.v1_16.helpers;

import com.denizenscript.denizen.nms.abstracts.AnimationHelper;
import org.bukkit.craftbukkit.v1_16_R3.entity.CraftHorse;
import org.bukkit.craftbukkit.v1_16_R3.entity.CraftPolarBear;
import org.bukkit.craftbukkit.v1_16_R3.entity.CraftSkeleton;
import org.bukkit.craftbukkit.v1_16_R2.entity.CraftHorse;
import org.bukkit.craftbukkit.v1_16_R2.entity.CraftPolarBear;
import org.bukkit.craftbukkit.v1_16_R2.entity.CraftSkeleton;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Horse;

Expand Down
Expand Up @@ -11,18 +11,18 @@
import com.denizenscript.denizencore.utilities.ReflectionHelper;
import com.denizenscript.denizen.nms.util.jnbt.CompoundTag;
import com.denizenscript.denizencore.utilities.debugging.Debug;
import net.minecraft.server.v1_16_R3.*;
import net.minecraft.server.v1_16_R2.*;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.Skull;
import org.bukkit.craftbukkit.v1_16_R3.CraftWorld;
import org.bukkit.craftbukkit.v1_16_R3.block.CraftBlockEntityState;
import org.bukkit.craftbukkit.v1_16_R3.block.CraftBlockState;
import org.bukkit.craftbukkit.v1_16_R3.block.CraftSkull;
import org.bukkit.craftbukkit.v1_16_R3.block.data.CraftBlockData;
import org.bukkit.craftbukkit.v1_16_R3.inventory.CraftItemStack;
import org.bukkit.craftbukkit.v1_16_R3.util.CraftMagicNumbers;
import org.bukkit.craftbukkit.v1_16_R2.CraftWorld;
import org.bukkit.craftbukkit.v1_16_R2.block.CraftBlockEntityState;
import org.bukkit.craftbukkit.v1_16_R2.block.CraftBlockState;
import org.bukkit.craftbukkit.v1_16_R2.block.CraftSkull;
import org.bukkit.craftbukkit.v1_16_R2.block.data.CraftBlockData;
import org.bukkit.craftbukkit.v1_16_R2.inventory.CraftItemStack;
import org.bukkit.craftbukkit.v1_16_R2.util.CraftMagicNumbers;
import org.bukkit.event.world.PortalCreateEvent;

import java.lang.invoke.MethodHandle;
Expand Down Expand Up @@ -118,7 +118,7 @@ public void setNbtData(Block block, CompoundTag ctag) {
te.load(((CraftBlockData) block.getBlockData()).getState(), ((CompoundTagImpl) ctag).toNMSTag());
}

private static net.minecraft.server.v1_16_R3.Block getBlockFrom(Material material) {
private static net.minecraft.server.v1_16_R2.Block getBlockFrom(Material material) {
if (material == Material.FLOWER_POT) {
return Blocks.FLOWER_POT;
}
Expand All @@ -140,42 +140,42 @@ public boolean hasBlock(Material material) {

@Override
public boolean setBlockResistance(Material material, float resistance) {
net.minecraft.server.v1_16_R3.Block block = getBlockFrom(material);
net.minecraft.server.v1_16_R2.Block block = getBlockFrom(material);
if (block == null) {
return false;
}
// protected final float durability;
ReflectionHelper.setFieldValue(net.minecraft.server.v1_16_R3.BlockBase.class, "durability", block, resistance);
ReflectionHelper.setFieldValue(net.minecraft.server.v1_16_R2.BlockBase.class, "durability", block, resistance);
return true;
}

@Override
public float getBlockResistance(Material material) {
net.minecraft.server.v1_16_R3.Block block = getBlockFrom(material);
net.minecraft.server.v1_16_R2.Block block = getBlockFrom(material);
if (block == null) {
return 0;
}
return ReflectionHelper.getFieldValue(net.minecraft.server.v1_16_R3.BlockBase.class, "durability", block);
return ReflectionHelper.getFieldValue(net.minecraft.server.v1_16_R2.BlockBase.class, "durability", block);
}

@Override
public org.bukkit.block.BlockState generateBlockState(Material mat) {
return new CraftBlockState(mat);
}

public static final Field BLOCK_MATERIAL = ReflectionHelper.getFields(net.minecraft.server.v1_16_R3.BlockBase.class).get("material");
public static final Field BLOCK_MATERIAL = ReflectionHelper.getFields(net.minecraft.server.v1_16_R2.BlockBase.class).get("material");

public static final MethodHandle MATERIAL_PUSH_REACTION_SETTER = ReflectionHelper.getFinalSetter(net.minecraft.server.v1_16_R3.Material.class, "S");
public static final MethodHandle MATERIAL_PUSH_REACTION_SETTER = ReflectionHelper.getFinalSetter(net.minecraft.server.v1_16_R2.Material.class, "S");

public static final MethodHandle BLOCK_STRENGTH_SETTER = ReflectionHelper.getFinalSetter(net.minecraft.server.v1_16_R3.BlockBase.BlockData.class, "strength");
public static final MethodHandle BLOCK_STRENGTH_SETTER = ReflectionHelper.getFinalSetter(net.minecraft.server.v1_16_R2.BlockBase.BlockData.class, "strength");

public net.minecraft.server.v1_16_R3.Block getMaterialBlock(Material bukkitMaterial) {
public net.minecraft.server.v1_16_R2.Block getMaterialBlock(Material bukkitMaterial) {
return ((CraftBlockData) bukkitMaterial.createBlockData()).getState().getBlock();
}

public net.minecraft.server.v1_16_R3.Material getInternalMaterial(Material bukkitMaterial) {
public net.minecraft.server.v1_16_R2.Material getInternalMaterial(Material bukkitMaterial) {
try {
return (net.minecraft.server.v1_16_R3.Material) BLOCK_MATERIAL.get(getMaterialBlock(bukkitMaterial));
return (net.minecraft.server.v1_16_R2.Material) BLOCK_MATERIAL.get(getMaterialBlock(bukkitMaterial));
}
catch (Throwable ex) {
Debug.echoError(ex);
Expand Down
Expand Up @@ -4,11 +4,11 @@
import com.denizenscript.denizen.nms.interfaces.ChunkHelper;
import com.denizenscript.denizencore.utilities.ReflectionHelper;
import com.denizenscript.denizencore.utilities.debugging.Debug;
import net.minecraft.server.v1_16_R3.*;
import net.minecraft.server.v1_16_R2.*;
import org.bukkit.World;
import org.bukkit.Chunk;
import org.bukkit.craftbukkit.v1_16_R3.CraftChunk;
import org.bukkit.craftbukkit.v1_16_R3.CraftWorld;
import org.bukkit.craftbukkit.v1_16_R2.CraftChunk;
import org.bukkit.craftbukkit.v1_16_R2.CraftWorld;

import java.lang.invoke.MethodHandle;
import java.lang.reflect.Field;
Expand All @@ -23,8 +23,8 @@ public class ChunkHelperImpl implements ChunkHelper {
static {
chunkProviderServerThreadField = ReflectionHelper.getFields(ChunkProviderServer.class).get("serverThread");
chunkProviderServerThreadFieldSetter = ReflectionHelper.getFinalSetter(ChunkProviderServer.class, "serverThread");
worldThreadField = ReflectionHelper.getFields(net.minecraft.server.v1_16_R3.World.class).get("serverThread");
worldThreadFieldSetter = ReflectionHelper.getFinalSetter(net.minecraft.server.v1_16_R3.World.class, "serverThread");
worldThreadField = ReflectionHelper.getFields(net.minecraft.server.v1_16_R2.World.class).get("serverThread");
worldThreadFieldSetter = ReflectionHelper.getFinalSetter(net.minecraft.server.v1_16_R2.World.class, "serverThread");
}

public Thread resetServerThread;
Expand Down
Expand Up @@ -13,13 +13,13 @@
import com.denizenscript.denizen.nms.interfaces.ItemProjectile;
import com.denizenscript.denizen.nms.util.PlayerProfile;
import com.denizenscript.denizencore.utilities.debugging.Debug;
import net.minecraft.server.v1_16_R3.PlayerInteractManager;
import net.minecraft.server.v1_16_R3.WorldServer;
import net.minecraft.server.v1_16_R2.PlayerInteractManager;
import net.minecraft.server.v1_16_R2.WorldServer;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_16_R3.CraftWorld;
import org.bukkit.craftbukkit.v1_16_R3.inventory.CraftItemStack;
import org.bukkit.craftbukkit.v1_16_R2.CraftWorld;
import org.bukkit.craftbukkit.v1_16_R2.inventory.CraftItemStack;
import org.bukkit.inventory.ItemStack;
import org.bukkit.scoreboard.Scoreboard;
import org.bukkit.scoreboard.Team;
Expand Down
Expand Up @@ -10,17 +10,17 @@
import com.denizenscript.denizen.utilities.DenizenAPI;
import com.denizenscript.denizen.utilities.Utilities;
import com.denizenscript.denizen.utilities.debugging.Debug;
import net.minecraft.server.v1_16_R3.*;
import net.minecraft.server.v1_16_R2.*;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.attribute.Attribute;
import org.bukkit.attribute.AttributeInstance;
import org.bukkit.block.BlockFace;
import org.bukkit.craftbukkit.v1_16_R3.CraftWorld;
import org.bukkit.craftbukkit.v1_16_R3.block.CraftBlock;
import org.bukkit.craftbukkit.v1_16_R3.entity.*;
import org.bukkit.craftbukkit.v1_16_R3.inventory.CraftItemStack;
import org.bukkit.craftbukkit.v1_16_R2.CraftWorld;
import org.bukkit.craftbukkit.v1_16_R2.block.CraftBlock;
import org.bukkit.craftbukkit.v1_16_R2.entity.*;
import org.bukkit.craftbukkit.v1_16_R2.inventory.CraftItemStack;
import org.bukkit.entity.*;
import org.bukkit.entity.Entity;
import org.bukkit.event.entity.EntityTargetEvent;
Expand All @@ -38,9 +38,9 @@ public class EntityHelperImpl extends EntityHelper {

public static final Field RECIPE_BOOK_DISCOVERED_SET = ReflectionHelper.getFields(RecipeBook.class).get("recipes");

public static final MethodHandle ENTITY_SETPOSE = ReflectionHelper.getMethodHandle(net.minecraft.server.v1_16_R3.Entity.class, "setPose", EntityPose.class);
public static final MethodHandle ENTITY_SETPOSE = ReflectionHelper.getMethodHandle(net.minecraft.server.v1_16_R2.Entity.class, "setPose", EntityPose.class);

public static final MethodHandle ENTITY_ONGROUND_SETTER = ReflectionHelper.getFinalSetter(net.minecraft.server.v1_16_R3.Entity.class, "onGround");
public static final MethodHandle ENTITY_ONGROUND_SETTER = ReflectionHelper.getFinalSetter(net.minecraft.server.v1_16_R2.Entity.class, "onGround");

@Override
public double getAbsorption(LivingEntity entity) {
Expand Down Expand Up @@ -92,7 +92,7 @@ public double getDamageTo(LivingEntity attacker, Entity target) {
else {
source = DamageSource.mobAttack(((CraftLivingEntity) attacker).getHandle());
}
net.minecraft.server.v1_16_R3.Entity nmsTarget = ((CraftEntity) target).getHandle();
net.minecraft.server.v1_16_R2.Entity nmsTarget = ((CraftEntity) target).getHandle();
if (nmsTarget.isInvulnerable(source)) {
return 0;
}
Expand Down Expand Up @@ -196,7 +196,7 @@ public void forceInteraction(Player player, Location location) {

@Override
public Entity getEntity(World world, UUID uuid) {
net.minecraft.server.v1_16_R3.Entity entity = ((CraftWorld) world).getHandle().getEntity(uuid);
net.minecraft.server.v1_16_R2.Entity entity = ((CraftWorld) world).getHandle().getEntity(uuid);
return entity == null ? null : entity.getBukkitEntity();
}

Expand Down Expand Up @@ -238,7 +238,7 @@ public void stopFollowing(Entity follower) {

@Override
public void stopWalking(Entity entity) {
net.minecraft.server.v1_16_R3.Entity nmsEntity = ((CraftEntity) entity).getHandle();
net.minecraft.server.v1_16_R2.Entity nmsEntity = ((CraftEntity) entity).getHandle();
if (!(nmsEntity instanceof EntityInsentient)) {
return;
}
Expand All @@ -247,7 +247,7 @@ public void stopWalking(Entity entity) {

@Override
public double getSpeed(Entity entity) {
net.minecraft.server.v1_16_R3.Entity nmsEntityEntity = ((CraftEntity) entity).getHandle();
net.minecraft.server.v1_16_R2.Entity nmsEntityEntity = ((CraftEntity) entity).getHandle();
if (!(nmsEntityEntity instanceof EntityInsentient)) {
return 0.0;
}
Expand All @@ -257,7 +257,7 @@ public double getSpeed(Entity entity) {

@Override
public void setSpeed(Entity entity, double speed) {
net.minecraft.server.v1_16_R3.Entity nmsEntityEntity = ((CraftEntity) entity).getHandle();
net.minecraft.server.v1_16_R2.Entity nmsEntityEntity = ((CraftEntity) entity).getHandle();
if (!(nmsEntityEntity instanceof EntityInsentient)) {
return;
}
Expand All @@ -272,7 +272,7 @@ public void follow(final Entity target, final Entity follower, final double spee
return;
}

final net.minecraft.server.v1_16_R3.Entity nmsEntityFollower = ((CraftEntity) follower).getHandle();
final net.minecraft.server.v1_16_R2.Entity nmsEntityFollower = ((CraftEntity) follower).getHandle();
if (!(nmsEntityFollower instanceof EntityInsentient)) {
return;
}
Expand Down Expand Up @@ -338,7 +338,7 @@ public void walkTo(final LivingEntity entity, Location location, double speed, f
return;
}

net.minecraft.server.v1_16_R3.Entity nmsEntityEntity = ((CraftEntity) entity).getHandle();
net.minecraft.server.v1_16_R2.Entity nmsEntityEntity = ((CraftEntity) entity).getHandle();
if (!(nmsEntityEntity instanceof EntityInsentient)) {
return;
}
Expand Down Expand Up @@ -424,7 +424,7 @@ public void sendHidePacket(Player pl, Entity entity) {
EntityPlayer entityPlayer = craftPlayer.getHandle();
if (entityPlayer.playerConnection != null && !craftPlayer.equals(entity)) {
PlayerChunkMap tracker = ((WorldServer) craftPlayer.getHandle().world).getChunkProvider().playerChunkMap;
net.minecraft.server.v1_16_R3.Entity other = ((CraftEntity) entity).getHandle();
net.minecraft.server.v1_16_R2.Entity other = ((CraftEntity) entity).getHandle();
PlayerChunkMap.EntityTracker entry = tracker.trackedEntities.get(other.getId());
if (entry != null) {
entry.clear(entityPlayer);
Expand All @@ -445,7 +445,7 @@ public void sendShowPacket(Player pl, Entity entity) {
EntityPlayer entityPlayer = craftPlayer.getHandle();
if (entityPlayer.playerConnection != null && !craftPlayer.equals(entity)) {
PlayerChunkMap tracker = ((WorldServer) craftPlayer.getHandle().world).getChunkProvider().playerChunkMap;
net.minecraft.server.v1_16_R3.Entity other = ((CraftEntity) entity).getHandle();
net.minecraft.server.v1_16_R2.Entity other = ((CraftEntity) entity).getHandle();
PlayerChunkMap.EntityTracker entry = tracker.trackedEntities.get(other.getId());
if (entry != null) {
entry.clear(entityPlayer);
Expand All @@ -471,21 +471,21 @@ else if (entity instanceof LivingEntity) {
look(entity, yaw, pitch);
}
else {
net.minecraft.server.v1_16_R3.Entity handle = ((CraftEntity) entity).getHandle();
net.minecraft.server.v1_16_R2.Entity handle = ((CraftEntity) entity).getHandle();
handle.yaw = yaw;
handle.pitch = pitch;
}
}

@Override
public float getBaseYaw(Entity entity) {
net.minecraft.server.v1_16_R3.Entity handle = ((CraftEntity) entity).getHandle();
net.minecraft.server.v1_16_R2.Entity handle = ((CraftEntity) entity).getHandle();
return ((EntityLiving) handle).aD;
}

@Override
public void look(Entity entity, float yaw, float pitch) {
net.minecraft.server.v1_16_R3.Entity handle = ((CraftEntity) entity).getHandle();
net.minecraft.server.v1_16_R2.Entity handle = ((CraftEntity) entity).getHandle();
if (handle != null) {
handle.yaw = yaw;
if (handle instanceof EntityLiving) {
Expand Down
@@ -1,12 +1,12 @@
package com.denizenscript.denizen.nms.v1_16.helpers;

import com.denizenscript.denizen.nms.interfaces.FishingHelper;
import net.minecraft.server.v1_16_R3.*;
import net.minecraft.server.v1_16_R2.*;
import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_16_R3.CraftWorld;
import org.bukkit.craftbukkit.v1_16_R3.entity.CraftFishHook;
import org.bukkit.craftbukkit.v1_16_R3.entity.CraftPlayer;
import org.bukkit.craftbukkit.v1_16_R3.inventory.CraftItemStack;
import org.bukkit.craftbukkit.v1_16_R2.CraftWorld;
import org.bukkit.craftbukkit.v1_16_R2.entity.CraftFishHook;
import org.bukkit.craftbukkit.v1_16_R2.entity.CraftPlayer;
import org.bukkit.craftbukkit.v1_16_R2.inventory.CraftItemStack;
import org.bukkit.entity.FishHook;
import org.bukkit.entity.Player;

Expand Down

0 comments on commit f80bb65

Please sign in to comment.