1
0

Add PlayerData object to ServerPlayerEntity

This commit is contained in:
flewkey 2019-06-22 18:28:24 -07:00
parent ba951a7edf
commit cc1f7a0512
Signed by: flewkey
GPG Key ID: 94F56ADFD848851E
2 changed files with 18 additions and 6 deletions

View File

@ -1,15 +1,28 @@
--- a/net/minecraft/entity/player/ServerPlayerEntity.java
+++ b/net/minecraft/entity/player/ServerPlayerEntity.java
@@ -118,6 +118,8 @@
@@ -118,6 +118,9 @@
import net.minecraft.world.storage.WorldInfo;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
+import party._2a03.mc.server.Config; //Patched
+import party._2a03.mc.server.PlayerData; //Patched
+import party._2a03.mc.server.PlayerPosition; //Patched
public class ServerPlayerEntity extends PlayerEntity implements IContainerListener {
private static final Logger field_147102_bM = LogManager.getLogger();
@@ -170,8 +172,9 @@
@@ -156,6 +159,7 @@
public boolean field_71137_h;
public int field_71138_i;
public boolean field_71136_j;
+ public PlayerData player_data; //Patched
public ServerPlayerEntity(MinecraftServer p_i45285_1_, ServerWorld p_i45285_2_, GameProfile p_i45285_3_, PlayerInteractionManager p_i45285_4_) {
super(p_i45285_2_, p_i45285_3_);
@@ -167,11 +171,13 @@
this.field_192042_bX = p_i45285_1_.func_184103_al().func_192054_h(this);
this.field_70138_W = 1.0F;
this.func_205734_a(p_i45285_2_);
+ this.player_data = Config.getPlayer(this.func_110124_au().toString()); //Patched
}
private void func_205734_a(ServerWorld p_205734_1_) {
@ -21,7 +34,7 @@
int i = Math.max(0, this.field_71133_b.func_184108_a(p_205734_1_));
int j = MathHelper.func_76128_c(p_205734_1_.func_175723_af().func_177729_b((double)blockpos.func_177958_n(), (double)blockpos.func_177952_p()));
if (j < i) {
@@ -199,7 +202,7 @@
@@ -199,7 +205,7 @@
}
}
} else {

View File

@ -15,8 +15,7 @@ import party._2a03.mc.server.PlayerPosition;
public class HomeCommand {
public static void register(CommandDispatcher<CommandSource> dispatcher) {
LiteralArgumentBuilder<CommandSource> literalargumentbuilder = Commands.func_197057_a("home").executes((source) -> {
PlayerData player = Config.getPlayer(source.getSource().func_197035_h().func_110124_au().toString());
PlayerPosition position = player.getHome();
PlayerPosition position = source.getSource().func_197035_h().player_data.getHome();
if (position.world == null) {
source.getSource().func_197030_a(new TranslationTextComponent("Home not found, do /home set"), false);
return 1;
@ -26,8 +25,8 @@ public class HomeCommand {
return 1;
});
literalargumentbuilder.then(Commands.func_197057_a("set").executes((source) -> {
PlayerData player = Config.getPlayer(source.getSource().func_197035_h().func_110124_au().toString());
ServerPlayerEntity playerEntity = source.getSource().func_197035_h();
PlayerData player = playerEntity.player_data;
double x = playerEntity.field_70165_t;
double y = playerEntity.field_70163_u;
double z = playerEntity.field_70161_v;