Skip to content

Commit

Permalink
1.19
Browse files Browse the repository at this point in the history
  • Loading branch information
jrbudda committed Jul 16, 2022
1 parent cb15d2b commit 3aa554e
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 21 deletions.
4 changes: 2 additions & 2 deletions plugin.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Vivecraft-Spigot-Extensions
version: '1.18.2-1'
api-version: 1.18
version: '1.19-1'
api-version: 1.19
main: org.vivecraft.VSE
website: http://www.vivecraft.org/
author: jrbudda, jaron780
Expand Down
6 changes: 3 additions & 3 deletions src/org/vivecraft/Reflector.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
import net.minecraft.world.entity.monster.EnderMan;

public class Reflector {
//last checked 1.18.2
//last checked 1.19
public static Field Entity_Data_Pose= getPrivateField("ad", Entity.class);
public static Field Entity_eyesHeight = getPrivateField("ba", Entity.class);
public static Field Entity_eyeHeight = getPrivateField("ba", Entity.class);
public static Field SynchedEntityData_itemsById = getPrivateField("f", SynchedEntityData.class);
public static Field availableGoals = getPrivateField("d", GoalSelector.class);
public static Field aboveGroundCount = getPrivateField("C", ServerGamePacketListenerImpl.class);
public static Field aboveGroundTickCount = getPrivateField("F", ServerGamePacketListenerImpl.class);

public static Method Entity_teleport= getPrivateMethod("t", EnderMan.class);
public static Method Entity_teleportTowards = getPrivateMethod("a", EnderMan.class, Entity.class);
Expand Down
15 changes: 8 additions & 7 deletions src/org/vivecraft/VSE.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
import org.bukkit.World;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.craftbukkit.v1_18_R2.entity.CraftCreeper;
import org.bukkit.craftbukkit.v1_18_R2.entity.CraftEnderman;
import org.bukkit.craftbukkit.v1_18_R2.entity.CraftPlayer;
import org.bukkit.craftbukkit.v1_18_R2.inventory.CraftItemStack;
import org.bukkit.craftbukkit.v1_19_R1.entity.CraftCreeper;
import org.bukkit.craftbukkit.v1_19_R1.entity.CraftEnderman;
import org.bukkit.craftbukkit.v1_19_R1.entity.CraftPlayer;
import org.bukkit.craftbukkit.v1_19_R1.inventory.CraftItemStack;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
Expand Down Expand Up @@ -53,9 +53,10 @@
import org.vivecraft.utils.Headshot;
import org.vivecraft.utils.MetadataHelper;

import net.md_5.bungee.api.chat.TranslatableComponent;
import net.milkbowl.vault.permission.Permission;
import net.minecraft.network.Connection;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.Mob;
import net.minecraft.world.entity.ai.goal.WrappedGoal;
Expand All @@ -66,7 +67,7 @@ public class VSE extends JavaPlugin implements Listener {
FileConfiguration config = getConfig();

public final static String CHANNEL = "vivecraft:data";
private final static String readurl = "https://raw.githubusercontent.com/jrbudda/Vivecraft_Spigot_Extensions/1.18/version.txt";
private final static String readurl = "https://raw.githubusercontent.com/jrbudda/Vivecraft_Spigot_Extensions/1.19/version.txt";
private final static int bStatsId = 6931;

public static Map<UUID, VivePlayer> vivePlayers = new HashMap<UUID, VivePlayer>();
Expand Down Expand Up @@ -199,7 +200,7 @@ public void run() {

public static ItemStack setLocalizedItemName(ItemStack stack, String key) {
var nmsStack = CraftItemStack.asNMSCopy(stack);
nmsStack.setHoverName(new TranslatableComponent(key));
nmsStack.setHoverName(Component.translatable(key));
return CraftItemStack.asBukkitCopy(nmsStack);
}

Expand Down
2 changes: 1 addition & 1 deletion src/org/vivecraft/VivePlayer.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import java.io.IOException;

import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_18_R2.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_19_R1.entity.CraftEntity;
import org.bukkit.entity.Player;
import org.vivecraft.listeners.VivecraftNetworkListener;
import org.vivecraft.utils.Quaternion;
Expand Down
4 changes: 2 additions & 2 deletions src/org/vivecraft/listeners/VivecraftCombatListener.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package org.vivecraft.listeners;

import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_18_R2.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_18_R2.entity.CraftPlayer;
import org.bukkit.craftbukkit.v1_19_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_19_R1.entity.CraftPlayer;
import org.bukkit.entity.AbstractArrow;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Entity;
Expand Down
4 changes: 2 additions & 2 deletions src/org/vivecraft/listeners/VivecraftNetworkListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import java.io.InputStreamReader;
import java.util.Arrays;

import org.bukkit.craftbukkit.v1_18_R2.entity.CraftPlayer;
import org.bukkit.craftbukkit.v1_19_R1.entity.CraftPlayer;
import org.bukkit.entity.Player;
import org.bukkit.plugin.messaging.PluginMessageListener;
import org.vivecraft.Reflector;
Expand Down Expand Up @@ -211,7 +211,7 @@ else if(mode.trim().equalsIgnoreCase("exclude"))
case CLIMBING:
ServerPlayer nms = ((CraftPlayer)sender).getHandle();
nms.fallDistance = 0;
Reflector.setFieldValue(Reflector.aboveGroundCount, nms.connection, 0);
Reflector.setFieldValue(Reflector.aboveGroundTickCount, nms.connection, 0);
break;
case ACTIVEHAND:
ByteArrayInputStream a2 = new ByteArrayInputStream(data);
Expand Down
4 changes: 2 additions & 2 deletions src/org/vivecraft/utils/AimFixHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception
player.setYRot((float)Math.toDegrees(Math.atan2(-aim.x, aim.z)));
player.xRotO = player.getXRot();
player.yRotO = player.yHeadRotO = player.yHeadRot = player.getYRot();
Reflector.setFieldValue(Reflector.Entity_eyesHeight, player, 0);
Reflector.setFieldValue(Reflector.Entity_eyeHeight, player, 0);

// Set up offset to fix relative positions
// P.S. Spigot mappings are stupid
Expand Down Expand Up @@ -100,7 +100,7 @@ public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception
player.xRotO = oldPrevPitch;
player.yRotO = oldPrevYaw;
player.yHeadRotO = oldPrevYawHead;
Reflector.setFieldValue(Reflector.Entity_eyesHeight, player, oldEyeHeight);
Reflector.setFieldValue(Reflector.Entity_eyeHeight, player, oldEyeHeight);

// Reset offset
if (data != null)
Expand Down
2 changes: 1 addition & 1 deletion src/org/vivecraft/utils/PoseOverrider.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.vivecraft.utils;

import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import org.bukkit.craftbukkit.v1_18_R2.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_19_R1.entity.CraftEntity;
import org.bukkit.entity.Player;
import org.vivecraft.Reflector;
import org.vivecraft.VSE;
Expand Down
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#this file is used to check for updates
1.18.2-1: VSE is up to date.
1.19-1: VSE is up to date.

0 comments on commit 3aa554e

Please sign in to comment.