mirror of
https://github.com/xoo0524tw/OpenArcadeGames.git
synced 2026-12-06 02:46:01 +02:00
Initial ArcadeGames source and build setup
This commit is contained in:
commit
76ac0e3acd
1069 files changed
+97958
No files matched your search
@@ -0,0 +1,6 @@
|
||||
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion><parent><groupId>ro.fr33styler.arcade</groupId><artifactId>arcadegames-parent</artifactId><version>2.19f-reconstructed</version><relativePath>../../../../pom.xml</relativePath></parent>
|
||||
<artifactId>platforms-latest-modern-b</artifactId><properties><maven.compiler.release>17</maven.compiler.release></properties>
|
||||
<dependencies><dependency><groupId>ro.fr33styler.arcade</groupId><artifactId>common</artifactId><version>${project.version}</version></dependency><dependency><groupId>ro.fr33styler.arcade</groupId><artifactId>platform-api-latest</artifactId><version>${project.version}</version></dependency><dependency><groupId>local.compile-only</groupId><artifactId>latest-modern-b</artifactId><version>2.19f</version><scope>system</scope><systemPath>${maven.multiModuleProjectDirectory}/build-support/deps/stubs-latest-modern-b.jar</systemPath></dependency></dependencies>
|
||||
</project>
|
||||
+223
@@ -0,0 +1,223 @@
|
||||
package ro.fr33styler.arcade.platform.v26_2;
|
||||
|
||||
import ro.fr33styler.arcade.platform.api.ServerPlatform;
|
||||
import ro.fr33styler.arcade.platform.api.hologram.HologramEntity;
|
||||
import ro.fr33styler.arcade.platform.bukkit.command.BukkitCommands;
|
||||
import ro.fr33styler.arcade.platform.v26_2.hologram.V26_2HologramEntity;
|
||||
import ro.fr33styler.arcade.platform.v26_2.network.V26_2PacketInterceptor;
|
||||
import ro.fr33styler.arcade.platform.v26_2.npc.V26_2NpcFactory;
|
||||
import ro.fr33styler.arcade.platform.version.ServerVersion;
|
||||
import ro.fr33styler.arcade.support.reflect.Reflection;
|
||||
|
||||
import com.mojang.brigadier.arguments.StringArgumentType;
|
||||
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
||||
import com.mojang.brigadier.suggestion.SuggestionsBuilder;
|
||||
import com.mojang.brigadier.tree.LiteralCommandNode;
|
||||
import com.mojang.brigadier.tree.RootCommandNode;
|
||||
import io.netty.buffer.Unpooled;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.Optional;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
import net.minecraft.core.RegistryAccess;
|
||||
import net.minecraft.network.RegistryFriendlyByteBuf;
|
||||
import net.minecraft.network.chat.ComponentSerialization;
|
||||
import net.minecraft.network.chat.numbers.BlankFormat;
|
||||
import net.minecraft.network.codec.ByteBufCodecs;
|
||||
import net.minecraft.network.protocol.Packet;
|
||||
import net.minecraft.network.protocol.game.ClientboundResetScorePacket;
|
||||
import net.minecraft.network.protocol.game.ClientboundSetPlayerTeamPacket;
|
||||
import net.minecraft.network.protocol.game.ClientboundSetScorePacket;
|
||||
import net.minecraft.network.protocol.game.ClientboundTakeItemEntityPacket;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.world.entity.Mob;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.chunk.status.ChunkStatus;
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
import net.minecraft.world.scores.PlayerTeam;
|
||||
import net.minecraft.world.scores.TeamColor;
|
||||
import net.minecraft.world.scores.Team.CollisionRule;
|
||||
import net.minecraft.world.scores.Team.Visibility;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.lang.mutable.MutableBoolean;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.attribute.Attribute;
|
||||
import org.bukkit.attribute.AttributeInstance;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.craftbukkit.CraftChunk;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.craftbukkit.CraftWorld;
|
||||
import org.bukkit.craftbukkit.block.CraftBlock;
|
||||
import org.bukkit.craftbukkit.command.VanillaCommandWrapper;
|
||||
import org.bukkit.craftbukkit.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.util.CraftChatMessage;
|
||||
import org.bukkit.craftbukkit.util.CraftMagicNumbers;
|
||||
import org.bukkit.entity.Item;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scoreboard.Score;
|
||||
import org.bukkit.scoreboard.Team;
|
||||
import org.bukkit.scoreboard.Team.OptionStatus;
|
||||
import ro.fr33styler.arcade.api.engine.command.Command;
|
||||
|
||||
public class V26_2Platform implements ServerPlatform {
|
||||
private final V26_2NpcFactory a;
|
||||
private final V26_2PacketInterceptor b = new V26_2PacketInterceptor();
|
||||
private static final Field c = Reflection.a(Mob.class, "goalSelector");
|
||||
private static final Field d = Reflection.a(Mob.class, "targetSelector");
|
||||
|
||||
V26_2Platform(Server var1) {
|
||||
this.a = new V26_2NpcFactory(var1);
|
||||
}
|
||||
|
||||
public V26_2NpcFactory a() {
|
||||
return this.a;
|
||||
}
|
||||
|
||||
public V26_2PacketInterceptor b() {
|
||||
return this.b;
|
||||
}
|
||||
|
||||
public void a(Player var1) {
|
||||
var1.sendHealthUpdate();
|
||||
}
|
||||
|
||||
public void a(Player var1, Item var2) {
|
||||
((CraftPlayer)var1)
|
||||
.getHandle()
|
||||
.connection
|
||||
.send(new ClientboundTakeItemEntityPacket(var2.getEntityId(), var1.getEntityId(), var2.getItemStack().getAmount()));
|
||||
}
|
||||
|
||||
public void a(Command var1) {
|
||||
this.a(var1, var1.getCommand());
|
||||
var1.getAliases().forEach(var2 -> this.a(var1, var2));
|
||||
}
|
||||
|
||||
public void b(Command var1) {
|
||||
RootCommandNode var2 = this.e().getDispatcher().getRoot();
|
||||
var2.removeCommand(var1.getCommand());
|
||||
var1.getAliases().forEach(var2::removeCommand);
|
||||
BukkitCommands.b(var1);
|
||||
}
|
||||
|
||||
private Commands e() {
|
||||
return ((CraftServer)Bukkit.getServer()).getHandle().getServer().getCommands();
|
||||
}
|
||||
|
||||
private void a(Command var1, String var2) {
|
||||
LiteralArgumentBuilder var3 = (LiteralArgumentBuilder)((LiteralArgumentBuilder)Commands.literal(var2)
|
||||
.then(
|
||||
Commands.argument("arguments", StringArgumentType.greedyString())
|
||||
.suggests((var1x, var2x) -> {
|
||||
String var3x = var2x.getRemaining();
|
||||
String[] var4x = StringUtils.split(var3x);
|
||||
if (var3x.endsWith(" ") || var3x.isEmpty()) {
|
||||
var4x = (String[])ArrayUtils.add(var4x, "");
|
||||
}
|
||||
|
||||
SuggestionsBuilder var5 = var2x.createOffset(var2x.getInput().lastIndexOf(32) + 1);
|
||||
var1.onSuggestion(((CommandSourceStack)var1x.getSource()).getBukkitSender(), var4x).forEach(var5::suggest);
|
||||
return var5.buildFuture();
|
||||
})
|
||||
.executes(
|
||||
var2x -> {
|
||||
var1.onExecute(
|
||||
((CommandSourceStack)var2x.getSource()).getBukkitSender(),
|
||||
var2,
|
||||
StringUtils.split((String)var2x.getArgument("arguments", String.class), ' ')
|
||||
);
|
||||
return 1;
|
||||
}
|
||||
)
|
||||
))
|
||||
.executes(var2x -> {
|
||||
var1.onExecute(((CommandSourceStack)var2x.getSource()).getBukkitSender(), var2, ArrayUtils.EMPTY_STRING_ARRAY);
|
||||
return 1;
|
||||
});
|
||||
LiteralCommandNode var4 = var3.build();
|
||||
if (!ServerVersion.d) {
|
||||
BukkitCommands.a(new VanillaCommandWrapper(this.e(), var4));
|
||||
}
|
||||
|
||||
this.e().getDispatcher().getRoot().addChild(var4);
|
||||
}
|
||||
|
||||
public double b(Player var1) {
|
||||
AttributeInstance var2 = var1.getAttribute(Attribute.WAYPOINT_RECEIVE_RANGE);
|
||||
return var2 == null ? 0.0 : var2.getBaseValue();
|
||||
}
|
||||
|
||||
public void a(Player var1, double var2) {
|
||||
AttributeInstance var4 = var1.getAttribute(Attribute.WAYPOINT_RECEIVE_RANGE);
|
||||
if (var4 != null) {
|
||||
var4.setBaseValue(var2);
|
||||
}
|
||||
}
|
||||
|
||||
public void a(Block var1, Material var2) {
|
||||
CraftBlock var3 = (CraftBlock)var1;
|
||||
ServerLevel var4 = var3.getCraftWorld().getHandle();
|
||||
BlockState var5 = CraftMagicNumbers.getBlock(var2).defaultBlockState();
|
||||
((CraftChunk)var1.getChunk()).getHandle(ChunkStatus.FULL).setBlockState(var3.getPosition(), var5, 530);
|
||||
var4.sendBlockUpdated(var3.getPosition(), var4.getBlockState(var3.getPosition()), var5, 0);
|
||||
}
|
||||
|
||||
public HologramEntity a(World var1, double var2, double var4, double var6) {
|
||||
return new V26_2HologramEntity(((CraftWorld)var1).getHandle(), var2, var4, var6);
|
||||
}
|
||||
|
||||
public boolean a(Block var1, double var2, double var4, double var6) {
|
||||
CraftBlock var8 = (CraftBlock)var1;
|
||||
ServerLevel var9 = var8.getCraftWorld().getHandle();
|
||||
VoxelShape var10 = var9.getBlockState(var8.getPosition()).getShape(var9, var8.getPosition());
|
||||
if (var10.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
double var11 = var2 - var8.getX();
|
||||
double var13 = var4 - var8.getY();
|
||||
double var15 = var6 - var8.getZ();
|
||||
MutableBoolean var17 = new MutableBoolean(false);
|
||||
var10.forAllBoxes((var7, var9x, var11x, var13x, var15x, var17x) -> {
|
||||
if (var11 >= var7 && var11 <= var13x && var13 >= var9x && var13 <= var15x && var15 >= var11x && var15 <= var17x) {
|
||||
var17.setValue(true);
|
||||
}
|
||||
});
|
||||
return var17.booleanValue();
|
||||
}
|
||||
|
||||
public void a(Player var1, boolean var2, Score var3, int var4) {
|
||||
if (var2) {
|
||||
((CraftPlayer)var1).getHandle().connection.send(new ClientboundResetScorePacket(var3.getEntry(), var3.getObjective().getName()));
|
||||
} else {
|
||||
((CraftPlayer)var1)
|
||||
.getHandle()
|
||||
.connection
|
||||
.send(new ClientboundSetScorePacket(var3.getEntry(), var3.getObjective().getName(), var4, Optional.empty(), Optional.of(BlankFormat.INSTANCE)));
|
||||
}
|
||||
}
|
||||
|
||||
public void a(Player var1, Team var2, String var3, String var4, OptionStatus var5) {
|
||||
if (var1.getScoreboard() == var2.getScoreboard()) {
|
||||
CraftPlayer var6 = (CraftPlayer)var1;
|
||||
PlayerTeam var7 = var6.getScoreboard().getHandle().getPlayerTeam(var2.getName());
|
||||
if (var7 != null) {
|
||||
RegistryFriendlyByteBuf var8 = new RegistryFriendlyByteBuf(Unpooled.buffer(), RegistryAccess.EMPTY);
|
||||
var8.writeUtf(var7.getName());
|
||||
var8.writeByte(2);
|
||||
ComponentSerialization.TRUSTED_STREAM_CODEC.encode(var8, var7.getDisplayName());
|
||||
ComponentSerialization.TRUSTED_STREAM_CODEC.encode(var8, var3 == null ? var7.getPlayerPrefix() : CraftChatMessage.fromString(var3)[0]);
|
||||
ComponentSerialization.TRUSTED_STREAM_CODEC.encode(var8, var4 == null ? var7.getPlayerSuffix() : CraftChatMessage.fromString(var4)[0]);
|
||||
Visibility.STREAM_CODEC.encode(var8, var5 == null ? var7.getNameTagVisibility() : Visibility.values()[var5.ordinal()]);
|
||||
CollisionRule.STREAM_CODEC.encode(var8, var7.getCollisionRule());
|
||||
ByteBufCodecs.optional(TeamColor.STREAM_CODEC).encode(var8, var7.getColor());
|
||||
ByteBufCodecs.BYTE.encode(var8, var7.packOptions());
|
||||
var6.getHandle().connection.send((Packet)ClientboundSetPlayerTeamPacket.STREAM_CODEC.decode(var8));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
package ro.fr33styler.arcade.platform.v26_2;
|
||||
|
||||
import ro.fr33styler.arcade.platform.api.ServerPlatform;
|
||||
import ro.fr33styler.arcade.platform.version.ServerVersion;
|
||||
import ro.fr33styler.arcade.platform.version.VersionFactory;
|
||||
|
||||
import org.bukkit.Server;
|
||||
|
||||
public class V26_2PlatformFactory implements VersionFactory<ServerPlatform> {
|
||||
public String a() {
|
||||
return "26.2+";
|
||||
}
|
||||
|
||||
public boolean a(String var1) {
|
||||
int var2 = ServerVersion.a(var1);
|
||||
return var2 >= 27 || var2 == 26 && ServerVersion.b(var1) >= 2;
|
||||
}
|
||||
|
||||
public ServerPlatform a(Server var1) {
|
||||
return new V26_2Platform(var1);
|
||||
}
|
||||
}
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
package ro.fr33styler.arcade.platform.v26_2.entity.bomblobbers;
|
||||
|
||||
import net.minecraft.core.particles.ParticleOptions;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.entity.EntityReference;
|
||||
import net.minecraft.world.entity.EntityTypes;
|
||||
import net.minecraft.world.entity.MoverType;
|
||||
import net.minecraft.world.entity.item.PrimedTnt;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public class BombLobbersV26_2TntEntity extends PrimedTnt {
|
||||
private boolean a;
|
||||
private final ParticleOptions b;
|
||||
|
||||
public BombLobbersV26_2TntEntity(ServerPlayer var1, ParticleOptions var2, Vector var3) {
|
||||
super(EntityTypes.TNT, var1.level());
|
||||
this.owner = EntityReference.of(var1);
|
||||
this.b = var2;
|
||||
this.snapTo(var1.getX(), var1.getY() + var1.getEyeHeight(), var1.getZ(), 0.0F, 0.0F);
|
||||
this.setDeltaMovement(var3.getX(), var3.getY(), var3.getZ());
|
||||
}
|
||||
|
||||
public void tick() {
|
||||
super.tick();
|
||||
if (this.getFuse() > 0) {
|
||||
if (this.a) {
|
||||
this.setDeltaMovement(Vec3.ZERO);
|
||||
} else {
|
||||
Vec3 var1 = this.position();
|
||||
|
||||
for (int var2 = 0; var2 < 4; var2++) {
|
||||
double var3 = this.getX() + var1.x * var2 / 4.0;
|
||||
double var5 = this.getY() + var1.y * var2 / 4.0;
|
||||
double var7 = this.getZ() + var1.z * var2 / 4.0;
|
||||
((ServerLevel)this.level()).sendParticles(this.b, var3, var5, var7, 2, 0.0, 0.0, 0.0, 1.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void move(MoverType var1, Vec3 var2) {
|
||||
super.move(var1, var2);
|
||||
if (this.horizontalCollision || this.verticalCollision) {
|
||||
this.setDeltaMovement(Vec3.ZERO);
|
||||
this.setNoGravity(true);
|
||||
this.a = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
package ro.fr33styler.arcade.platform.v26_2.entity.bomblobbers;
|
||||
|
||||
import ro.fr33styler.arcade.game.bomblobbers.platform.BombLobbersTntFactory;
|
||||
|
||||
import net.minecraft.core.particles.DustParticleOptions;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.craftbukkit.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.TNTPrimed;
|
||||
import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public class BombLobbersV26_2TntFactory implements BombLobbersTntFactory {
|
||||
public TNTPrimed a(Player var1, Color var2, Vector var3) {
|
||||
ServerPlayer var4 = ((CraftPlayer)var1).getHandle();
|
||||
BombLobbersV26_2TntEntity var5 = new BombLobbersV26_2TntEntity(var4, new DustParticleOptions(var2.asRGB(), 1.0F), var3);
|
||||
var4.level().addFreshEntity(var5, SpawnReason.CUSTOM);
|
||||
return (TNTPrimed)var5.getBukkitEntity();
|
||||
}
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
package ro.fr33styler.arcade.platform.v26_2.entity.bomblobbers;
|
||||
|
||||
import ro.fr33styler.arcade.game.bomblobbers.platform.BombLobbersTntFactory;
|
||||
import ro.fr33styler.arcade.platform.version.ServerVersion;
|
||||
import ro.fr33styler.arcade.platform.version.VersionFactory;
|
||||
|
||||
import org.bukkit.Server;
|
||||
|
||||
public class BombLobbersV26_2TntFactorySelector implements VersionFactory<BombLobbersTntFactory> {
|
||||
public String a() {
|
||||
return "26.2+";
|
||||
}
|
||||
|
||||
public boolean a(String var1) {
|
||||
int var2 = ServerVersion.a(var1);
|
||||
return var2 >= 27 || var2 == 26 && ServerVersion.b(var1) >= 2;
|
||||
}
|
||||
|
||||
public BombLobbersTntFactory a(Server var1) {
|
||||
return new BombLobbersV26_2TntFactory();
|
||||
}
|
||||
}
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
package ro.fr33styler.arcade.platform.v26_2.entity.miniwalls;
|
||||
|
||||
import java.util.function.Predicate;
|
||||
import net.minecraft.core.particles.DustParticleOptions;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.entity.projectile.arrow.Arrow;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.Items;
|
||||
import net.minecraft.world.phys.EntityHitResult;
|
||||
import net.minecraft.world.phys.HitResult;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import net.minecraft.world.phys.HitResult.Type;
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public class MiniWallsV26_2Arrow extends Arrow {
|
||||
private final Predicate<Entity> a;
|
||||
private final DustParticleOptions b;
|
||||
private static final ItemStack c = new ItemStack(Items.ARROW);
|
||||
|
||||
public MiniWallsV26_2Arrow(ServerPlayer var1, Color var2, Vector var3, Predicate<Entity> var4) {
|
||||
super(var1.level(), var1, c, null);
|
||||
this.b = new DustParticleOptions(var2.asRGB(), 1.0F);
|
||||
this.shootFromRotation(var1, this.getXRot(), var1.getYRot(), 0.0F, 3.0F, 1.0F);
|
||||
this.setDeltaMovement(var3.getX(), var3.getY(), var3.getZ());
|
||||
this.level().addFreshEntity(this);
|
||||
this.a = var4;
|
||||
}
|
||||
|
||||
protected void onHit(HitResult var1) {
|
||||
if (var1.getType() != Type.ENTITY || this.a.test(((EntityHitResult)var1).getEntity().getBukkitEntity())) {
|
||||
super.onHit(var1);
|
||||
}
|
||||
}
|
||||
|
||||
public void tick() {
|
||||
super.tick();
|
||||
if (!this.isInGround()) {
|
||||
Vec3 var1 = this.position();
|
||||
|
||||
for (int var2 = 0; var2 < 4; var2++) {
|
||||
this.level()
|
||||
.getWorld()
|
||||
.getHandle()
|
||||
.sendParticles(
|
||||
this.b, this.getX() + var1.x * var2 / 4.0, this.getY() + var1.y * var2 / 4.0, this.getZ() + var1.z * var2 / 4.0, 2, 0.0, 0.0, 0.0, 1.0
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
package ro.fr33styler.arcade.platform.v26_2.entity.miniwalls;
|
||||
|
||||
import ro.fr33styler.arcade.game.miniwalls.platform.MiniWallsEntityFactory;
|
||||
|
||||
import java.util.function.Predicate;
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.craftbukkit.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.entity.CraftWither;
|
||||
import org.bukkit.entity.Arrow;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Wither;
|
||||
import org.bukkit.entity.WitherSkull;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public class MiniWallsV26_2EntityFactory implements MiniWallsEntityFactory {
|
||||
public Wither a(Location var1, Predicate<LivingEntity> var2, Runnable var3) {
|
||||
return (Wither)new MiniWallsV26_2Wither(var1, var2, var3).getBukkitEntity();
|
||||
}
|
||||
|
||||
public Arrow a(Player var1, Color var2, Vector var3, Predicate<Entity> var4) {
|
||||
return (Arrow)new MiniWallsV26_2Arrow(((CraftPlayer)var1).getHandle(), var2, var3, var4).getBukkitEntity();
|
||||
}
|
||||
|
||||
public WitherSkull a(Wither var1, Vector var2, Predicate<Entity> var3) {
|
||||
return (WitherSkull)new MiniWallsV26_2WitherSkull(((CraftWither)var1).getHandle(), var2, var3).getBukkitEntity();
|
||||
}
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
package ro.fr33styler.arcade.platform.v26_2.entity.miniwalls;
|
||||
|
||||
import ro.fr33styler.arcade.game.miniwalls.platform.MiniWallsEntityFactory;
|
||||
import ro.fr33styler.arcade.platform.version.ServerVersion;
|
||||
import ro.fr33styler.arcade.platform.version.VersionFactory;
|
||||
|
||||
import org.bukkit.Server;
|
||||
|
||||
public class MiniWallsV26_2EntityFactorySelector implements VersionFactory<MiniWallsEntityFactory> {
|
||||
public String a() {
|
||||
return "26.2+";
|
||||
}
|
||||
|
||||
public boolean a(String var1) {
|
||||
int var2 = ServerVersion.a(var1);
|
||||
return var2 >= 27 || var2 == 26 && ServerVersion.b(var1) >= 2;
|
||||
}
|
||||
|
||||
public MiniWallsEntityFactory a(Server var1) {
|
||||
return new MiniWallsV26_2EntityFactory();
|
||||
}
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
package ro.fr33styler.arcade.platform.v26_2.entity.miniwalls;
|
||||
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.ai.goal.LookAtPlayerGoal;
|
||||
|
||||
class MiniWallsV26_2LookAtPlayerGoal extends LookAtPlayerGoal {
|
||||
final MiniWallsV26_2Wither a;
|
||||
|
||||
private MiniWallsV26_2LookAtPlayerGoal(MiniWallsV26_2Wither var1, MiniWallsV26_2Wither var2) {
|
||||
super(var2, LivingEntity.class, 8.0F, 1.0F);
|
||||
this.a = var1;
|
||||
this.lookAtContext.selector((var1x, var2x) -> MiniWallsV26_2Wither.re$predicate(var1).test((org.bukkit.entity.LivingEntity)var1x.getBukkitEntity()));
|
||||
}
|
||||
|
||||
static MiniWallsV26_2LookAtPlayerGoal re$construct(MiniWallsV26_2Wither outer, MiniWallsV26_2Wither entity) {
|
||||
return new MiniWallsV26_2LookAtPlayerGoal(outer, entity);
|
||||
}
|
||||
}
|
||||
+69
@@ -0,0 +1,69 @@
|
||||
package ro.fr33styler.arcade.platform.v26_2.entity.miniwalls;
|
||||
|
||||
import java.util.function.Predicate;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.world.damagesource.DamageSource;
|
||||
import net.minecraft.world.entity.EntityTypes;
|
||||
import net.minecraft.world.entity.boss.wither.WitherBoss;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.craftbukkit.CraftWorld;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
|
||||
|
||||
public class MiniWallsV26_2Wither extends WitherBoss {
|
||||
private int a;
|
||||
private final Runnable b;
|
||||
private final Predicate<LivingEntity> c;
|
||||
|
||||
public MiniWallsV26_2Wither(Location var1, Predicate<LivingEntity> var2, Runnable var3) {
|
||||
super(EntityTypes.WITHER, ((CraftWorld)var1.getWorld()).getHandle());
|
||||
this.snapTo(var1.getX(), var1.getY(), var1.getZ(), var1.getYaw(), var1.getPitch());
|
||||
super.bossEvent.setVisible(false);
|
||||
this.setInvulnerableTicks(500);
|
||||
this.level().addFreshEntity(this, SpawnReason.CUSTOM);
|
||||
this.c = var2;
|
||||
this.b = var3;
|
||||
}
|
||||
|
||||
public int getInvulnerableTicks() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void travel(Vec3 var1) {
|
||||
}
|
||||
|
||||
public void setDeltaMovement(double var1, double var3, double var5) {
|
||||
}
|
||||
|
||||
public void registerGoals() {
|
||||
this.goalSelector.addGoal(0, MiniWallsV26_2LookAtPlayerGoal.re$construct(this, this));
|
||||
}
|
||||
|
||||
public void customServerAiStep(ServerLevel var1) {
|
||||
if (this.a > 0) {
|
||||
if (this.a == 10 || this.a == 20) {
|
||||
this.b.run();
|
||||
}
|
||||
|
||||
this.a--;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean hurtServer(ServerLevel var1, DamageSource var2, float var3) {
|
||||
if (this.a > 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean var4 = super.hurtServer(var1, var2, var3);
|
||||
if (var4) {
|
||||
this.a = 20;
|
||||
}
|
||||
|
||||
return var4;
|
||||
}
|
||||
|
||||
static Predicate<LivingEntity> re$predicate(MiniWallsV26_2Wither self) {
|
||||
return self.c;
|
||||
}
|
||||
}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
package ro.fr33styler.arcade.platform.v26_2.entity.miniwalls;
|
||||
|
||||
import java.util.function.Predicate;
|
||||
import net.minecraft.world.entity.boss.wither.WitherBoss;
|
||||
import net.minecraft.world.entity.projectile.hurtingprojectile.WitherSkull;
|
||||
import net.minecraft.world.phys.EntityHitResult;
|
||||
import net.minecraft.world.phys.HitResult;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import net.minecraft.world.phys.HitResult.Type;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public class MiniWallsV26_2WitherSkull extends WitherSkull {
|
||||
private final Predicate<Entity> a;
|
||||
|
||||
public MiniWallsV26_2WitherSkull(WitherBoss var1, Vector var2, Predicate<Entity> var3) {
|
||||
super(var1.level(), var1, new Vec3(var2.getX(), var2.getY(), var2.getZ()));
|
||||
this.snapTo(this.getX(), this.getY() + 1.0, this.getZ(), 0.0F, 0.0F);
|
||||
this.setDeltaMovement(var2.getX(), var2.getY(), var2.getZ());
|
||||
this.level().addFreshEntity(this);
|
||||
this.a = var3;
|
||||
}
|
||||
|
||||
public void assignDirectionalMovement(Vec3 var1, double var2) {
|
||||
this.setDeltaMovement(var1.normalize().scale(var2));
|
||||
this.needsSync = true;
|
||||
}
|
||||
|
||||
protected void onDeflection(boolean var1) {
|
||||
}
|
||||
|
||||
protected void onHit(HitResult var1) {
|
||||
if (var1.getType() != Type.ENTITY || this.a.test(((EntityHitResult)var1).getEntity().getBukkitEntity())) {
|
||||
super.onHit(var1);
|
||||
}
|
||||
}
|
||||
}
|
||||
+98
@@ -0,0 +1,98 @@
|
||||
package ro.fr33styler.arcade.platform.v26_2.entity.prophunt;
|
||||
|
||||
import ro.fr33styler.arcade.game.prophunt.platform.PropHuntProp;
|
||||
import ro.fr33styler.arcade.game.prophunt.prop.PropHuntPropType;
|
||||
|
||||
import java.util.UUID;
|
||||
import net.minecraft.core.Rotations;
|
||||
import net.minecraft.world.entity.EntityTypes;
|
||||
import net.minecraft.world.entity.EquipmentSlot;
|
||||
import net.minecraft.world.entity.Entity.MovementEmission;
|
||||
import net.minecraft.world.entity.decoration.ArmorStand;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.craftbukkit.CraftWorld;
|
||||
import org.bukkit.craftbukkit.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class PropHuntV26_2PropEntity extends ArmorStand implements PropHuntProp {
|
||||
private CraftPlayer a;
|
||||
private final ItemStack b;
|
||||
private final PropHuntPropType c;
|
||||
|
||||
public PropHuntV26_2PropEntity(PropHuntPropType var1, ItemStack var2, Location var3) {
|
||||
super(EntityTypes.ARMOR_STAND, ((CraftWorld)var3.getWorld()).getHandle());
|
||||
this.setInvisible(true);
|
||||
this.setNoGravity(true);
|
||||
this.collides = false;
|
||||
this.b = var2;
|
||||
this.c = var1;
|
||||
if (var1 == PropHuntPropType.TOOL) {
|
||||
this.setItemSlot(EquipmentSlot.MAINHAND, CraftItemStack.asNMSCopy(var2));
|
||||
this.setRightArmPose(new Rotations(-90.0F, 0.0F, 90.0F));
|
||||
} else {
|
||||
this.setItemSlot(EquipmentSlot.HEAD, CraftItemStack.asNMSCopy(var2));
|
||||
}
|
||||
|
||||
this.a(var3);
|
||||
}
|
||||
|
||||
public UUID a() {
|
||||
return this.uuid;
|
||||
}
|
||||
|
||||
public PropHuntPropType b() {
|
||||
return this.c;
|
||||
}
|
||||
|
||||
public ItemStack c() {
|
||||
return this.b;
|
||||
}
|
||||
|
||||
public Player d() {
|
||||
return this.a;
|
||||
}
|
||||
|
||||
public void a(Player var1) {
|
||||
this.a = (CraftPlayer)var1;
|
||||
}
|
||||
|
||||
public Location e() {
|
||||
return new Location(this.level().getWorld(), this.getX(), this.getY() + 1.35, this.getZ(), this.getYRot(), this.getXRot());
|
||||
}
|
||||
|
||||
public void a(Location var1) {
|
||||
double var2 = var1.getX();
|
||||
double var4 = var1.getY() - 1.35;
|
||||
double var6 = var1.getZ();
|
||||
if (this.c == PropHuntPropType.TOOL) {
|
||||
double var8 = Math.toRadians(var1.getYaw());
|
||||
var2 += 0.5 * Math.sin(var8);
|
||||
var6 -= 0.5 * Math.cos(var8);
|
||||
}
|
||||
|
||||
this.setYRot(var1.getYaw());
|
||||
this.snapTo(var2, var4, var6);
|
||||
}
|
||||
|
||||
public void f() {
|
||||
if (this.a != null) {
|
||||
this.getBukkitEntity().addPassenger(this.a);
|
||||
}
|
||||
}
|
||||
|
||||
public void h() {
|
||||
this.discard();
|
||||
}
|
||||
|
||||
protected MovementEmission getMovementEmission() {
|
||||
return MovementEmission.NONE;
|
||||
}
|
||||
|
||||
public void tick() {
|
||||
if (this.a != null && !this.a.isInsideVehicle()) {
|
||||
this.a(this.a.getLocation());
|
||||
}
|
||||
}
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
package ro.fr33styler.arcade.platform.v26_2.entity.prophunt;
|
||||
|
||||
import ro.fr33styler.arcade.game.prophunt.platform.PropHuntProp;
|
||||
import ro.fr33styler.arcade.game.prophunt.platform.PropHuntPropFactory;
|
||||
import ro.fr33styler.arcade.game.prophunt.prop.PropHuntPropType;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class PropHuntV26_2PropFactory implements PropHuntPropFactory {
|
||||
public Particle a() {
|
||||
return Particle.HAPPY_VILLAGER;
|
||||
}
|
||||
|
||||
public PropHuntProp a(PropHuntPropType var1, ItemStack var2, Location var3) {
|
||||
PropHuntV26_2PropEntity var4 = new PropHuntV26_2PropEntity(var1, var2, var3);
|
||||
var4.level().addFreshEntity(var4, SpawnReason.CUSTOM);
|
||||
return var4;
|
||||
}
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
package ro.fr33styler.arcade.platform.v26_2.entity.prophunt;
|
||||
|
||||
import ro.fr33styler.arcade.game.prophunt.platform.PropHuntPropFactory;
|
||||
import ro.fr33styler.arcade.platform.version.ServerVersion;
|
||||
import ro.fr33styler.arcade.platform.version.VersionFactory;
|
||||
|
||||
import org.bukkit.Server;
|
||||
|
||||
public class PropHuntV26_2PropFactorySelector implements VersionFactory<PropHuntPropFactory> {
|
||||
public String a() {
|
||||
return "26.2+";
|
||||
}
|
||||
|
||||
public boolean a(String var1) {
|
||||
int var2 = ServerVersion.a(var1);
|
||||
return var2 >= 27 || var2 == 26 && ServerVersion.b(var1) >= 2;
|
||||
}
|
||||
|
||||
public PropHuntPropFactory a(Server var1) {
|
||||
return new PropHuntV26_2PropFactory();
|
||||
}
|
||||
}
|
||||
+71
@@ -0,0 +1,71 @@
|
||||
package ro.fr33styler.arcade.platform.v26_2.hologram;
|
||||
|
||||
import ro.fr33styler.arcade.platform.api.hologram.HologramEntity;
|
||||
|
||||
import net.minecraft.network.protocol.game.ClientboundAddEntityPacket;
|
||||
import net.minecraft.network.protocol.game.ClientboundRemoveEntitiesPacket;
|
||||
import net.minecraft.network.protocol.game.ClientboundSetEntityDataPacket;
|
||||
import net.minecraft.server.network.ServerGamePacketListenerImpl;
|
||||
import net.minecraft.world.entity.EntityTypes;
|
||||
import net.minecraft.world.entity.decoration.ArmorStand;
|
||||
import net.minecraft.world.level.Level;
|
||||
import org.bukkit.craftbukkit.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.util.CraftChatMessage;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class V26_2HologramEntity extends ArmorStand implements HologramEntity {
|
||||
public V26_2HologramEntity(Level var1, double var2, double var4, double var6) {
|
||||
super(EntityTypes.ARMOR_STAND, var1);
|
||||
super.snapTo(var2, var4 - 2.0, var6, 0.0F, 0.0F);
|
||||
super.setNoGravity(false);
|
||||
super.setInvisible(true);
|
||||
}
|
||||
|
||||
public void a(String var1) {
|
||||
super.setCustomName(CraftChatMessage.fromStringOrNull(var1));
|
||||
if (super.hasCustomName()) {
|
||||
super.setCustomNameVisible(true);
|
||||
}
|
||||
}
|
||||
|
||||
public LivingEntity a() {
|
||||
return (LivingEntity)this.getBukkitEntity();
|
||||
}
|
||||
|
||||
public void a(Player var1) {
|
||||
this.a(this.b(var1));
|
||||
}
|
||||
|
||||
public void a(Player var1, boolean var2) {
|
||||
ServerGamePacketListenerImpl var3 = this.b(var1);
|
||||
if (var2) {
|
||||
var3.send(
|
||||
new ClientboundAddEntityPacket(
|
||||
this.getId(),
|
||||
this.getUUID(),
|
||||
this.position().x,
|
||||
this.position().y,
|
||||
this.position().z,
|
||||
this.getXRot(),
|
||||
this.getYRot(),
|
||||
this.getType(),
|
||||
0,
|
||||
this.getDeltaMovement(),
|
||||
this.getYHeadRot()
|
||||
)
|
||||
);
|
||||
this.a(var3);
|
||||
} else {
|
||||
var3.send(new ClientboundRemoveEntitiesPacket(new int[]{this.getId()}));
|
||||
}
|
||||
}
|
||||
|
||||
private ServerGamePacketListenerImpl b(Player var1) {
|
||||
return ((CraftPlayer)var1).getHandle().connection;
|
||||
}
|
||||
|
||||
private void a(ServerGamePacketListenerImpl var1) {
|
||||
var1.send(new ClientboundSetEntityDataPacket(this.getId(), this.entityData.getNonDefaultValues()));
|
||||
}
|
||||
}
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
package ro.fr33styler.arcade.platform.v26_2.network;
|
||||
|
||||
import io.netty.buffer.Unpooled;
|
||||
import io.netty.channel.ChannelDuplexHandler;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import net.minecraft.network.FriendlyByteBuf;
|
||||
import net.minecraft.network.protocol.game.ServerboundAttackPacket;
|
||||
import net.minecraft.network.protocol.game.ServerboundInteractPacket;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import ro.fr33styler.arcade.api.engine.event.packet.AsyncPacketEntityInteractEvent;
|
||||
|
||||
public class V26_2ChannelHandler extends ChannelDuplexHandler {
|
||||
private final Player a;
|
||||
|
||||
public V26_2ChannelHandler(Player var1) {
|
||||
this.a = var1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void channelRead(ChannelHandlerContext var1, Object var2) {
|
||||
if (var2 instanceof ServerboundAttackPacket var3) {
|
||||
FriendlyByteBuf var5 = new FriendlyByteBuf(Unpooled.buffer());
|
||||
ServerboundAttackPacket.STREAM_CODEC.encode(var5, var3);
|
||||
int var6 = var5.readVarInt();
|
||||
Bukkit.getPluginManager().callEvent(new AsyncPacketEntityInteractEvent(this.a, var6, true));
|
||||
} else if (var2 instanceof ServerboundInteractPacket var4) {
|
||||
FriendlyByteBuf var8 = new FriendlyByteBuf(Unpooled.buffer());
|
||||
ServerboundInteractPacket.STREAM_CODEC.encode(var8, var4);
|
||||
int var9 = var8.readVarInt();
|
||||
InteractionHand var7 = (InteractionHand)InteractionHand.STREAM_CODEC.decode(var8);
|
||||
if (var7 == InteractionHand.MAIN_HAND) {
|
||||
Bukkit.getPluginManager().callEvent(new AsyncPacketEntityInteractEvent(this.a, var9, false));
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
super.channelRead(var1, var2);
|
||||
} catch (Exception failure) {
|
||||
V26_2ChannelHandler.<RuntimeException>re$throw(failure);
|
||||
}
|
||||
}
|
||||
|
||||
private static <E extends Throwable> void re$throw(Throwable failure) throws E {
|
||||
throw (E) failure;
|
||||
}
|
||||
}
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
package ro.fr33styler.arcade.platform.v26_2.network;
|
||||
|
||||
import ro.fr33styler.arcade.platform.api.network.PacketInterceptor;
|
||||
import ro.fr33styler.arcade.support.reflect.Reflection;
|
||||
|
||||
import io.netty.channel.Channel;
|
||||
import io.netty.channel.ChannelPipeline;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.NoSuchElementException;
|
||||
import net.minecraft.network.Connection;
|
||||
import net.minecraft.server.network.ServerCommonPacketListenerImpl;
|
||||
import org.bukkit.craftbukkit.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class V26_2PacketInterceptor implements PacketInterceptor {
|
||||
private static final Field a = Reflection.a(ServerCommonPacketListenerImpl.class, Connection.class);
|
||||
|
||||
private Channel a(Player var1) throws IllegalAccessException {
|
||||
Connection var2 = (Connection)Reflection.a(a, ((CraftPlayer)var1).getHandle().connection);
|
||||
return var2.channel;
|
||||
}
|
||||
|
||||
private void a(ChannelPipeline var1, String var2) {
|
||||
if (var1.get(var2) != null) {
|
||||
var1.remove(var2);
|
||||
}
|
||||
}
|
||||
|
||||
public void a(String var1, Player var2) {
|
||||
try {
|
||||
ChannelPipeline var3 = this.a(var2).pipeline();
|
||||
this.a(var3, var1);
|
||||
var3.addBefore("packet_handler", var1, new V26_2ChannelHandler(var2));
|
||||
} catch (NoSuchElementException var4) {
|
||||
} catch (IllegalAccessException var5) {
|
||||
var5.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void b(String var1, Player var2) {
|
||||
try {
|
||||
Channel var3 = this.a(var2);
|
||||
var3.eventLoop().execute(() -> this.a(var3.pipeline(), var1));
|
||||
} catch (IllegalAccessException var4) {
|
||||
var4.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
+99
@@ -0,0 +1,99 @@
|
||||
package ro.fr33styler.arcade.platform.v26_2.npc;
|
||||
|
||||
import ro.fr33styler.arcade.platform.api.npc.Npc;
|
||||
import ro.fr33styler.arcade.platform.version.ServerVersion;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import com.mojang.datafixers.util.Pair;
|
||||
import java.util.List;
|
||||
import net.minecraft.network.protocol.game.ClientboundAddEntityPacket;
|
||||
import net.minecraft.network.protocol.game.ClientboundAnimatePacket;
|
||||
import net.minecraft.network.protocol.game.ClientboundPlayerInfoRemovePacket;
|
||||
import net.minecraft.network.protocol.game.ClientboundPlayerInfoUpdatePacket;
|
||||
import net.minecraft.network.protocol.game.ClientboundRemoveEntitiesPacket;
|
||||
import net.minecraft.network.protocol.game.ClientboundRotateHeadPacket;
|
||||
import net.minecraft.network.protocol.game.ClientboundSetEntityDataPacket;
|
||||
import net.minecraft.network.protocol.game.ClientboundSetEquipmentPacket;
|
||||
import net.minecraft.network.protocol.game.ClientboundSwingAnimationPacket;
|
||||
import net.minecraft.network.protocol.game.ClientboundPlayerInfoUpdatePacket.Action;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.level.ClientInformation;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.server.network.ServerGamePacketListenerImpl;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.entity.EquipmentSlot;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.component.SwingAnimation;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.craftbukkit.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class V26_2Npc extends ServerPlayer implements Npc {
|
||||
private final Location a;
|
||||
private List<Pair<EquipmentSlot, ItemStack>> b;
|
||||
|
||||
public V26_2Npc(MinecraftServer var1, ServerLevel var2, GameProfile var3, Location var4) {
|
||||
super(var1, var2, var3, ClientInformation.createDefault());
|
||||
this.snapTo(var4.getX(), var4.getY(), var4.getZ(), var4.getYaw(), var4.getPitch());
|
||||
this.entityData.set(DATA_PLAYER_MODE_CUSTOMISATION, (byte)-1);
|
||||
this.a = var4;
|
||||
}
|
||||
|
||||
public int a() {
|
||||
return this.getId();
|
||||
}
|
||||
|
||||
public Location b() {
|
||||
return this.a;
|
||||
}
|
||||
|
||||
public void a(List<Pair<EquipmentSlot, ItemStack>> var1) {
|
||||
this.b = var1;
|
||||
}
|
||||
|
||||
public void a(Player var1, boolean var2) {
|
||||
this.connection = this.b(var1);
|
||||
if (var2) {
|
||||
this.connection.send(new ClientboundPlayerInfoUpdatePacket(Action.ADD_PLAYER, this));
|
||||
this.connection
|
||||
.send(
|
||||
new ClientboundAddEntityPacket(
|
||||
this.getId(),
|
||||
this.getUUID(),
|
||||
this.position().x,
|
||||
this.position().y,
|
||||
this.position().z,
|
||||
this.getXRot(),
|
||||
this.getYRot(),
|
||||
this.getType(),
|
||||
0,
|
||||
this.getDeltaMovement(),
|
||||
this.getYHeadRot()
|
||||
)
|
||||
);
|
||||
this.connection.send(new ClientboundRotateHeadPacket(this, Mth.packDegrees(this.getYRot())));
|
||||
this.connection.send(new ClientboundSetEntityDataPacket(this.getId(), this.entityData.getNonDefaultValues()));
|
||||
if (this.b != null) {
|
||||
this.connection.send(new ClientboundSetEquipmentPacket(this.getId(), this.b));
|
||||
}
|
||||
|
||||
if (ServerVersion.b < 27 && ServerVersion.c < 3) {
|
||||
this.connection.send(new ClientboundAnimatePacket(this, 0));
|
||||
} else {
|
||||
this.connection.send(new ClientboundSwingAnimationPacket(this, InteractionHand.MAIN_HAND, SwingAnimation.DEFAULT));
|
||||
}
|
||||
} else {
|
||||
this.connection.send(new ClientboundRemoveEntitiesPacket(new int[]{this.getId()}));
|
||||
}
|
||||
}
|
||||
|
||||
private ServerGamePacketListenerImpl b(Player var1) {
|
||||
return ((CraftPlayer)var1).getHandle().connection;
|
||||
}
|
||||
|
||||
public void a(Player var1) {
|
||||
this.b(var1).send(new ClientboundPlayerInfoRemovePacket(List.of(this.uuid)));
|
||||
}
|
||||
}
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
package ro.fr33styler.arcade.platform.v26_2.npc;
|
||||
|
||||
import ro.fr33styler.arcade.platform.api.npc.NpcEquipment;
|
||||
import ro.fr33styler.arcade.platform.api.npc.NpcFactory;
|
||||
import ro.fr33styler.arcade.platform.api.npc.SkinTexture;
|
||||
|
||||
import com.google.common.collect.ImmutableMultimap;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import com.mojang.authlib.properties.Property;
|
||||
import com.mojang.authlib.properties.PropertyMap;
|
||||
import com.mojang.datafixers.util.Pair;
|
||||
import java.util.ArrayList;
|
||||
import java.util.UUID;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.entity.EquipmentSlot;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.craftbukkit.CraftWorld;
|
||||
import org.bukkit.craftbukkit.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class V26_2NpcFactory implements NpcFactory {
|
||||
private final Server a;
|
||||
|
||||
public V26_2NpcFactory(Server var1) {
|
||||
this.a = var1;
|
||||
}
|
||||
|
||||
public V26_2Npc a(Location var1, Player var2) {
|
||||
ServerPlayer var3 = ((CraftPlayer)var2).getHandle();
|
||||
GameProfile var4 = new GameProfile(UUID.randomUUID(), var2.getName(), var3.getGameProfile().properties());
|
||||
return new V26_2Npc(((CraftServer)this.a).getServer(), var3.level(), var4, var1);
|
||||
}
|
||||
|
||||
public V26_2Npc a(Location var1, String var2, SkinTexture var3) {
|
||||
CraftWorld var4 = (CraftWorld)var1.getWorld();
|
||||
ImmutableMultimap var5 = ImmutableMultimap.of("textures", new Property("textures", var3.a(), var3.b()));
|
||||
GameProfile var6 = new GameProfile(UUID.randomUUID(), var2, new PropertyMap(var5));
|
||||
return new V26_2Npc(((CraftServer)this.a).getServer(), var4.getHandle(), var6, var1);
|
||||
}
|
||||
|
||||
public V26_2Npc a(Location var1, String var2, SkinTexture var3, NpcEquipment var4) {
|
||||
V26_2Npc var5 = this.a(var1, var2, var3);
|
||||
ArrayList var6 = new ArrayList();
|
||||
var6.add(new Pair(EquipmentSlot.MAINHAND, CraftItemStack.asNMSCopy(var4.a())));
|
||||
var6.add(new Pair(EquipmentSlot.OFFHAND, CraftItemStack.asNMSCopy(var4.b())));
|
||||
var6.add(new Pair(EquipmentSlot.HEAD, CraftItemStack.asNMSCopy(var4.c())));
|
||||
var6.add(new Pair(EquipmentSlot.CHEST, CraftItemStack.asNMSCopy(var4.d())));
|
||||
var6.add(new Pair(EquipmentSlot.LEGS, CraftItemStack.asNMSCopy(var4.e())));
|
||||
var6.add(new Pair(EquipmentSlot.FEET, CraftItemStack.asNMSCopy(var4.f())));
|
||||
var5.a(var6);
|
||||
return var5;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user