mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-13 09:26:11 -04:00
Add own PlayerEntity to World entities
This commit is contained in:
parent
8ebcc20b82
commit
be4821daf3
@ -116,7 +116,9 @@ public class PacketHandler {
|
|||||||
connection.getPlayer().getWorld().setHardcore(pkg.isHardcore());
|
connection.getPlayer().getWorld().setHardcore(pkg.isHardcore());
|
||||||
connection.getMapping().setDimensions(pkg.getDimensions());
|
connection.getMapping().setDimensions(pkg.getDimensions());
|
||||||
connection.getPlayer().getWorld().setDimension(pkg.getDimension());
|
connection.getPlayer().getWorld().setDimension(pkg.getDimension());
|
||||||
connection.getPlayer().setEntity(new PlayerEntity(connection, pkg.getEntityId(), connection.getPlayer().getPlayerUUID(), null, null, connection.getPlayer().getPlayerName(), new PlayerPropertyData[]{}, null));
|
PlayerEntity entity = new PlayerEntity(connection, pkg.getEntityId(), connection.getPlayer().getPlayerUUID(), null, null, connection.getPlayer().getPlayerName(), new PlayerPropertyData[]{}, null);
|
||||||
|
connection.getPlayer().setEntity(entity);
|
||||||
|
connection.getPlayer().getWorld().addEntity(entity);
|
||||||
connection.getSender().sendChatMessage("I am alive! ~ Minosoft");
|
connection.getSender().sendChatMessage("I am alive! ~ Minosoft");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -374,13 +376,7 @@ public class PacketHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void handle(PacketEntityMetadata pkg) {
|
public void handle(PacketEntityMetadata pkg) {
|
||||||
Entity entity;
|
Entity entity= connection.getPlayer().getWorld().getEntity(pkg.getEntityId());
|
||||||
if (pkg.getEntityId() == connection.getPlayer().getEntity().getEntityId()) {
|
|
||||||
// our own meta data...set it
|
|
||||||
entity = connection.getPlayer().getEntity();
|
|
||||||
} else {
|
|
||||||
entity = connection.getPlayer().getWorld().getEntity(pkg.getEntityId());
|
|
||||||
}
|
|
||||||
if(entity == null){
|
if(entity == null){
|
||||||
// thanks mojang
|
// thanks mojang
|
||||||
return;
|
return;
|
||||||
@ -466,13 +462,7 @@ public class PacketHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void handle(PacketEntityEffect pkg) {
|
public void handle(PacketEntityEffect pkg) {
|
||||||
Entity entity;
|
Entity entity= connection.getPlayer().getWorld().getEntity(pkg.getEntityId());
|
||||||
if (pkg.getEntityId() == connection.getPlayer().getEntity().getEntityId()) {
|
|
||||||
// that's us!
|
|
||||||
entity = connection.getPlayer().getEntity();
|
|
||||||
} else {
|
|
||||||
entity = connection.getPlayer().getWorld().getEntity(pkg.getEntityId());
|
|
||||||
}
|
|
||||||
if(entity == null){
|
if(entity == null){
|
||||||
// thanks mojang
|
// thanks mojang
|
||||||
return;
|
return;
|
||||||
@ -481,13 +471,7 @@ public class PacketHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void handle(PacketRemoveEntityEffect pkg) {
|
public void handle(PacketRemoveEntityEffect pkg) {
|
||||||
Entity entity;
|
Entity entity = connection.getPlayer().getWorld().getEntity(pkg.getEntityId());
|
||||||
if (pkg.getEntityId() == connection.getPlayer().getEntity().getEntityId()) {
|
|
||||||
// that's us!
|
|
||||||
entity = connection.getPlayer().getEntity();
|
|
||||||
} else {
|
|
||||||
entity = connection.getPlayer().getWorld().getEntity(pkg.getEntityId());
|
|
||||||
}
|
|
||||||
if(entity == null){
|
if(entity == null){
|
||||||
// thanks mojang
|
// thanks mojang
|
||||||
return;
|
return;
|
||||||
@ -525,13 +509,7 @@ public class PacketHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void handle(PacketAttachEntity pkg) {
|
public void handle(PacketAttachEntity pkg) {
|
||||||
Entity entity;
|
Entity entity = connection.getPlayer().getWorld().getEntity(pkg.getEntityId());
|
||||||
if (pkg.getEntityId() == connection.getPlayer().getEntity().getEntityId()) {
|
|
||||||
// that's us!
|
|
||||||
entity = connection.getPlayer().getEntity();
|
|
||||||
} else {
|
|
||||||
entity = connection.getPlayer().getWorld().getEntity(pkg.getEntityId());
|
|
||||||
}
|
|
||||||
if(entity == null){
|
if(entity == null){
|
||||||
// thanks mojang
|
// thanks mojang
|
||||||
return;
|
return;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user