Fixed issues with placing blocks next to the loaders (No solution in 1.7) (#37)

This commit is contained in:
OmerBenGera 2022-03-11 20:22:30 +02:00
parent 27566f5e04
commit dbf47ce159
6 changed files with 60 additions and 0 deletions

View File

@ -4,6 +4,7 @@ import com.bgsoftware.wildloaders.api.npc.ChunkLoaderNPC;
import com.bgsoftware.wildloaders.handlers.NPCHandler; import com.bgsoftware.wildloaders.handlers.NPCHandler;
import com.bgsoftware.wildloaders.npc.DummyChannel; import com.bgsoftware.wildloaders.npc.DummyChannel;
import com.mojang.authlib.GameProfile; import com.mojang.authlib.GameProfile;
import net.minecraft.server.v1_12_R1.AxisAlignedBB;
import net.minecraft.server.v1_12_R1.DamageSource; import net.minecraft.server.v1_12_R1.DamageSource;
import net.minecraft.server.v1_12_R1.EntityPlayer; import net.minecraft.server.v1_12_R1.EntityPlayer;
import net.minecraft.server.v1_12_R1.EnumGamemode; import net.minecraft.server.v1_12_R1.EnumGamemode;
@ -32,6 +33,8 @@ import java.util.UUID;
public final class ChunkLoaderNPC_v1_12_R1 extends EntityPlayer implements ChunkLoaderNPC { public final class ChunkLoaderNPC_v1_12_R1 extends EntityPlayer implements ChunkLoaderNPC {
private static final AxisAlignedBB EMPTY_BOUND = new AxisAlignedBB(0D, 0D, 0D, 0D, 0D, 0D);
public ChunkLoaderNPC_v1_12_R1(Location location, UUID uuid){ public ChunkLoaderNPC_v1_12_R1(Location location, UUID uuid){
super(((CraftServer) Bukkit.getServer()).getServer(), super(((CraftServer) Bukkit.getServer()).getServer(),
((CraftWorld) location.getWorld()).getHandle(), ((CraftWorld) location.getWorld()).getHandle(),
@ -48,6 +51,8 @@ public final class ChunkLoaderNPC_v1_12_R1 extends EntityPlayer implements Chunk
world.players.add(this); world.players.add(this);
((WorldServer) world).getPlayerChunkMap().addPlayer(this); ((WorldServer) world).getPlayerChunkMap().addPlayer(this);
super.a(EMPTY_BOUND);
} }
@Override @Override
@ -55,6 +60,11 @@ public final class ChunkLoaderNPC_v1_12_R1 extends EntityPlayer implements Chunk
return super.getUniqueID(); return super.getUniqueID();
} }
@Override
public AxisAlignedBB getBoundingBox() {
return EMPTY_BOUND;
}
@Override @Override
public void die() { public void die() {
super.die(); super.die();

View File

@ -4,6 +4,7 @@ import com.bgsoftware.wildloaders.api.npc.ChunkLoaderNPC;
import com.bgsoftware.wildloaders.handlers.NPCHandler; import com.bgsoftware.wildloaders.handlers.NPCHandler;
import com.bgsoftware.wildloaders.npc.DummyChannel; import com.bgsoftware.wildloaders.npc.DummyChannel;
import com.mojang.authlib.GameProfile; import com.mojang.authlib.GameProfile;
import net.minecraft.server.v1_16_R3.AxisAlignedBB;
import net.minecraft.server.v1_16_R3.Chunk; import net.minecraft.server.v1_16_R3.Chunk;
import net.minecraft.server.v1_16_R3.EntityPlayer; import net.minecraft.server.v1_16_R3.EntityPlayer;
import net.minecraft.server.v1_16_R3.EnumGamemode; import net.minecraft.server.v1_16_R3.EnumGamemode;
@ -32,6 +33,8 @@ import java.util.UUID;
public final class ChunkLoaderNPC_v1_16_R3 extends EntityPlayer implements ChunkLoaderNPC { public final class ChunkLoaderNPC_v1_16_R3 extends EntityPlayer implements ChunkLoaderNPC {
private static final AxisAlignedBB EMPTY_BOUND = new AxisAlignedBB(0D, 0D, 0D, 0D, 0D, 0D);
private boolean dieCall = false; private boolean dieCall = false;
public ChunkLoaderNPC_v1_16_R3(Location location, UUID uuid) { public ChunkLoaderNPC_v1_16_R3(Location location, UUID uuid) {
@ -51,6 +54,8 @@ public final class ChunkLoaderNPC_v1_16_R3 extends EntityPlayer implements Chunk
setLocation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch()); setLocation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
((WorldServer) world).addPlayerJoin(this); ((WorldServer) world).addPlayerJoin(this);
super.a(EMPTY_BOUND);
} }
@Override @Override
@ -58,6 +63,11 @@ public final class ChunkLoaderNPC_v1_16_R3 extends EntityPlayer implements Chunk
return super.getUniqueID(); return super.getUniqueID();
} }
@Override
public AxisAlignedBB getBoundingBox() {
return EMPTY_BOUND;
}
@Override @Override
public void die() { public void die() {
if (!dieCall) { if (!dieCall) {

View File

@ -22,6 +22,7 @@ import net.minecraft.server.level.WorldServer;
import net.minecraft.server.network.PlayerConnection; import net.minecraft.server.network.PlayerConnection;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
import net.minecraft.world.level.EnumGamemode; import net.minecraft.world.level.EnumGamemode;
import net.minecraft.world.phys.AxisAlignedBB;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_17_R1.CraftWorld; import org.bukkit.craftbukkit.v1_17_R1.CraftWorld;
@ -29,6 +30,8 @@ import java.util.UUID;
public final class ChunkLoaderNPC_v1_17_R1 extends EntityPlayer implements ChunkLoaderNPC { public final class ChunkLoaderNPC_v1_17_R1 extends EntityPlayer implements ChunkLoaderNPC {
private static final AxisAlignedBB EMPTY_BOUND = new AxisAlignedBB(0D, 0D, 0D, 0D, 0D, 0D);
private static final ReflectMethod<Void> SET_GAMEMODE = new ReflectMethod<>(PlayerInteractManager.class, private static final ReflectMethod<Void> SET_GAMEMODE = new ReflectMethod<>(PlayerInteractManager.class,
1, EnumGamemode.class, EnumGamemode.class); 1, EnumGamemode.class, EnumGamemode.class);
@ -49,6 +52,8 @@ public final class ChunkLoaderNPC_v1_17_R1 extends EntityPlayer implements Chunk
setLocation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch()); setLocation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
((WorldServer) getWorld()).addPlayerJoin(this); ((WorldServer) getWorld()).addPlayerJoin(this);
super.a(EMPTY_BOUND);
} }
@Override @Override
@ -56,6 +61,11 @@ public final class ChunkLoaderNPC_v1_17_R1 extends EntityPlayer implements Chunk
return super.getUniqueID(); return super.getUniqueID();
} }
@Override
public AxisAlignedBB cs() {
return EMPTY_BOUND;
}
@Override @Override
public void a(Entity.RemovalReason removalReason) { public void a(Entity.RemovalReason removalReason) {
if(!dieCall) { if(!dieCall) {

View File

@ -19,6 +19,7 @@ import net.minecraft.server.level.EntityPlayer;
import net.minecraft.server.level.WorldServer; import net.minecraft.server.level.WorldServer;
import net.minecraft.server.network.PlayerConnection; import net.minecraft.server.network.PlayerConnection;
import net.minecraft.world.level.EnumGamemode; import net.minecraft.world.level.EnumGamemode;
import net.minecraft.world.phys.AxisAlignedBB;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_18_R1.CraftWorld; import org.bukkit.craftbukkit.v1_18_R1.CraftWorld;
@ -28,6 +29,8 @@ import static com.bgsoftware.wildloaders.nms.NMSMappings_v1_18_R1.*;
public final class ChunkLoaderNPC_v1_18_R1 extends EntityPlayer implements ChunkLoaderNPC { public final class ChunkLoaderNPC_v1_18_R1 extends EntityPlayer implements ChunkLoaderNPC {
private static final AxisAlignedBB EMPTY_BOUND = new AxisAlignedBB(0D, 0D, 0D, 0D, 0D, 0D);
private boolean dieCall = false; private boolean dieCall = false;
public ChunkLoaderNPC_v1_18_R1(MinecraftServer minecraftServer, Location location, UUID uuid){ public ChunkLoaderNPC_v1_18_R1(MinecraftServer minecraftServer, Location location, UUID uuid){
@ -45,6 +48,8 @@ public final class ChunkLoaderNPC_v1_18_R1 extends EntityPlayer implements Chunk
setLocation(this, location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch()); setLocation(this, location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
addPlayerJoin(getWorldServer(this), this); addPlayerJoin(getWorldServer(this), this);
super.a(EMPTY_BOUND);
} }
@Override @Override
@ -57,6 +62,11 @@ public final class ChunkLoaderNPC_v1_18_R1 extends EntityPlayer implements Chunk
ah(); ah();
} }
@Override
public AxisAlignedBB cx() {
return EMPTY_BOUND;
}
@Override @Override
public void a(RemovalReason removalReason) { public void a(RemovalReason removalReason) {
if(!dieCall) { if(!dieCall) {

View File

@ -19,6 +19,7 @@ import net.minecraft.server.level.EntityPlayer;
import net.minecraft.server.level.WorldServer; import net.minecraft.server.level.WorldServer;
import net.minecraft.server.network.PlayerConnection; import net.minecraft.server.network.PlayerConnection;
import net.minecraft.world.level.EnumGamemode; import net.minecraft.world.level.EnumGamemode;
import net.minecraft.world.phys.AxisAlignedBB;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_18_R2.CraftWorld; import org.bukkit.craftbukkit.v1_18_R2.CraftWorld;
@ -28,6 +29,8 @@ import static com.bgsoftware.wildloaders.nms.NMSMappings_v1_18_R2.*;
public final class ChunkLoaderNPC_v1_18_R2 extends EntityPlayer implements ChunkLoaderNPC { public final class ChunkLoaderNPC_v1_18_R2 extends EntityPlayer implements ChunkLoaderNPC {
private static final AxisAlignedBB EMPTY_BOUND = new AxisAlignedBB(0D, 0D, 0D, 0D, 0D, 0D);
private boolean dieCall = false; private boolean dieCall = false;
public ChunkLoaderNPC_v1_18_R2(MinecraftServer minecraftServer, Location location, UUID uuid){ public ChunkLoaderNPC_v1_18_R2(MinecraftServer minecraftServer, Location location, UUID uuid){
@ -45,6 +48,8 @@ public final class ChunkLoaderNPC_v1_18_R2 extends EntityPlayer implements Chunk
setLocation(this, location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch()); setLocation(this, location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
addPlayerJoin(getWorldServer(this), this); addPlayerJoin(getWorldServer(this), this);
super.a(EMPTY_BOUND);
} }
@Override @Override
@ -57,6 +62,11 @@ public final class ChunkLoaderNPC_v1_18_R2 extends EntityPlayer implements Chunk
ah(); ah();
} }
@Override
public AxisAlignedBB cx() {
return EMPTY_BOUND;
}
@Override @Override
public void a(RemovalReason removalReason) { public void a(RemovalReason removalReason) {
if(!dieCall) { if(!dieCall) {

View File

@ -4,6 +4,7 @@ import com.bgsoftware.wildloaders.api.npc.ChunkLoaderNPC;
import com.bgsoftware.wildloaders.handlers.NPCHandler; import com.bgsoftware.wildloaders.handlers.NPCHandler;
import com.bgsoftware.wildloaders.npc.DummyChannel; import com.bgsoftware.wildloaders.npc.DummyChannel;
import com.mojang.authlib.GameProfile; import com.mojang.authlib.GameProfile;
import net.minecraft.server.v1_8_R3.AxisAlignedBB;
import net.minecraft.server.v1_8_R3.DamageSource; import net.minecraft.server.v1_8_R3.DamageSource;
import net.minecraft.server.v1_8_R3.EntityPlayer; import net.minecraft.server.v1_8_R3.EntityPlayer;
import net.minecraft.server.v1_8_R3.EnumProtocolDirection; import net.minecraft.server.v1_8_R3.EnumProtocolDirection;
@ -32,6 +33,8 @@ import java.util.UUID;
public final class ChunkLoaderNPC_v1_8_R3 extends EntityPlayer implements ChunkLoaderNPC { public final class ChunkLoaderNPC_v1_8_R3 extends EntityPlayer implements ChunkLoaderNPC {
private static final AxisAlignedBB EMPTY_BOUND = new AxisAlignedBB(0D, 0D, 0D, 0D, 0D, 0D);
public ChunkLoaderNPC_v1_8_R3(Location location, UUID uuid){ public ChunkLoaderNPC_v1_8_R3(Location location, UUID uuid){
super(((CraftServer) Bukkit.getServer()).getServer(), super(((CraftServer) Bukkit.getServer()).getServer(),
((CraftWorld) location.getWorld()).getHandle(), ((CraftWorld) location.getWorld()).getHandle(),
@ -56,6 +59,8 @@ public final class ChunkLoaderNPC_v1_8_R3 extends EntityPlayer implements ChunkL
world.players.add(this); world.players.add(this);
((WorldServer) world).getPlayerChunkMap().addPlayer(this); ((WorldServer) world).getPlayerChunkMap().addPlayer(this);
super.a(EMPTY_BOUND);
} }
@Override @Override
@ -63,6 +68,11 @@ public final class ChunkLoaderNPC_v1_8_R3 extends EntityPlayer implements ChunkL
return super.getUniqueID(); return super.getUniqueID();
} }
@Override
public AxisAlignedBB getBoundingBox() {
return EMPTY_BOUND;
}
@Override @Override
public void die() { public void die() {
super.die(); super.die();