commit
e696cba6ee
@ -1,4 +1,4 @@
|
||||
val mc_version="1.20"
|
||||
val mc_version="1.20.2"
|
||||
|
||||
plugins {
|
||||
`java-library`
|
||||
@ -41,4 +41,4 @@ tasks {
|
||||
}
|
||||
}
|
||||
|
||||
tasks.named("jar") { finalizedBy("remap") }
|
||||
tasks.named("jar") { finalizedBy("remap") }
|
||||
|
@ -9,7 +9,7 @@ import org.bukkit.Effect;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.craftbukkit.v1_20_R1.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.v1_20_R2.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
@ -83,7 +83,7 @@ public class Herobrine extends JavaPlugin implements Listener {
|
||||
// If it is not, print an error message and disable the plugin.
|
||||
if (continueWithEnable) {
|
||||
try {
|
||||
Class.forName("org.bukkit.craftbukkit.v1_20_R1.CraftArt");
|
||||
Class.forName("org.bukkit.craftbukkit.v1_20_R2.CraftArt");
|
||||
} catch (ClassNotFoundException e) {
|
||||
Bukkit.getServer().getConsoleSender().sendMessage(ChatColor.RED + "This version of Herobrine is not "
|
||||
+ "compatible with this server's Spigot version and will be disabled.");
|
||||
|
@ -1,11 +1,12 @@
|
||||
package net.theprogrammersworld.herobrine.NPC.Entity;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.craftbukkit.v1_20_R1.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_20_R1.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.v1_20_R2.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_20_R2.entity.CraftPlayer;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import net.minecraft.server.level.ClientInformation;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.entity.MoverType;
|
||||
import net.minecraft.world.level.GameType;
|
||||
@ -19,7 +20,7 @@ public class HumanEntity extends ServerPlayer {
|
||||
private CraftPlayer cplayer = null;
|
||||
|
||||
public HumanEntity(final NPCCore npcCore, final NMSWorld world, final GameProfile s) {
|
||||
super(npcCore.getServer().getMCServer(), world.getWorldServer(), s);
|
||||
super(npcCore.getServer().getMCServer(), world.getWorldServer(), s, ClientInformation.createDefault());
|
||||
|
||||
this.setGameMode(GameType.SURVIVAL);
|
||||
|
||||
|
@ -1,9 +1,5 @@
|
||||
package net.theprogrammersworld.herobrine.NPC.Entity;
|
||||
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.theprogrammersworld.herobrine.Herobrine;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
@ -11,117 +7,120 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.PlayerInventory;
|
||||
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.theprogrammersworld.herobrine.Herobrine;
|
||||
|
||||
public class HumanNPC {
|
||||
|
||||
private HumanEntity entity;
|
||||
private final int id;
|
||||
private HumanEntity entity;
|
||||
private final int id;
|
||||
|
||||
public HumanNPC(HumanEntity humanEntity, int id) {
|
||||
this.entity = humanEntity;
|
||||
this.id = id;
|
||||
}
|
||||
public HumanNPC(HumanEntity humanEntity, int id) {
|
||||
this.entity = humanEntity;
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public int getID() {
|
||||
return this.id;
|
||||
}
|
||||
public int getID() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public ServerPlayer getEntity() {
|
||||
return this.entity;
|
||||
}
|
||||
public HumanEntity getEntity() {
|
||||
return this.entity;
|
||||
}
|
||||
|
||||
public void ArmSwingAnimation() {
|
||||
entity.swing(InteractionHand.MAIN_HAND);
|
||||
}
|
||||
public void ArmSwingAnimation() {
|
||||
entity.swing(InteractionHand.MAIN_HAND);
|
||||
}
|
||||
|
||||
public void HurtAnimation() {
|
||||
LivingEntity ent = (LivingEntity) entity.getBukkitEntity();
|
||||
public void HurtAnimation() {
|
||||
LivingEntity ent = (LivingEntity) entity.getBukkitEntity();
|
||||
|
||||
double healthBefore = ent.getHealth();
|
||||
double healthBefore = ent.getHealth();
|
||||
|
||||
ent.damage(0.5D);
|
||||
ent.setHealth(healthBefore);
|
||||
}
|
||||
ent.damage(0.5D);
|
||||
ent.setHealth(healthBefore);
|
||||
}
|
||||
|
||||
public void setItemInHand(ItemStack item) {
|
||||
if (item != null) {
|
||||
((org.bukkit.entity.HumanEntity) getEntity().getBukkitEntity()).getInventory().setItemInMainHand(item);
|
||||
}
|
||||
}
|
||||
public void setItemInHand(ItemStack item) {
|
||||
if (item != null) {
|
||||
getEntity().getBukkitEntity().getInventory().setItemInMainHand(item);
|
||||
}
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return getEntity().getName().getString();
|
||||
}
|
||||
public String getName() {
|
||||
return getEntity().getName().getString();
|
||||
}
|
||||
|
||||
public void setPitch(float pitch) {
|
||||
((HumanEntity) getEntity()).setXRot(pitch);
|
||||
}
|
||||
public void setPitch(float pitch) {
|
||||
((HumanEntity) getEntity()).setXRot(pitch);
|
||||
}
|
||||
|
||||
public void moveTo(Location loc) {
|
||||
Teleport(loc);
|
||||
}
|
||||
public void moveTo(Location loc) {
|
||||
Teleport(loc);
|
||||
}
|
||||
|
||||
public void Teleport(Location loc) {
|
||||
getEntity().getBukkitEntity().teleport(loc);
|
||||
|
||||
// After Herobrine moves, check if any players are in Herobrine's line of sight if the persistent tab list entry is disabled.
|
||||
if(!Herobrine.getPluginCore().getConfigDB().ShowInTabList) {
|
||||
boolean doActivationTeleport = false;
|
||||
for(Player p : Bukkit.getOnlinePlayers())
|
||||
public void Teleport(Location loc) {
|
||||
getEntity().getBukkitEntity().teleport(loc);
|
||||
|
||||
// After Herobrine moves, check if any players are in Herobrine's line of sight if the persistent tab list entry is disabled.
|
||||
if (!Herobrine.getPluginCore().getConfigDB().ShowInTabList) {
|
||||
boolean doActivationTeleport = false;
|
||||
for (Player p : Bukkit.getOnlinePlayers())
|
||||
doActivationTeleport = doActivationTeleport || Herobrine.getPluginCore().getAICore().toggleHerobrinePlayerVisibilityNoTeleport(p);
|
||||
if(doActivationTeleport)
|
||||
Herobrine.getPluginCore().getAICore().visibilityActivationTeleport();
|
||||
}
|
||||
}
|
||||
if (doActivationTeleport)
|
||||
Herobrine.getPluginCore().getAICore().visibilityActivationTeleport();
|
||||
}
|
||||
}
|
||||
|
||||
public PlayerInventory getInventory() {
|
||||
return ((org.bukkit.entity.HumanEntity) getEntity().getBukkitEntity()).getInventory();
|
||||
}
|
||||
public PlayerInventory getInventory() {
|
||||
return ((org.bukkit.entity.HumanEntity) getEntity().getBukkitEntity()).getInventory();
|
||||
}
|
||||
|
||||
public void removeFromWorld() {
|
||||
try {
|
||||
entity.getBukkitEntity().remove();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
public void removeFromWorld() {
|
||||
try {
|
||||
entity.getBukkitEntity().remove();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void setYaw(float yaw) {
|
||||
((ServerPlayer) getEntity()).setYRot(yaw);
|
||||
}
|
||||
public void setYaw(float yaw) {
|
||||
getEntity().setYRot(yaw);
|
||||
}
|
||||
|
||||
public void lookAtPoint(Location point) {
|
||||
public void lookAtPoint(Location point) {
|
||||
|
||||
if (getEntity().getBukkitEntity().getWorld() != point.getWorld()) {
|
||||
return;
|
||||
}
|
||||
if (getEntity().getBukkitEntity().getWorld() != point.getWorld()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Location npcLoc = ((LivingEntity) getEntity().getBukkitEntity()).getEyeLocation();
|
||||
double xDiff = point.getX() - npcLoc.getX();
|
||||
double yDiff = point.getY() - npcLoc.getY();
|
||||
double zDiff = point.getZ() - npcLoc.getZ();
|
||||
double DistanceXZ = Math.sqrt(xDiff * xDiff + zDiff * zDiff);
|
||||
double DistanceY = Math.sqrt(DistanceXZ * DistanceXZ + yDiff * yDiff);
|
||||
Location npcLoc = ((LivingEntity) getEntity().getBukkitEntity()).getEyeLocation();
|
||||
double xDiff = point.getX() - npcLoc.getX();
|
||||
double yDiff = point.getY() - npcLoc.getY();
|
||||
double zDiff = point.getZ() - npcLoc.getZ();
|
||||
double DistanceXZ = Math.sqrt(xDiff * xDiff + zDiff * zDiff);
|
||||
double DistanceY = Math.sqrt(DistanceXZ * DistanceXZ + yDiff * yDiff);
|
||||
|
||||
double newYaw = Math.acos(xDiff / DistanceXZ) * 180 / Math.PI;
|
||||
double newPitch = (Math.acos(yDiff / DistanceY) * 180 / Math.PI) - 90;
|
||||
double newYaw = Math.acos(xDiff / DistanceXZ) * 180 / Math.PI;
|
||||
double newPitch = (Math.acos(yDiff / DistanceY) * 180 / Math.PI) - 90;
|
||||
|
||||
if (zDiff < 0.0) {
|
||||
newYaw = newYaw + Math.abs(180 - newYaw) * 2.0D;
|
||||
}
|
||||
if (zDiff < 0.0) {
|
||||
newYaw = newYaw + Math.abs(180 - newYaw) * 2.0D;
|
||||
}
|
||||
|
||||
if (newYaw > 0.0D || newYaw < 180.0D) {
|
||||
entity.setXRot((float) newPitch);
|
||||
entity.setYRot((float) (newYaw - 90.0));
|
||||
entity.getBukkitEntity().setFlySpeed((float) (newYaw - 90.0) / 360);
|
||||
}
|
||||
if (newYaw > 0.0D || newYaw < 180.0D) {
|
||||
entity.setXRot((float) newPitch);
|
||||
entity.setYRot((float) (newYaw - 90.0));
|
||||
entity.getBukkitEntity().setFlySpeed((float) (newYaw - 90.0) / 360);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void setYawA(float yaw) {
|
||||
((ServerPlayer) getEntity()).setYRot(yaw);
|
||||
}
|
||||
public void setYawA(float yaw) {
|
||||
getEntity().setYRot(yaw);
|
||||
}
|
||||
|
||||
public org.bukkit.entity.Entity getBukkitEntity() {
|
||||
return entity.getBukkitEntity();
|
||||
}
|
||||
public org.bukkit.entity.Entity getBukkitEntity() {
|
||||
return entity.getBukkitEntity();
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ import net.minecraft.server.MinecraftServer;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.craftbukkit.v1_20_R1.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_20_R2.CraftServer;
|
||||
|
||||
public class NMSServer {
|
||||
|
||||
|
@ -8,7 +8,7 @@ import net.minecraft.server.level.ChunkMap;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.craftbukkit.v1_20_R1.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_20_R2.CraftWorld;
|
||||
|
||||
public class NMSWorld {
|
||||
|
||||
|
@ -43,7 +43,7 @@ public class NPCCore {
|
||||
"eyJ0aW1lc3RhbXAiOjE0MjE0ODczMzk3MTMsInByb2ZpbGVJZCI6ImY4NGM2YTc5MGE0ZTQ1ZTA4NzliY2Q0OWViZDRjNGUyIiwicHJvZmlsZU5hbWUiOiJIZXJvYnJpbmUiLCJpc1B1YmxpYyI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzk4YjdjYTNjN2QzMTRhNjFhYmVkOGZjMThkNzk3ZmMzMGI2ZWZjODQ0NTQyNWM0ZTI1MDk5N2U1MmU2Y2IifX19",
|
||||
"Edb1R3vm2NHUGyTPaOdXNQY9p5/Ez4xButUGY3tNKIJAzjJM5nQNrq54qyFhSZFVwIP6aM4Ivqmdb2AamXNeN0KgaaU/C514N+cUZNWdW5iiycPytfh7a6EsWXV4hCC9B2FoLkbXuxs/KAbKORtwNfFhQupAsmn9yP00e2c3ZQmS18LWwFg0vzFqvp4HvzJHqY/cTqUxdlSFDrQe/4rATe6Yx6v4zbZN2sHbSL+8AwlDDuP2Xr4SS6f8nABOxjSTlWMn6bToAYiymD+KUPoO0kQJ0Uw/pVXgWHYjQeM4BYf/FAxe8Bf1cP8S7VKueULkOxqIjXAp85uqKkU7dR/s4M4yHm6fhCOCLSMv6hi5ewTaFNYyhK+NXPftFqHcOxA1LbrjOe6NyphF/2FI79n90hagxJpWwNPz3/8I5rnGbYwBZPTsTnD8PszgQTNuWSuvZwGIXPIp9zb90xuU7g7VNWjzPVoOHfRNExEs7Dn9pG8CIA/m/a8koWW3pkbP/AMMWnwgHCr/peGdvF5fN+hJwVdpbfC9sJfzGwA7AgXG/6yqhl1U7YAp/aCVM9bZ94sav+kQghvN41jqOwy4F4i/swc7R4Fx2w5HFxVY3j7FChG7iuhqjUclm79YNhTG0lBQLiZbN5FmC9QgrNHRKlzgSZrXHWoG3YXFSqfn4J+Om9w=");
|
||||
|
||||
profile.getProperties().put(textures.getName(), textures);
|
||||
profile.getProperties().put(textures.name(), textures);
|
||||
|
||||
return profile;
|
||||
}
|
||||
|
@ -1,14 +1,19 @@
|
||||
package net.theprogrammersworld.herobrine.NPC.Network;
|
||||
|
||||
import net.minecraft.network.protocol.PacketFlow;
|
||||
import io.netty.channel.embedded.EmbeddedChannel;
|
||||
import net.minecraft.network.Connection;
|
||||
import net.minecraft.network.PacketListener;
|
||||
import net.minecraft.network.protocol.PacketFlow;
|
||||
|
||||
public class NetworkCore extends Connection {
|
||||
|
||||
public NetworkCore() {
|
||||
super(PacketFlow.SERVERBOUND);
|
||||
channel = new EmbeddedChannel();
|
||||
}
|
||||
|
||||
@Override public void setListener(PacketListener packetListener) {}
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
|
||||
|
@ -1,19 +1,17 @@
|
||||
package net.theprogrammersworld.herobrine.NPC.Network;
|
||||
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.network.protocol.Packet;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.server.network.CommonListenerCookie;
|
||||
import net.minecraft.server.network.ServerGamePacketListenerImpl;
|
||||
import net.theprogrammersworld.herobrine.NPC.NPCCore;
|
||||
|
||||
public class NetworkHandler extends ServerGamePacketListenerImpl {
|
||||
|
||||
public NetworkHandler(final NPCCore npcCore, final ServerPlayer entityPlayer) {
|
||||
super(npcCore.getServer().getMCServer(), npcCore.getNetworkCore(), entityPlayer);
|
||||
super(npcCore.getServer().getMCServer(), npcCore.getNetworkCore(), entityPlayer, CommonListenerCookie.createInitial(entityPlayer.getGameProfile()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void send(final Packet<?> packet) {
|
||||
|
||||
}
|
||||
|
||||
public void send(final Packet<?> packet) {}
|
||||
}
|
@ -5,7 +5,7 @@ import net.minecraft.network.protocol.Packet;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.craftbukkit.v1_20_R1.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.v1_20_R2.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
|
@ -14,7 +14,7 @@ public class EntityManager {
|
||||
public void spawnCustomZombie(Location loc,MobType mbt){
|
||||
|
||||
World world = loc.getWorld();
|
||||
net.minecraft.world.level.Level mcWorld = ((org.bukkit.craftbukkit.v1_20_R1.CraftWorld) world).getHandle();
|
||||
net.minecraft.world.level.Level mcWorld = ((org.bukkit.craftbukkit.v1_20_R2.CraftWorld) world).getHandle();
|
||||
CustomZombie zmb = new CustomZombie(mcWorld,loc,mbt);
|
||||
mcWorld.addFreshEntity(zmb, SpawnReason.CUSTOM);
|
||||
mobList.put(Integer.valueOf(zmb.getBukkitEntity().getEntityId()),zmb);
|
||||
@ -24,7 +24,7 @@ public class EntityManager {
|
||||
public void spawnCustomSkeleton(Location loc,MobType mbt){
|
||||
|
||||
World world = loc.getWorld();
|
||||
net.minecraft.world.level.Level mcWorld = ((org.bukkit.craftbukkit.v1_20_R1.CraftWorld) world).getHandle();
|
||||
net.minecraft.world.level.Level mcWorld = ((org.bukkit.craftbukkit.v1_20_R2.CraftWorld) world).getHandle();
|
||||
CustomSkeleton zmb = new CustomSkeleton(mcWorld,loc,mbt);
|
||||
mcWorld.addFreshEntity(zmb, SpawnReason.CUSTOM);
|
||||
mobList.put(Integer.valueOf(zmb.getBukkitEntity().getEntityId()), zmb);
|
||||
|
@ -12,7 +12,7 @@ import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Jukebox;
|
||||
import org.bukkit.craftbukkit.v1_20_R1.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.v1_20_R2.entity.CraftPlayer;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
@ -1,6 +1,6 @@
|
||||
name: Herobrine
|
||||
main: net.theprogrammersworld.herobrine.Herobrine
|
||||
version: 2.4.3-SNAPSHOT
|
||||
version: 2.4.4-SNAPSHOT
|
||||
description: "Bring Herobrine to your Spigot-based Minecraft server!"
|
||||
website: https://www.theprogrammersworld.net
|
||||
api-version: '1.20'
|
||||
|
Loading…
Reference in New Issue
Block a user