More old patch work, cleaned up static methods added to ItemStack, and various networking functions.
This commit is contained in:
parent
0067d3edce
commit
b40e2cc59e
44 changed files with 507 additions and 1170 deletions
|
@ -302,7 +302,7 @@
|
|||
|
||||
ItemStack itemstack1 = this.func_184582_a(entityequipmentslot);
|
||||
if (!ItemStack.func_77989_b(itemstack1, itemstack)) {
|
||||
+ if (!ItemStack.areItemStacksEqualUsingNBTShareTag(itemstack1, itemstack))
|
||||
+ if (!itemstack1.areShareTagsEqual(itemstack))
|
||||
((WorldServer)this.field_70170_p).func_73039_n().func_151247_a(this, new SPacketEntityEquipment(this.func_145782_y(), entityequipmentslot, itemstack1));
|
||||
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.living.LivingEquipmentChangeEvent(this, entityequipmentslot, itemstack, itemstack1));
|
||||
if (!itemstack.func_190926_b()) {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
ItemStack itemstack = ((Slot)this.field_75151_b.get(i)).func_75211_c();
|
||||
ItemStack itemstack1 = this.field_75153_a.get(i);
|
||||
if (!ItemStack.func_77989_b(itemstack1, itemstack)) {
|
||||
+ boolean clientStackChanged = !ItemStack.areItemStacksEqualUsingNBTShareTag(itemstack1, itemstack);
|
||||
+ boolean clientStackChanged = !itemstack1.areShareTagsEqual(itemstack);
|
||||
itemstack1 = itemstack.func_190926_b() ? ItemStack.field_190927_a : itemstack.func_77946_l();
|
||||
this.field_75153_a.set(i, itemstack1);
|
||||
|
||||
|
|
|
@ -193,7 +193,7 @@
|
|||
}
|
||||
|
||||
return multimap;
|
||||
@@ -874,4 +897,89 @@
|
||||
@@ -874,4 +897,37 @@
|
||||
public void func_190918_g(int p_190918_1_) {
|
||||
this.func_190917_f(-p_190918_1_);
|
||||
}
|
||||
|
@ -229,57 +229,5 @@
|
|||
+ private Item getItemRaw()
|
||||
+ {
|
||||
+ return this.field_151002_e;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Modeled after ItemStack.areItemStacksEqual
|
||||
+ * Uses Item.getNBTShareTag for comparison instead of NBT and capabilities.
|
||||
+ * Only used for comparing itemStacks that were transferred from server to client using Item.getNBTShareTag.
|
||||
+ */
|
||||
+ public static boolean areItemStacksEqualUsingNBTShareTag(ItemStack stackA, ItemStack stackB)
|
||||
+ {
|
||||
+ if (stackA.func_190926_b())
|
||||
+ return stackB.func_190926_b();
|
||||
+ else
|
||||
+ return !stackB.func_190926_b() && stackA.isItemStackEqualUsingNBTShareTag(stackB);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Modeled after ItemStack.isItemStackEqual
|
||||
+ * Uses Item.getNBTShareTag for comparison instead of NBT and capabilities.
|
||||
+ * Only used for comparing itemStacks that were transferred from server to client using Item.getNBTShareTag.
|
||||
+ */
|
||||
+ private boolean isItemStackEqualUsingNBTShareTag(ItemStack other)
|
||||
+ {
|
||||
+ return this.field_77994_a == other.field_77994_a && this.func_77973_b() == other.func_77973_b() && areItemStackShareTagsEqual(this, other);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Modeled after ItemStack.areItemStackTagsEqual
|
||||
+ * Uses Item.getNBTShareTag for comparison instead of NBT and capabilities.
|
||||
+ * Only used for comparing itemStacks that were transferred from server to client using Item.getNBTShareTag.
|
||||
+ */
|
||||
+ public static boolean areItemStackShareTagsEqual(ItemStack stackA, ItemStack stackB)
|
||||
+ {
|
||||
+ NBTTagCompound shareTagA = stackA.func_77973_b().getNBTShareTag(stackA);
|
||||
+ NBTTagCompound shareTagB = stackB.func_77973_b().getNBTShareTag(stackB);
|
||||
+ if (shareTagA == null)
|
||||
+ return shareTagB == null;
|
||||
+ else
|
||||
+ return shareTagB != null && shareTagA.equals(shareTagB);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ *
|
||||
+ * Should this item, when held, allow sneak-clicks to pass through to the underlying block?
|
||||
+ *
|
||||
+ * @param world The world
|
||||
+ * @param pos Block position in world
|
||||
+ * @param player The Player that is wielding the item
|
||||
+ * @return
|
||||
+ */
|
||||
+ public boolean doesSneakBypassUse(net.minecraft.world.IWorldReader world, BlockPos pos, EntityPlayer player)
|
||||
+ {
|
||||
+ return this.func_190926_b() || this.func_77973_b().doesSneakBypassUse(this, world, pos, player);
|
||||
+ }
|
||||
}
|
||||
|
|
|
@ -12,7 +12,57 @@
|
|||
this.field_147371_a.func_179290_a(new SPacketMoveVehicle(entity));
|
||||
return;
|
||||
}
|
||||
@@ -1265,5 +1267,7 @@
|
||||
@@ -791,7 +793,9 @@
|
||||
double d1 = this.field_147369_b.field_70163_u - ((double)blockpos.func_177956_o() + 0.5D) + 1.5D;
|
||||
double d2 = this.field_147369_b.field_70161_v - ((double)blockpos.func_177952_p() + 0.5D);
|
||||
double d3 = d0 * d0 + d1 * d1 + d2 * d2;
|
||||
- if (d3 > 36.0D) {
|
||||
+ double dist = field_147369_b.func_110148_a(EntityPlayer.REACH_DISTANCE).func_111126_e() + 1;
|
||||
+ dist *= dist;
|
||||
+ if (d3 > dist) {
|
||||
return;
|
||||
} else if (blockpos.func_177956_o() >= this.field_147367_d.func_71207_Z()) {
|
||||
return;
|
||||
@@ -830,7 +834,9 @@
|
||||
EnumFacing enumfacing = p_184337_1_.func_187024_b();
|
||||
this.field_147369_b.func_143004_u();
|
||||
if (blockpos.func_177956_o() < this.field_147367_d.func_71207_Z() - 1 || enumfacing != EnumFacing.UP && blockpos.func_177956_o() < this.field_147367_d.func_71207_Z()) {
|
||||
- if (this.field_184362_y == null && this.field_147369_b.func_70092_e((double)blockpos.func_177958_n() + 0.5D, (double)blockpos.func_177956_o() + 0.5D, (double)blockpos.func_177952_p() + 0.5D) < 64.0D && !this.field_147367_d.func_175579_a(worldserver, blockpos, this.field_147369_b) && worldserver.func_175723_af().func_177746_a(blockpos)) {
|
||||
+ double dist = field_147369_b.func_110148_a(EntityPlayer.REACH_DISTANCE).func_111126_e() + 3;
|
||||
+ dist *= dist;
|
||||
+ if (this.field_184362_y == null && this.field_147369_b.func_70092_e((double)blockpos.func_177958_n() + 0.5D, (double)blockpos.func_177956_o() + 0.5D, (double)blockpos.func_177952_p() + 0.5D) < dist && !this.field_147367_d.func_175579_a(worldserver, blockpos, this.field_147369_b) && worldserver.func_175723_af().func_177746_a(blockpos)) {
|
||||
this.field_147369_b.field_71134_c.func_187251_a(this.field_147369_b, worldserver, itemstack, enumhand, blockpos, enumfacing, p_184337_1_.func_187026_d(), p_184337_1_.func_187025_e(), p_184337_1_.func_187020_f());
|
||||
}
|
||||
} else {
|
||||
@@ -957,7 +963,9 @@
|
||||
if (s.startsWith("/")) {
|
||||
this.func_147361_d(s);
|
||||
} else {
|
||||
- ITextComponent itextcomponent = new TextComponentTranslation("chat.type.text", new Object[]{this.field_147369_b.func_145748_c_(), s});
|
||||
+ ITextComponent itextcomponent = new TextComponentTranslation("chat.type.text", new Object[]{this.field_147369_b.func_145748_c_(), net.minecraftforge.common.ForgeHooks.newChatWithLinks(s)});
|
||||
+ itextcomponent = net.minecraftforge.common.ForgeHooks.onServerChatEvent(this, s, itextcomponent);
|
||||
+ if (itextcomponent == null) return;
|
||||
this.field_147367_d.func_184103_al().func_148544_a(itextcomponent, false);
|
||||
}
|
||||
|
||||
@@ -1055,6 +1063,7 @@
|
||||
this.field_147369_b.func_190775_a(entity, enumhand);
|
||||
} else if (p_147340_1_.func_149565_c() == CPacketUseEntity.Action.INTERACT_AT) {
|
||||
EnumHand enumhand1 = p_147340_1_.func_186994_b();
|
||||
+ if (net.minecraftforge.common.ForgeHooks.onInteractEntityAt(field_147369_b, entity, p_147340_1_.func_179712_b(), enumhand1) != null) return;
|
||||
entity.func_184199_a(this.field_147369_b, p_147340_1_.func_179712_b(), enumhand1);
|
||||
} else if (p_147340_1_.func_149565_c() == CPacketUseEntity.Action.ATTACK) {
|
||||
if (entity instanceof EntityItem || entity instanceof EntityXPOrb || entity instanceof EntityArrow || entity == this.field_147369_b) {
|
||||
@@ -1085,7 +1094,7 @@
|
||||
return;
|
||||
}
|
||||
|
||||
- this.field_147369_b = this.field_147367_d.func_184103_al().func_72368_a(this.field_147369_b, 0, false);
|
||||
+ this.field_147369_b = this.field_147367_d.func_184103_al().func_72368_a(this.field_147369_b, field_147369_b.field_71093_bK, false);
|
||||
if (this.field_147367_d.func_71199_h()) {
|
||||
this.field_147369_b.func_71033_a(GameType.SPECTATOR);
|
||||
this.field_147369_b.func_71121_q().func_82736_K().func_82764_b("spectatorsGenerateChunks", "false", this.field_147367_d);
|
||||
@@ -1265,5 +1274,7 @@
|
||||
}
|
||||
|
||||
public void func_147349_a(CPacketCustomPayload p_147349_1_) {
|
||||
|
|
|
@ -1,16 +1,22 @@
|
|||
--- a/net/minecraft/network/NetworkManager.java
|
||||
+++ b/net/minecraft/network/NetworkManager.java
|
||||
@@ -383,6 +383,16 @@
|
||||
@@ -264,6 +264,7 @@
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public static NetworkManager func_181124_a(InetAddress p_181124_0_, int p_181124_1_, boolean p_181124_2_) {
|
||||
+ if (p_181124_0_ instanceof java.net.Inet6Address) System.setProperty("java.net.preferIPv4Stack", "false");
|
||||
final NetworkManager networkmanager = new NetworkManager(EnumPacketDirection.CLIENTBOUND);
|
||||
Class<? extends SocketChannel> oclass;
|
||||
LazyLoadBase<? extends EventLoopGroup> lazyloadbase;
|
||||
@@ -383,6 +384,14 @@
|
||||
return this.field_211397_t;
|
||||
}
|
||||
|
||||
+ public Channel channel()
|
||||
+ {
|
||||
+ public Channel channel() {
|
||||
+ return field_150746_k;
|
||||
+ }
|
||||
+
|
||||
+ public EnumPacketDirection getDirection()
|
||||
+ {
|
||||
+ public EnumPacketDirection getDirection() {
|
||||
+ return this.field_179294_g;
|
||||
+ }
|
||||
+
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
--- a/net/minecraft/network/NetworkSystem.java
|
||||
+++ b/net/minecraft/network/NetworkSystem.java
|
||||
@@ -41,12 +41,13 @@
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
public class NetworkSystem {
|
||||
+ private static final int READ_TIMEOUT = Integer.parseInt(System.getProperty("forge.readTimeout", "30"));
|
||||
private static final Logger field_151275_b = LogManager.getLogger();
|
||||
public static final LazyLoadBase<NioEventLoopGroup> field_151276_c = new LazyLoadBase<NioEventLoopGroup>(() -> {
|
||||
- return new NioEventLoopGroup(0, (new ThreadFactoryBuilder()).setNameFormat("Netty Server IO #%d").setDaemon(true).build());
|
||||
+ return new NioEventLoopGroup(0, (new ThreadFactoryBuilder()).setNameFormat("Netty Server IO #%d").setDaemon(true).setThreadFactory(net.minecraftforge.fml.common.thread.SidedThreadGroups.SERVER).build());
|
||||
});
|
||||
public static final LazyLoadBase<EpollEventLoopGroup> field_181141_b = new LazyLoadBase<EpollEventLoopGroup>(() -> {
|
||||
- return new EpollEventLoopGroup(0, (new ThreadFactoryBuilder()).setNameFormat("Netty Epoll Server IO #%d").setDaemon(true).build());
|
||||
+ return new EpollEventLoopGroup(0, (new ThreadFactoryBuilder()).setNameFormat("Netty Epoll Server IO #%d").setDaemon(true).setThreadFactory(net.minecraftforge.fml.common.thread.SidedThreadGroups.SERVER).build());
|
||||
});
|
||||
private final MinecraftServer field_151273_d;
|
||||
public volatile boolean field_151277_a;
|
||||
@@ -59,6 +60,7 @@
|
||||
}
|
||||
|
||||
public void func_151265_a(@Nullable InetAddress p_151265_1_, int p_151265_2_) throws IOException {
|
||||
+ if (p_151265_1_ instanceof java.net.Inet6Address) System.setProperty("java.net.preferIPv4Stack", "false");
|
||||
synchronized(this.field_151274_e) {
|
||||
Class<? extends ServerSocketChannel> oclass;
|
||||
LazyLoadBase<? extends EventLoopGroup> lazyloadbase;
|
||||
@@ -80,7 +82,7 @@
|
||||
;
|
||||
}
|
||||
|
||||
- p_initChannel_1_.pipeline().addLast("timeout", new ReadTimeoutHandler(30)).addLast("legacy_query", new LegacyPingHandler(NetworkSystem.this)).addLast("splitter", new NettyVarint21FrameDecoder()).addLast("decoder", new NettyPacketDecoder(EnumPacketDirection.SERVERBOUND)).addLast("prepender", new NettyVarint21FrameEncoder()).addLast("encoder", new NettyPacketEncoder(EnumPacketDirection.CLIENTBOUND));
|
||||
+ p_initChannel_1_.pipeline().addLast("timeout", new ReadTimeoutHandler(READ_TIMEOUT)).addLast("legacy_query", new LegacyPingHandler(NetworkSystem.this)).addLast("splitter", new NettyVarint21FrameDecoder()).addLast("decoder", new NettyPacketDecoder(EnumPacketDirection.SERVERBOUND)).addLast("prepender", new NettyVarint21FrameEncoder()).addLast("encoder", new NettyPacketEncoder(EnumPacketDirection.CLIENTBOUND));
|
||||
NetworkManager networkmanager = new NetworkManager(EnumPacketDirection.SERVERBOUND);
|
||||
NetworkSystem.this.field_151272_f.add(networkmanager);
|
||||
p_initChannel_1_.pipeline().addLast("packet_handler", networkmanager);
|
|
@ -0,0 +1,36 @@
|
|||
--- a/net/minecraft/network/PacketBuffer.java
|
||||
+++ b/net/minecraft/network/PacketBuffer.java
|
||||
@@ -256,6 +256,15 @@
|
||||
}
|
||||
|
||||
public PacketBuffer func_150788_a(ItemStack p_150788_1_) {
|
||||
+ return writeItemStack(p_150788_1_, true);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Most ItemStack serialization is Server to Client,and doesn't need to know the FULL tag details.
|
||||
+ * One exception is items from the creative menu, which must be sent from Client to Server with their full NBT.
|
||||
+ * If you want to send the FULL tag set limitedTag to false
|
||||
+ */
|
||||
+ public PacketBuffer writeItemStack(ItemStack p_150788_1_, boolean limitedTag) {
|
||||
if (p_150788_1_.func_190926_b()) {
|
||||
this.writeShort(-1);
|
||||
} else {
|
||||
@@ -264,7 +273,7 @@
|
||||
this.writeByte(p_150788_1_.func_190916_E());
|
||||
NBTTagCompound nbttagcompound = null;
|
||||
if (item.func_77645_m() || item.func_77651_p()) {
|
||||
- nbttagcompound = p_150788_1_.func_77978_p();
|
||||
+ nbttagcompound = limitedTag ? p_150788_1_.getShareTag() : p_150788_1_.func_77978_p();
|
||||
}
|
||||
|
||||
this.func_150786_a(nbttagcompound);
|
||||
@@ -280,7 +289,7 @@
|
||||
} else {
|
||||
int j = this.readByte();
|
||||
ItemStack itemstack = new ItemStack(Item.func_150899_d(i), j);
|
||||
- itemstack.func_77982_d(this.func_150793_b());
|
||||
+ itemstack.readShareTag(this.func_150793_b());
|
||||
return itemstack;
|
||||
}
|
||||
}
|
|
@ -30,5 +30,5 @@
|
|||
+
|
||||
+ public String getFMLVersion() {
|
||||
+ return this.fmlVersion;
|
||||
+ }
|
||||
}
|
||||
+}
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
--- a/net/minecraft/network/login/server/SPacketLoginSuccess.java
|
||||
+++ b/net/minecraft/network/login/server/SPacketLoginSuccess.java
|
||||
@@ -22,7 +22,7 @@
|
||||
public void func_148837_a(PacketBuffer p_148837_1_) throws IOException {
|
||||
String s = p_148837_1_.func_150789_c(36);
|
||||
String s1 = p_148837_1_.func_150789_c(16);
|
||||
- UUID uuid = UUID.fromString(s);
|
||||
+ UUID uuid = s.length() > 0 ? UUID.fromString(s) : null; // Forge: prevent exception with bad data.
|
||||
this.field_149602_a = new GameProfile(uuid, s1);
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
--- a/net/minecraft/network/play/client/CPacketClickWindow.java
|
||||
+++ b/net/minecraft/network/play/client/CPacketClickWindow.java
|
||||
@@ -49,7 +49,7 @@
|
||||
p_148840_1_.writeByte(this.field_149553_c);
|
||||
p_148840_1_.writeShort(this.field_149550_d);
|
||||
p_148840_1_.func_179249_a(this.field_149549_f);
|
||||
- p_148840_1_.func_150788_a(this.field_149551_e);
|
||||
+ p_148840_1_.writeItemStack(this.field_149551_e, false); //Forge: Include full tag for C->S
|
||||
}
|
||||
|
||||
public int func_149548_c() {
|
|
@ -0,0 +1,11 @@
|
|||
--- a/net/minecraft/network/play/client/CPacketCreativeInventoryAction.java
|
||||
+++ b/net/minecraft/network/play/client/CPacketCreativeInventoryAction.java
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
public void func_148840_b(PacketBuffer p_148840_1_) throws IOException {
|
||||
p_148840_1_.writeShort(this.field_149629_a);
|
||||
- p_148840_1_.func_150788_a(this.field_149628_b);
|
||||
+ p_148840_1_.writeItemStack(this.field_149628_b, false); //Forge: Include full tag for C->S
|
||||
}
|
||||
|
||||
public int func_149627_c() {
|
|
@ -10,3 +10,12 @@
|
|||
public static final ResourceLocation field_210344_a = new ResourceLocation("minecraft:brand");
|
||||
private ResourceLocation field_149562_a;
|
||||
private PacketBuffer field_149561_c;
|
||||
@@ -35,7 +36,7 @@
|
||||
|
||||
public void func_148840_b(PacketBuffer p_148840_1_) throws IOException {
|
||||
p_148840_1_.func_192572_a(this.field_149562_a);
|
||||
- p_148840_1_.writeBytes((ByteBuf)this.field_149561_c);
|
||||
+ p_148840_1_.writeBytes((ByteBuf)this.field_149561_c.copy()); //This may be access multiple times, from multiple threads, lets be safe like the S->C packet
|
||||
}
|
||||
|
||||
public void func_148833_a(INetHandlerPlayServer p_148833_1_) {
|
||||
|
|
|
@ -1,6 +1,33 @@
|
|||
--- a/net/minecraft/server/management/PlayerList.java
|
||||
+++ b/net/minecraft/server/management/PlayerList.java
|
||||
@@ -184,6 +184,7 @@
|
||||
@@ -113,7 +113,16 @@
|
||||
String s = gameprofile1 == null ? gameprofile.getName() : gameprofile1.getName();
|
||||
playerprofilecache.func_152649_a(gameprofile);
|
||||
NBTTagCompound nbttagcompound = this.func_72380_a(p_72355_2_);
|
||||
- p_72355_2_.func_70029_a(this.field_72400_f.func_71218_a(p_72355_2_.field_71093_bK));
|
||||
+
|
||||
+ //Forge: Make sure the dimension hasn't been deleted, if so stick them in the overworld.
|
||||
+ WorldServer playerWorld = this.field_72400_f.func_71218_a(p_72355_2_.field_71093_bK);
|
||||
+ if (playerWorld == null) {
|
||||
+ p_72355_2_.field_71093_bK = 0;
|
||||
+ playerWorld = this.field_72400_f.func_71218_a(p_72355_2_.field_71093_bK);
|
||||
+ p_72355_2_.func_70107_b(playerWorld.func_72912_H().func_76079_c(), playerWorld.func_72912_H().func_76075_d(), playerWorld.func_72912_H().func_76074_e());
|
||||
+ }
|
||||
+
|
||||
+ p_72355_2_.func_70029_a(playerWorld);
|
||||
p_72355_2_.field_71134_c.func_73080_a((WorldServer)p_72355_2_.field_70170_p);
|
||||
String s1 = "local";
|
||||
if (p_72355_1_.func_74430_c() != null) {
|
||||
@@ -125,7 +134,7 @@
|
||||
WorldInfo worldinfo = worldserver.func_72912_H();
|
||||
this.func_72381_a(p_72355_2_, (EntityPlayerMP)null, worldserver);
|
||||
NetHandlerPlayServer nethandlerplayserver = new NetHandlerPlayServer(this.field_72400_f, p_72355_1_, p_72355_2_);
|
||||
- nethandlerplayserver.func_147359_a(new SPacketJoinGame(p_72355_2_.func_145782_y(), p_72355_2_.field_71134_c.func_73081_b(), worldinfo.func_76093_s(), worldserver.field_73011_w.func_186058_p().func_186068_a(), worldserver.func_175659_aa(), this.func_72352_l(), worldinfo.func_76067_t(), worldserver.func_82736_K().func_82766_b("reducedDebugInfo")));
|
||||
+ nethandlerplayserver.func_147359_a(new SPacketJoinGame(p_72355_2_.func_145782_y(), p_72355_2_.field_71134_c.func_73081_b(), worldinfo.func_76093_s(), worldserver.field_73011_w.getId(), worldserver.func_175659_aa(), this.func_72352_l(), worldinfo.func_76067_t(), worldserver.func_82736_K().func_82766_b("reducedDebugInfo")));
|
||||
nethandlerplayserver.func_147359_a(new SPacketCustomPayload(SPacketCustomPayload.field_209911_b, (new PacketBuffer(Unpooled.buffer())).func_180714_a(this.func_72365_p().getServerModName())));
|
||||
nethandlerplayserver.func_147359_a(new SPacketServerDifficulty(worldinfo.func_176130_y(), worldinfo.func_176123_z()));
|
||||
nethandlerplayserver.func_147359_a(new SPacketPlayerAbilities(p_72355_2_.field_71075_bZ));
|
||||
@@ -184,6 +193,7 @@
|
||||
}
|
||||
|
||||
p_72355_2_.func_71116_b();
|
||||
|
@ -8,7 +35,31 @@
|
|||
}
|
||||
|
||||
protected void func_96456_a(ServerScoreboard p_96456_1_, EntityPlayerMP p_96456_2_) {
|
||||
@@ -307,6 +308,7 @@
|
||||
@@ -266,6 +276,7 @@
|
||||
nbttagcompound1 = nbttagcompound;
|
||||
p_72380_1_.func_70020_e(nbttagcompound);
|
||||
field_148546_d.debug("loading single player");
|
||||
+ net.minecraftforge.event.ForgeEventFactory.firePlayerLoadingEvent(p_72380_1_, this.field_72412_k, p_72380_1_.func_110124_au().toString());
|
||||
} else {
|
||||
nbttagcompound1 = this.field_72412_k.func_75752_b(p_72380_1_);
|
||||
}
|
||||
@@ -274,6 +285,7 @@
|
||||
}
|
||||
|
||||
protected void func_72391_b(EntityPlayerMP p_72391_1_) {
|
||||
+ if (p_72391_1_.field_71135_a == null) return;
|
||||
this.field_72412_k.func_75753_a(p_72391_1_);
|
||||
StatisticsManagerServer statisticsmanagerserver = this.field_148547_k.get(p_72391_1_.func_110124_au());
|
||||
if (statisticsmanagerserver != null) {
|
||||
@@ -297,6 +309,7 @@
|
||||
p_72377_1_.field_71135_a.func_147359_a(new SPacketPlayerListItem(SPacketPlayerListItem.Action.ADD_PLAYER, new EntityPlayerMP[]{this.field_72404_b.get(i)}));
|
||||
}
|
||||
|
||||
+ net.minecraftforge.common.chunkio.ChunkIOExecutor.adjustPoolSize(this.func_72394_k());
|
||||
worldserver.func_72838_d(p_72377_1_);
|
||||
this.func_72375_a(p_72377_1_, (WorldServer)null);
|
||||
this.field_72400_f.func_201300_aS().func_201383_a(p_72377_1_);
|
||||
@@ -307,6 +320,7 @@
|
||||
}
|
||||
|
||||
public void func_72367_e(EntityPlayerMP p_72367_1_) {
|
||||
|
@ -16,7 +67,56 @@
|
|||
WorldServer worldserver = p_72367_1_.func_71121_q();
|
||||
p_72367_1_.func_195066_a(StatList.field_75947_j);
|
||||
this.func_72391_b(p_72367_1_);
|
||||
@@ -453,6 +455,7 @@
|
||||
@@ -324,6 +338,7 @@
|
||||
worldserver.func_72964_e(p_72367_1_.field_70176_ah, p_72367_1_.field_70164_aj).func_76630_e();
|
||||
}
|
||||
}
|
||||
+ net.minecraftforge.common.chunkio.ChunkIOExecutor.adjustPoolSize(this.func_72394_k());
|
||||
|
||||
worldserver.func_72900_e(p_72367_1_);
|
||||
worldserver.func_184164_w().func_72695_c(p_72367_1_);
|
||||
@@ -397,13 +412,21 @@
|
||||
}
|
||||
|
||||
public EntityPlayerMP func_72368_a(EntityPlayerMP p_72368_1_, int p_72368_2_, boolean p_72368_3_) {
|
||||
+ WorldServer world = field_72400_f.func_71218_a(p_72368_2_);
|
||||
+ if (world == null)
|
||||
+ p_72368_2_ = p_72368_1_.getSpawnDimension();
|
||||
+ else if (!world.func_201675_m().func_76567_e())
|
||||
+ p_72368_2_ = world.func_201675_m().getRespawnDimension(p_72368_1_);
|
||||
+ if (field_72400_f.func_71218_a(p_72368_2_) == null)
|
||||
+ p_72368_2_ = 0;
|
||||
+
|
||||
p_72368_1_.func_71121_q().func_73039_n().func_72787_a(p_72368_1_);
|
||||
p_72368_1_.func_71121_q().func_73039_n().func_72790_b(p_72368_1_);
|
||||
p_72368_1_.func_71121_q().func_184164_w().func_72695_c(p_72368_1_);
|
||||
this.field_72404_b.remove(p_72368_1_);
|
||||
this.field_72400_f.func_71218_a(p_72368_1_.field_71093_bK).func_72973_f(p_72368_1_);
|
||||
- BlockPos blockpos = p_72368_1_.func_180470_cg();
|
||||
- boolean flag = p_72368_1_.func_82245_bX();
|
||||
+ BlockPos blockpos = p_72368_1_.getBedLocation(p_72368_2_);
|
||||
+ boolean flag = p_72368_1_.isSpawnForced(p_72368_2_);
|
||||
p_72368_1_.field_71093_bK = p_72368_2_;
|
||||
PlayerInteractionManager playerinteractionmanager;
|
||||
if (this.field_72400_f.func_71242_L()) {
|
||||
@@ -415,6 +438,7 @@
|
||||
EntityPlayerMP entityplayermp = new EntityPlayerMP(this.field_72400_f, this.field_72400_f.func_71218_a(p_72368_1_.field_71093_bK), p_72368_1_.func_146103_bH(), playerinteractionmanager);
|
||||
entityplayermp.field_71135_a = p_72368_1_.field_71135_a;
|
||||
entityplayermp.func_193104_a(p_72368_1_, p_72368_3_);
|
||||
+ entityplayermp.field_71093_bK = p_72368_2_;
|
||||
entityplayermp.func_145769_d(p_72368_1_.func_145782_y());
|
||||
entityplayermp.func_184819_a(p_72368_1_.func_184591_cq());
|
||||
|
||||
@@ -428,7 +452,7 @@
|
||||
BlockPos blockpos1 = EntityPlayer.func_180467_a(this.field_72400_f.func_71218_a(p_72368_1_.field_71093_bK), blockpos, flag);
|
||||
if (blockpos1 != null) {
|
||||
entityplayermp.func_70012_b((double)((float)blockpos1.func_177958_n() + 0.5F), (double)((float)blockpos1.func_177956_o() + 0.1F), (double)((float)blockpos1.func_177952_p() + 0.5F), 0.0F, 0.0F);
|
||||
- entityplayermp.func_180473_a(blockpos, flag);
|
||||
+ entityplayermp.setSpawnPoint(blockpos, flag, p_72368_1_.field_71093_bK);
|
||||
} else {
|
||||
entityplayermp.field_71135_a.func_147359_a(new SPacketChangeGameState(0, 0.0F));
|
||||
}
|
||||
@@ -453,6 +477,7 @@
|
||||
this.field_177454_f.put(entityplayermp.func_110124_au(), entityplayermp);
|
||||
entityplayermp.func_71116_b();
|
||||
entityplayermp.func_70606_j(entityplayermp.func_110143_aJ());
|
||||
|
@ -24,12 +124,86 @@
|
|||
return entityplayermp;
|
||||
}
|
||||
|
||||
@@ -482,7 +485,7 @@
|
||||
@@ -463,15 +488,19 @@
|
||||
}
|
||||
|
||||
public void func_187242_a(EntityPlayerMP p_187242_1_, int p_187242_2_) {
|
||||
+ changePlayerDimension(p_187242_1_, p_187242_2_, field_72400_f.func_71218_a(p_187242_2_).func_85176_s());
|
||||
+ }
|
||||
+
|
||||
+ public void changePlayerDimension(EntityPlayerMP p_187242_1_, int p_187242_2_, net.minecraftforge.common.util.ITeleporter teleporter) {
|
||||
int i = p_187242_1_.field_71093_bK;
|
||||
WorldServer worldserver = this.field_72400_f.func_71218_a(p_187242_1_.field_71093_bK);
|
||||
p_187242_1_.field_71093_bK = p_187242_2_;
|
||||
WorldServer worldserver1 = this.field_72400_f.func_71218_a(p_187242_1_.field_71093_bK);
|
||||
- p_187242_1_.field_71135_a.func_147359_a(new SPacketRespawn(p_187242_1_.field_71093_bK, p_187242_1_.field_70170_p.func_175659_aa(), p_187242_1_.field_70170_p.func_72912_H().func_76067_t(), p_187242_1_.field_71134_c.func_73081_b()));
|
||||
+ p_187242_1_.field_71135_a.func_147359_a(new SPacketRespawn(p_187242_1_.field_71093_bK, worldserver.func_175659_aa(), worldserver.func_72912_H().func_76067_t(), p_187242_1_.field_71134_c.func_73081_b()));
|
||||
this.func_187243_f(p_187242_1_);
|
||||
worldserver.func_72973_f(p_187242_1_);
|
||||
p_187242_1_.field_70128_L = false;
|
||||
- this.func_82448_a(p_187242_1_, i, worldserver, worldserver1);
|
||||
+ this.transferEntityToWorld(p_187242_1_, i, worldserver, worldserver1, teleporter);
|
||||
this.func_72375_a(p_187242_1_, worldserver);
|
||||
p_187242_1_.field_71135_a.func_147364_a(p_187242_1_.field_70165_t, p_187242_1_.field_70163_u, p_187242_1_.field_70161_v, p_187242_1_.field_70177_z, p_187242_1_.field_70125_A);
|
||||
p_187242_1_.field_71134_c.func_73080_a(worldserver1);
|
||||
@@ -482,30 +511,25 @@
|
||||
for(PotionEffect potioneffect : p_187242_1_.func_70651_bq()) {
|
||||
p_187242_1_.field_71135_a.func_147359_a(new SPacketEntityEffect(p_187242_1_.func_145782_y(), potioneffect));
|
||||
}
|
||||
-
|
||||
+ net.minecraftforge.fml.hooks.BasicEventHooks.firePlayerChangedDimensionEvent( p_187242_1_, i, p_187242_2_ );
|
||||
+ // Fix MC-88179: on non-death SPacketRespawn, also resend attributes
|
||||
+ net.minecraft.entity.ai.attributes.AttributeMap attributemap = (net.minecraft.entity.ai.attributes.AttributeMap) p_187242_1_.func_110140_aT();
|
||||
+ java.util.Collection<net.minecraft.entity.ai.attributes.IAttributeInstance> watchedAttribs = attributemap.func_111160_c();
|
||||
+ if (!watchedAttribs.isEmpty()) p_187242_1_.field_71135_a.func_147359_a(new net.minecraft.network.play.server.SPacketEntityProperties(p_187242_1_.func_145782_y(), watchedAttribs));
|
||||
+ net.minecraftforge.fml.hooks.BasicEventHooks.firePlayerChangedDimensionEvent(p_187242_1_, i, p_187242_2_);
|
||||
}
|
||||
|
||||
public void func_82448_a(Entity p_82448_1_, int p_82448_2_, WorldServer p_82448_3_, WorldServer p_82448_4_) {
|
||||
- double d0 = p_82448_1_.field_70165_t;
|
||||
- double d1 = p_82448_1_.field_70161_v;
|
||||
+ transferEntityToWorld(p_82448_1_, p_82448_2_, p_82448_3_, p_82448_4_, p_82448_4_.func_85176_s());
|
||||
+ }
|
||||
+
|
||||
+ public void transferEntityToWorld(Entity p_82448_1_, int p_82448_2_, WorldServer p_82448_3_, WorldServer p_82448_4_, net.minecraftforge.common.util.ITeleporter teleporter) {
|
||||
+ double moveFactor = p_82448_3_.func_201675_m().getMovementFactor() / p_82448_4_.func_201675_m().getMovementFactor();
|
||||
+ double d0 = MathHelper.func_151237_a(p_82448_1_.field_70165_t * moveFactor, p_82448_4_.func_175723_af().func_177726_b() + 16.0D, p_82448_4_.func_175723_af().func_177728_d() - 16.0D);
|
||||
+ double d1 = MathHelper.func_151237_a(p_82448_1_.field_70161_v * moveFactor, p_82448_4_.func_175723_af().func_177736_c() + 16.0D, p_82448_4_.func_175723_af().func_177733_e() - 16.0D);
|
||||
double d2 = 8.0D;
|
||||
float f = p_82448_1_.field_70177_z;
|
||||
p_82448_3_.field_72984_F.func_76320_a("moving");
|
||||
- if (p_82448_1_.field_71093_bK == -1) {
|
||||
- d0 = MathHelper.func_151237_a(d0 / 8.0D, p_82448_4_.func_175723_af().func_177726_b() + 16.0D, p_82448_4_.func_175723_af().func_177728_d() - 16.0D);
|
||||
- d1 = MathHelper.func_151237_a(d1 / 8.0D, p_82448_4_.func_175723_af().func_177736_c() + 16.0D, p_82448_4_.func_175723_af().func_177733_e() - 16.0D);
|
||||
- p_82448_1_.func_70012_b(d0, p_82448_1_.field_70163_u, d1, p_82448_1_.field_70177_z, p_82448_1_.field_70125_A);
|
||||
- if (p_82448_1_.func_70089_S()) {
|
||||
- p_82448_3_.func_72866_a(p_82448_1_, false);
|
||||
- }
|
||||
- } else if (p_82448_1_.field_71093_bK == 0) {
|
||||
- d0 = MathHelper.func_151237_a(d0 * 8.0D, p_82448_4_.func_175723_af().func_177726_b() + 16.0D, p_82448_4_.func_175723_af().func_177728_d() - 16.0D);
|
||||
- d1 = MathHelper.func_151237_a(d1 * 8.0D, p_82448_4_.func_175723_af().func_177736_c() + 16.0D, p_82448_4_.func_175723_af().func_177733_e() - 16.0D);
|
||||
- p_82448_1_.func_70012_b(d0, p_82448_1_.field_70163_u, d1, p_82448_1_.field_70177_z, p_82448_1_.field_70125_A);
|
||||
- if (p_82448_1_.func_70089_S()) {
|
||||
- p_82448_3_.func_72866_a(p_82448_1_, false);
|
||||
- }
|
||||
- } else {
|
||||
+ if (p_82448_1_.field_71093_bK == 1 && teleporter.isVanilla()) {
|
||||
BlockPos blockpos;
|
||||
if (p_82448_2_ == 1) {
|
||||
blockpos = p_82448_4_.func_175694_M();
|
||||
@@ -523,13 +547,14 @@
|
||||
}
|
||||
|
||||
p_82448_3_.field_72984_F.func_76319_b();
|
||||
- if (p_82448_2_ != 1) {
|
||||
+ if (p_82448_2_ != 1 || !teleporter.isVanilla()) {
|
||||
p_82448_3_.field_72984_F.func_76320_a("placing");
|
||||
d0 = (double)MathHelper.func_76125_a((int)d0, -29999872, 29999872);
|
||||
d1 = (double)MathHelper.func_76125_a((int)d1, -29999872, 29999872);
|
||||
if (p_82448_1_.func_70089_S()) {
|
||||
p_82448_1_.func_70012_b(d0, p_82448_1_.field_70163_u, d1, p_82448_1_.field_70177_z, p_82448_1_.field_70125_A);
|
||||
- p_82448_4_.func_85176_s().func_180266_a(p_82448_1_, f);
|
||||
+ p_82448_4_.func_72866_a(p_82448_1_, false);
|
||||
+ teleporter.placeEntity(p_82448_4_, p_82448_1_, f);
|
||||
p_82448_4_.func_72838_d(p_82448_1_);
|
||||
p_82448_4_.func_72866_a(p_82448_1_, false);
|
||||
}
|
||||
|
|
|
@ -22,6 +22,15 @@
|
|||
}
|
||||
|
||||
}
|
||||
@@ -140,7 +146,7 @@
|
||||
this.field_147335_k = p_147315_1_.func_149300_a(privatekey);
|
||||
this.field_147328_g = NetHandlerLoginServer.LoginState.AUTHENTICATING;
|
||||
this.field_147333_a.func_150727_a(this.field_147335_k);
|
||||
- Thread thread = new Thread("User Authenticator #" + field_147331_b.incrementAndGet()) {
|
||||
+ Thread thread = new Thread(net.minecraftforge.fml.common.thread.SidedThreadGroups.SERVER, "User Authenticator #" + field_147331_b.incrementAndGet()) {
|
||||
public void run() {
|
||||
GameProfile gameprofile = NetHandlerLoginServer.this.field_147337_i;
|
||||
|
||||
@@ -149,11 +155,11 @@
|
||||
NetHandlerLoginServer.this.field_147337_i = NetHandlerLoginServer.this.field_147327_f.func_147130_as().hasJoinedServer(new GameProfile((UUID)null, gameprofile.getName()), s, this.func_191235_a());
|
||||
if (NetHandlerLoginServer.this.field_147337_i != null) {
|
||||
|
|
|
@ -42,7 +42,15 @@
|
|||
if (entityplayer1 != null) {
|
||||
double d1 = entityplayer1.func_70068_e(p_82685_1_);
|
||||
if (!(d1 > d0)) {
|
||||
@@ -317,22 +320,47 @@
|
||||
@@ -276,6 +279,7 @@
|
||||
villagedoorinfo.func_75466_d();
|
||||
}
|
||||
|
||||
+ if (field_75586_a.func_175667_e(villagedoorinfo.func_179852_d())) // Forge: check that the door block is loaded to avoid loading chunks
|
||||
if (!this.func_179860_f(villagedoorinfo.func_179852_d()) || Math.abs(this.field_75581_g - villagedoorinfo.func_75473_b()) > 1200) {
|
||||
this.field_75585_c = this.field_75585_c.func_177973_b(villagedoorinfo.func_179852_d());
|
||||
flag = true;
|
||||
@@ -317,22 +321,47 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -51,12 +59,12 @@
|
|||
+ return this.getPlayerReputation(findUUID(p_82684_1_));
|
||||
+ }
|
||||
+
|
||||
+ public int getPlayerReputation(UUID p_82684_1_)
|
||||
+ public int getPlayerReputation(UUID p_82684_1_)
|
||||
+ {
|
||||
Integer integer = this.field_82693_j.get(p_82684_1_);
|
||||
return integer == null ? 0 : integer;
|
||||
}
|
||||
+
|
||||
|
||||
+ private UUID findUUID(String name)
|
||||
+ {
|
||||
+ if (this.field_75586_a == null || this.field_75586_a.func_73046_m() == null)
|
||||
|
@ -64,7 +72,7 @@
|
|||
+ GameProfile profile = this.field_75586_a.func_73046_m().func_152358_ax().func_152655_a(name);
|
||||
+ return profile == null ? EntityPlayer.func_175147_b(name) : profile.getId();
|
||||
+ }
|
||||
|
||||
+
|
||||
+ @Deprecated //Hasn't worked since 1.9, use UUID version below.
|
||||
public int func_82688_a(String p_82688_1_, int p_82688_2_) {
|
||||
- int i = this.func_82684_a(p_82688_1_);
|
||||
|
@ -86,13 +94,13 @@
|
|||
|
||||
+ public boolean isPlayerReputationTooLow(UUID uuid)
|
||||
+ {
|
||||
+ return this.getPlayerReputation(uuid) <= -15;
|
||||
+ return this.getPlayerReputation(uuid) <= -15;
|
||||
+ }
|
||||
+
|
||||
public void func_82690_a(NBTTagCompound p_82690_1_) {
|
||||
this.field_75588_h = p_82690_1_.func_74762_e("PopSize");
|
||||
this.field_75583_e = p_82690_1_.func_74762_e("Radius");
|
||||
@@ -354,17 +382,14 @@
|
||||
@@ -354,17 +383,14 @@
|
||||
|
||||
for(int j = 0; j < nbttaglist1.size(); ++j) {
|
||||
NBTTagCompound nbttagcompound1 = nbttaglist1.func_150305_b(j);
|
||||
|
@ -115,7 +123,7 @@
|
|||
}
|
||||
|
||||
public void func_82689_b(NBTTagCompound p_82689_1_) {
|
||||
@@ -396,14 +421,12 @@
|
||||
@@ -396,14 +422,12 @@
|
||||
p_82689_1_.func_74782_a("Doors", nbttaglist);
|
||||
NBTTagList nbttaglist1 = new NBTTagList();
|
||||
|
||||
|
@ -133,7 +141,7 @@
|
|||
nbttagcompound1.func_74768_a("S", this.field_82693_j.get(s));
|
||||
nbttaglist1.add((INBTBase)nbttagcompound1);
|
||||
}
|
||||
@@ -413,6 +436,8 @@
|
||||
@@ -413,6 +437,8 @@
|
||||
}
|
||||
|
||||
p_82689_1_.func_74782_a("Players", nbttaglist1);
|
||||
|
@ -142,7 +150,7 @@
|
|||
}
|
||||
|
||||
public void func_82692_h() {
|
||||
@@ -424,8 +449,8 @@
|
||||
@@ -424,8 +450,8 @@
|
||||
}
|
||||
|
||||
public void func_82683_b(int p_82683_1_) {
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
--- a/net/minecraft/village/VillageCollection.java
|
||||
+++ b/net/minecraft/village/VillageCollection.java
|
||||
@@ -125,6 +125,7 @@
|
||||
}
|
||||
|
||||
private void func_180609_b(BlockPos p_180609_1_) {
|
||||
+ if (!this.field_75556_a.func_205050_e(p_180609_1_, 16)) return; // Forge: prevent loading unloaded chunks when checking for doors
|
||||
int i = 16;
|
||||
int j = 4;
|
||||
int k = 16;
|
|
@ -1,62 +0,0 @@
|
|||
--- ../src-base/minecraft/net/minecraft/network/NetHandlerPlayServer.java
|
||||
+++ ../src-work/minecraft/net/minecraft/network/NetHandlerPlayServer.java
|
||||
@@ -671,7 +671,10 @@
|
||||
double d2 = this.field_147369_b.field_70161_v - ((double)blockpos.func_177952_p() + 0.5D);
|
||||
double d3 = d0 * d0 + d1 * d1 + d2 * d2;
|
||||
|
||||
- if (d3 > 36.0D)
|
||||
+ double dist = field_147369_b.func_110148_a(EntityPlayer.REACH_DISTANCE).func_111126_e() + 1;
|
||||
+ dist *= dist;
|
||||
+
|
||||
+ if (d3 > dist)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -729,7 +732,9 @@
|
||||
|
||||
if (blockpos.func_177956_o() < this.field_147367_d.func_71207_Z() - 1 || enumfacing != EnumFacing.UP && blockpos.func_177956_o() < this.field_147367_d.func_71207_Z())
|
||||
{
|
||||
- if (this.field_184362_y == null && this.field_147369_b.func_70092_e((double)blockpos.func_177958_n() + 0.5D, (double)blockpos.func_177956_o() + 0.5D, (double)blockpos.func_177952_p() + 0.5D) < 64.0D && !this.field_147367_d.func_175579_a(worldserver, blockpos, this.field_147369_b) && worldserver.func_175723_af().func_177746_a(blockpos))
|
||||
+ double dist = field_147369_b.func_110148_a(EntityPlayer.REACH_DISTANCE).func_111126_e() + 3;
|
||||
+ dist *= dist;
|
||||
+ if (this.field_184362_y == null && this.field_147369_b.func_70092_e((double)blockpos.func_177958_n() + 0.5D, (double)blockpos.func_177956_o() + 0.5D, (double)blockpos.func_177952_p() + 0.5D) < dist && !this.field_147367_d.func_175579_a(worldserver, blockpos, this.field_147369_b) && worldserver.func_175723_af().func_177746_a(blockpos))
|
||||
{
|
||||
this.field_147369_b.field_71134_c.func_187251_a(this.field_147369_b, worldserver, itemstack, enumhand, blockpos, enumfacing, p_184337_1_.func_187026_d(), p_184337_1_.func_187025_e(), p_184337_1_.func_187020_f());
|
||||
}
|
||||
@@ -933,7 +938,9 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
- ITextComponent itextcomponent = new TextComponentTranslation("chat.type.text", new Object[] {this.field_147369_b.func_145748_c_(), s});
|
||||
+ ITextComponent itextcomponent = new TextComponentTranslation("chat.type.text", this.field_147369_b.func_145748_c_(), net.minecraftforge.common.ForgeHooks.newChatWithLinks(s));
|
||||
+ itextcomponent = net.minecraftforge.common.ForgeHooks.onServerChatEvent(this, s, itextcomponent);
|
||||
+ if (itextcomponent == null) return;
|
||||
this.field_147367_d.func_184103_al().func_148544_a(itextcomponent, false);
|
||||
}
|
||||
|
||||
@@ -1066,6 +1073,7 @@
|
||||
else if (p_147340_1_.func_149565_c() == CPacketUseEntity.Action.INTERACT_AT)
|
||||
{
|
||||
EnumHand enumhand1 = p_147340_1_.func_186994_b();
|
||||
+ if(net.minecraftforge.common.ForgeHooks.onInteractEntityAt(field_147369_b, entity, p_147340_1_.func_179712_b(), enumhand1) != null) return;
|
||||
entity.func_184199_a(this.field_147369_b, p_147340_1_.func_179712_b(), enumhand1);
|
||||
}
|
||||
else if (p_147340_1_.func_149565_c() == CPacketUseEntity.Action.ATTACK)
|
||||
@@ -1106,7 +1114,7 @@
|
||||
return;
|
||||
}
|
||||
|
||||
- this.field_147369_b = this.field_147367_d.func_184103_al().func_72368_a(this.field_147369_b, 0, false);
|
||||
+ this.field_147369_b = this.field_147367_d.func_184103_al().func_72368_a(this.field_147369_b, field_147369_b.field_71093_bK, false);
|
||||
|
||||
if (this.field_147367_d.func_71199_h())
|
||||
{
|
||||
@@ -1149,7 +1157,7 @@
|
||||
{
|
||||
ItemStack itemstack2 = this.field_147369_b.field_71070_bA.func_184996_a(p_147351_1_.func_149544_d(), p_147351_1_.func_149543_e(), p_147351_1_.func_186993_f(), this.field_147369_b);
|
||||
|
||||
- if (ItemStack.func_77989_b(p_147351_1_.func_149546_g(), itemstack2))
|
||||
+ if (ItemStack.areItemStacksEqualUsingNBTShareTag(p_147351_1_.func_149546_g(), itemstack2))
|
||||
{
|
||||
this.field_147369_b.field_71135_a.func_147359_a(new SPacketConfirmTransaction(p_147351_1_.func_149548_c(), p_147351_1_.func_149547_f(), true));
|
||||
this.field_147369_b.field_71137_h = true;
|
|
@ -1,11 +0,0 @@
|
|||
--- ../src-base/minecraft/net/minecraft/network/NettyPacketEncoder.java
|
||||
+++ ../src-work/minecraft/net/minecraft/network/NettyPacketEncoder.java
|
||||
@@ -52,7 +52,7 @@
|
||||
}
|
||||
catch (Throwable throwable)
|
||||
{
|
||||
- field_150798_a.error(throwable);
|
||||
+ throw throwable; // Forge: throw this instead of logging it, to prevent corrupt packets from being sent to the client where they are much harder to debug.
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,44 +0,0 @@
|
|||
--- ../src-base/minecraft/net/minecraft/network/NetworkSystem.java
|
||||
+++ ../src-work/minecraft/net/minecraft/network/NetworkSystem.java
|
||||
@@ -49,21 +49,21 @@
|
||||
{
|
||||
protected NioEventLoopGroup func_179280_b()
|
||||
{
|
||||
- return new NioEventLoopGroup(0, (new ThreadFactoryBuilder()).setNameFormat("Netty Server IO #%d").setDaemon(true).build());
|
||||
+ return new NioEventLoopGroup(0, (new ThreadFactoryBuilder()).setNameFormat("Netty Server IO #%d").setDaemon(true).setThreadFactory(net.minecraftforge.fml.common.thread.SidedThreadGroups.SERVER).build());
|
||||
}
|
||||
};
|
||||
public static final LazyLoadBase<EpollEventLoopGroup> field_181141_b = new LazyLoadBase<EpollEventLoopGroup>()
|
||||
{
|
||||
protected EpollEventLoopGroup func_179280_b()
|
||||
{
|
||||
- return new EpollEventLoopGroup(0, (new ThreadFactoryBuilder()).setNameFormat("Netty Epoll Server IO #%d").setDaemon(true).build());
|
||||
+ return new EpollEventLoopGroup(0, (new ThreadFactoryBuilder()).setNameFormat("Netty Epoll Server IO #%d").setDaemon(true).setThreadFactory(net.minecraftforge.fml.common.thread.SidedThreadGroups.SERVER).build());
|
||||
}
|
||||
};
|
||||
public static final LazyLoadBase<LocalEventLoopGroup> field_180232_b = new LazyLoadBase<LocalEventLoopGroup>()
|
||||
{
|
||||
protected LocalEventLoopGroup func_179280_b()
|
||||
{
|
||||
- return new LocalEventLoopGroup(0, (new ThreadFactoryBuilder()).setNameFormat("Netty Local Server IO #%d").setDaemon(true).build());
|
||||
+ return new LocalEventLoopGroup(0, (new ThreadFactoryBuilder()).setNameFormat("Netty Local Server IO #%d").setDaemon(true).setThreadFactory(net.minecraftforge.fml.common.thread.SidedThreadGroups.CLIENT).build());
|
||||
}
|
||||
};
|
||||
private final MinecraftServer field_151273_d;
|
||||
@@ -79,6 +79,7 @@
|
||||
|
||||
public void func_151265_a(InetAddress p_151265_1_, int p_151265_2_) throws IOException
|
||||
{
|
||||
+ if (p_151265_1_ instanceof java.net.Inet6Address) System.setProperty("java.net.preferIPv4Stack", "false");
|
||||
synchronized (this.field_151274_e)
|
||||
{
|
||||
Class <? extends ServerSocketChannel > oclass;
|
||||
@@ -110,7 +111,7 @@
|
||||
;
|
||||
}
|
||||
|
||||
- p_initChannel_1_.pipeline().addLast("timeout", new ReadTimeoutHandler(30)).addLast("legacy_query", new LegacyPingHandler(NetworkSystem.this)).addLast("splitter", new NettyVarint21FrameDecoder()).addLast("decoder", new NettyPacketDecoder(EnumPacketDirection.SERVERBOUND)).addLast("prepender", new NettyVarint21FrameEncoder()).addLast("encoder", new NettyPacketEncoder(EnumPacketDirection.CLIENTBOUND));
|
||||
+ p_initChannel_1_.pipeline().addLast("timeout", new ReadTimeoutHandler(net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.READ_TIMEOUT)).addLast("legacy_query", new LegacyPingHandler(NetworkSystem.this)).addLast("splitter", new NettyVarint21FrameDecoder()).addLast("decoder", new NettyPacketDecoder(EnumPacketDirection.SERVERBOUND)).addLast("prepender", new NettyVarint21FrameEncoder()).addLast("encoder", new NettyPacketEncoder(EnumPacketDirection.CLIENTBOUND));
|
||||
NetworkManager networkmanager = new NetworkManager(EnumPacketDirection.SERVERBOUND);
|
||||
NetworkSystem.this.field_151272_f.add(networkmanager);
|
||||
p_initChannel_1_.pipeline().addLast("packet_handler", networkmanager);
|
|
@ -1,20 +0,0 @@
|
|||
--- ../src-base/minecraft/net/minecraft/network/PacketBuffer.java
|
||||
+++ ../src-work/minecraft/net/minecraft/network/PacketBuffer.java
|
||||
@@ -336,7 +336,7 @@
|
||||
|
||||
if (p_150788_1_.func_77973_b().func_77645_m() || p_150788_1_.func_77973_b().func_77651_p())
|
||||
{
|
||||
- nbttagcompound = p_150788_1_.func_77978_p();
|
||||
+ nbttagcompound = p_150788_1_.func_77973_b().getNBTShareTag(p_150788_1_);
|
||||
}
|
||||
|
||||
this.func_150786_a(nbttagcompound);
|
||||
@@ -358,7 +358,7 @@
|
||||
int j = this.readByte();
|
||||
int k = this.readShort();
|
||||
ItemStack itemstack = new ItemStack(Item.func_150899_d(i), j, k);
|
||||
- itemstack.func_77982_d(this.func_150793_b());
|
||||
+ itemstack.func_77973_b().readNBTShareTag(itemstack, this.func_150793_b());
|
||||
return itemstack;
|
||||
}
|
||||
}
|
|
@ -1,48 +0,0 @@
|
|||
--- ../src-base/minecraft/net/minecraft/network/handshake/client/C00Handshake.java
|
||||
+++ ../src-work/minecraft/net/minecraft/network/handshake/client/C00Handshake.java
|
||||
@@ -14,6 +14,7 @@
|
||||
private String field_149598_b;
|
||||
private int field_149599_c;
|
||||
private EnumConnectionState field_149597_d;
|
||||
+ private boolean hasFMLMarker = false;
|
||||
|
||||
public C00Handshake()
|
||||
{
|
||||
@@ -28,18 +29,26 @@
|
||||
this.field_149597_d = p_i47613_3_;
|
||||
}
|
||||
|
||||
+ public C00Handshake(String address, int port, EnumConnectionState state, boolean addFMLMarker)
|
||||
+ {
|
||||
+ this(address, port, state);
|
||||
+ this.hasFMLMarker = addFMLMarker;
|
||||
+ }
|
||||
+
|
||||
public void func_148837_a(PacketBuffer p_148837_1_) throws IOException
|
||||
{
|
||||
this.field_149600_a = p_148837_1_.func_150792_a();
|
||||
this.field_149598_b = p_148837_1_.func_150789_c(255);
|
||||
this.field_149599_c = p_148837_1_.readUnsignedShort();
|
||||
this.field_149597_d = EnumConnectionState.func_150760_a(p_148837_1_.func_150792_a());
|
||||
+ this.hasFMLMarker = this.field_149598_b.contains("\0FML\0");
|
||||
+ this.field_149598_b = this.field_149598_b.split("\0")[0];
|
||||
}
|
||||
|
||||
public void func_148840_b(PacketBuffer p_148840_1_) throws IOException
|
||||
{
|
||||
p_148840_1_.func_150787_b(this.field_149600_a);
|
||||
- p_148840_1_.func_180714_a(this.field_149598_b);
|
||||
+ p_148840_1_.func_180714_a(this.field_149598_b + "\0FML\0");
|
||||
p_148840_1_.writeShort(this.field_149599_c);
|
||||
p_148840_1_.func_150787_b(this.field_149597_d.func_150759_c());
|
||||
}
|
||||
@@ -58,4 +67,9 @@
|
||||
{
|
||||
return this.field_149600_a;
|
||||
}
|
||||
+
|
||||
+ public boolean hasFMLMarker()
|
||||
+ {
|
||||
+ return this.hasFMLMarker;
|
||||
+ }
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
--- ../src-base/minecraft/net/minecraft/network/login/server/SPacketLoginSuccess.java
|
||||
+++ ../src-work/minecraft/net/minecraft/network/login/server/SPacketLoginSuccess.java
|
||||
@@ -26,7 +26,7 @@
|
||||
{
|
||||
String s = p_148837_1_.func_150789_c(36);
|
||||
String s1 = p_148837_1_.func_150789_c(16);
|
||||
- UUID uuid = UUID.fromString(s);
|
||||
+ UUID uuid = s.length() > 0 ? UUID.fromString(s) : null;
|
||||
this.field_149602_a = new GameProfile(uuid, s1);
|
||||
}
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
--- ../src-base/minecraft/net/minecraft/network/play/client/CPacketClickWindow.java
|
||||
+++ ../src-work/minecraft/net/minecraft/network/play/client/CPacketClickWindow.java
|
||||
@@ -55,7 +55,7 @@
|
||||
p_148840_1_.writeByte(this.field_149553_c);
|
||||
p_148840_1_.writeShort(this.field_149550_d);
|
||||
p_148840_1_.func_179249_a(this.field_149549_f);
|
||||
- p_148840_1_.func_150788_a(this.field_149551_e);
|
||||
+ net.minecraftforge.common.util.PacketUtil.writeItemStackFromClientToServer(p_148840_1_, this.field_149551_e);
|
||||
}
|
||||
|
||||
public int func_149548_c()
|
|
@ -1,11 +0,0 @@
|
|||
--- ../src-base/minecraft/net/minecraft/network/play/client/CPacketCreativeInventoryAction.java
|
||||
+++ ../src-work/minecraft/net/minecraft/network/play/client/CPacketCreativeInventoryAction.java
|
||||
@@ -38,7 +38,7 @@
|
||||
public void func_148840_b(PacketBuffer p_148840_1_) throws IOException
|
||||
{
|
||||
p_148840_1_.writeShort(this.field_149629_a);
|
||||
- p_148840_1_.func_150788_a(this.field_149628_b);
|
||||
+ net.minecraftforge.common.util.PacketUtil.writeItemStackFromClientToServer(p_148840_1_, this.field_149628_b);
|
||||
}
|
||||
|
||||
public int func_149627_c()
|
|
@ -1,14 +0,0 @@
|
|||
--- ../src-base/minecraft/net/minecraft/network/play/client/CPacketCustomPayload.java
|
||||
+++ ../src-work/minecraft/net/minecraft/network/play/client/CPacketCustomPayload.java
|
||||
@@ -47,7 +47,11 @@
|
||||
public void func_148840_b(PacketBuffer p_148840_1_) throws IOException
|
||||
{
|
||||
p_148840_1_.func_180714_a(this.field_149562_a);
|
||||
+ synchronized(this.field_149561_c) { //This may be access multiple times, from multiple threads, lets be safe.
|
||||
+ this.field_149561_c.markReaderIndex();
|
||||
p_148840_1_.writeBytes((ByteBuf)this.field_149561_c);
|
||||
+ this.field_149561_c.resetReaderIndex();
|
||||
+ }
|
||||
}
|
||||
|
||||
public void func_148833_a(INetHandlerPlayServer p_148833_1_)
|
|
@ -1,21 +0,0 @@
|
|||
--- ../src-base/minecraft/net/minecraft/network/play/server/SPacketCustomPayload.java
|
||||
+++ ../src-work/minecraft/net/minecraft/network/play/server/SPacketCustomPayload.java
|
||||
@@ -46,12 +46,18 @@
|
||||
public void func_148840_b(PacketBuffer p_148840_1_) throws IOException
|
||||
{
|
||||
p_148840_1_.func_180714_a(this.field_149172_a);
|
||||
+ synchronized(this.field_149171_b) { //This may be access multiple times, from multiple threads, lets be safe.
|
||||
+ this.field_149171_b.markReaderIndex();
|
||||
p_148840_1_.writeBytes((ByteBuf)this.field_149171_b);
|
||||
+ this.field_149171_b.resetReaderIndex();
|
||||
+ }
|
||||
}
|
||||
|
||||
public void func_148833_a(INetHandlerPlayClient p_148833_1_)
|
||||
{
|
||||
p_148833_1_.func_147240_a(this);
|
||||
+ // Forge: fix network buffer leaks (MC-121884)
|
||||
+ if (this.field_149171_b != null) this.field_149171_b.release();
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
|
@ -1,11 +0,0 @@
|
|||
--- ../src-base/minecraft/net/minecraft/network/play/server/SPacketSpawnMob.java
|
||||
+++ ../src-work/minecraft/net/minecraft/network/play/server/SPacketSpawnMob.java
|
||||
@@ -38,7 +38,7 @@
|
||||
{
|
||||
this.field_149042_a = p_i46973_1_.func_145782_y();
|
||||
this.field_186894_b = p_i46973_1_.func_110124_au();
|
||||
- this.field_149040_b = EntityList.field_191308_b.func_148757_b(p_i46973_1_.getClass());
|
||||
+ this.field_149040_b = EntityList.getID(p_i46973_1_.getClass());
|
||||
this.field_149041_c = p_i46973_1_.field_70165_t;
|
||||
this.field_149038_d = p_i46973_1_.field_70163_u;
|
||||
this.field_149039_e = p_i46973_1_.field_70161_v;
|
|
@ -1,253 +0,0 @@
|
|||
--- ../src-base/minecraft/net/minecraft/server/management/PlayerList.java
|
||||
+++ ../src-work/minecraft/net/minecraft/server/management/PlayerList.java
|
||||
@@ -106,7 +106,7 @@
|
||||
this.field_72405_c = 8;
|
||||
}
|
||||
|
||||
- public void func_72355_a(NetworkManager p_72355_1_, EntityPlayerMP p_72355_2_)
|
||||
+ public void initializeConnectionToPlayer(NetworkManager p_72355_1_, EntityPlayerMP p_72355_2_, NetHandlerPlayServer nethandlerplayserver)
|
||||
{
|
||||
GameProfile gameprofile = p_72355_2_.func_146103_bH();
|
||||
PlayerProfileCache playerprofilecache = this.field_72400_f.func_152358_ax();
|
||||
@@ -115,6 +115,17 @@
|
||||
playerprofilecache.func_152649_a(gameprofile);
|
||||
NBTTagCompound nbttagcompound = this.func_72380_a(p_72355_2_);
|
||||
p_72355_2_.func_70029_a(this.field_72400_f.func_71218_a(p_72355_2_.field_71093_bK));
|
||||
+
|
||||
+ World playerWorld = this.field_72400_f.func_71218_a(p_72355_2_.field_71093_bK);
|
||||
+ if (playerWorld == null)
|
||||
+ {
|
||||
+ p_72355_2_.field_71093_bK = 0;
|
||||
+ playerWorld = this.field_72400_f.func_71218_a(0);
|
||||
+ BlockPos spawnPoint = playerWorld.field_73011_w.getRandomizedSpawnPoint();
|
||||
+ p_72355_2_.func_70107_b(spawnPoint.func_177958_n(), spawnPoint.func_177956_o(), spawnPoint.func_177952_p());
|
||||
+ }
|
||||
+
|
||||
+ p_72355_2_.func_70029_a(playerWorld);
|
||||
p_72355_2_.field_71134_c.func_73080_a((WorldServer)p_72355_2_.field_70170_p);
|
||||
String s1 = "local";
|
||||
|
||||
@@ -127,8 +138,9 @@
|
||||
WorldServer worldserver = this.field_72400_f.func_71218_a(p_72355_2_.field_71093_bK);
|
||||
WorldInfo worldinfo = worldserver.func_72912_H();
|
||||
this.func_72381_a(p_72355_2_, (EntityPlayerMP)null, worldserver);
|
||||
- NetHandlerPlayServer nethandlerplayserver = new NetHandlerPlayServer(this.field_72400_f, p_72355_1_, p_72355_2_);
|
||||
- nethandlerplayserver.func_147359_a(new SPacketJoinGame(p_72355_2_.func_145782_y(), p_72355_2_.field_71134_c.func_73081_b(), worldinfo.func_76093_s(), worldserver.field_73011_w.func_186058_p().func_186068_a(), worldserver.func_175659_aa(), this.func_72352_l(), worldinfo.func_76067_t(), worldserver.func_82736_K().func_82766_b("reducedDebugInfo")));
|
||||
+ p_72355_2_.field_71135_a = nethandlerplayserver;
|
||||
+ net.minecraftforge.fml.common.FMLCommonHandler.instance().fireServerConnectionEvent(p_72355_1_);
|
||||
+ nethandlerplayserver.func_147359_a(new SPacketJoinGame(p_72355_2_.func_145782_y(), p_72355_2_.field_71134_c.func_73081_b(), worldinfo.func_76093_s(), worldserver.field_73011_w.getDimension(), worldserver.func_175659_aa(), this.func_72352_l(), worldinfo.func_76067_t(), worldserver.func_82736_K().func_82766_b("reducedDebugInfo")));
|
||||
nethandlerplayserver.func_147359_a(new SPacketCustomPayload("MC|Brand", (new PacketBuffer(Unpooled.buffer())).func_180714_a(this.func_72365_p().getServerModName())));
|
||||
nethandlerplayserver.func_147359_a(new SPacketServerDifficulty(worldinfo.func_176130_y(), worldinfo.func_176123_z()));
|
||||
nethandlerplayserver.func_147359_a(new SPacketPlayerAbilities(p_72355_2_.field_71075_bZ));
|
||||
@@ -204,6 +216,7 @@
|
||||
}
|
||||
|
||||
p_72355_2_.func_71116_b();
|
||||
+ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerLoggedIn(p_72355_2_);
|
||||
}
|
||||
|
||||
protected void func_96456_a(ServerScoreboard p_96456_1_, EntityPlayerMP p_96456_2_)
|
||||
@@ -304,6 +317,7 @@
|
||||
nbttagcompound1 = nbttagcompound;
|
||||
p_72380_1_.func_70020_e(nbttagcompound);
|
||||
field_148546_d.debug("loading single player");
|
||||
+ net.minecraftforge.event.ForgeEventFactory.firePlayerLoadingEvent(p_72380_1_, this.field_72412_k, p_72380_1_.func_110124_au().toString());
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -313,8 +327,24 @@
|
||||
return nbttagcompound1;
|
||||
}
|
||||
|
||||
+ public NBTTagCompound getPlayerNBT(EntityPlayerMP player)
|
||||
+ {
|
||||
+ // Hacky method to allow loading the NBT for a player prior to login
|
||||
+ NBTTagCompound nbttagcompound = this.field_72400_f.field_71305_c[0].func_72912_H().func_76072_h();
|
||||
+ if (player.func_70005_c_().equals(this.field_72400_f.func_71214_G()) && nbttagcompound != null)
|
||||
+ {
|
||||
+ return nbttagcompound;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ return ((net.minecraft.world.storage.SaveHandler)this.field_72412_k).getPlayerNBT(player);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
protected void func_72391_b(EntityPlayerMP p_72391_1_)
|
||||
{
|
||||
+ if (p_72391_1_.field_71135_a == null) return;
|
||||
+
|
||||
this.field_72412_k.func_75753_a(p_72391_1_);
|
||||
StatisticsManagerServer statisticsmanagerserver = this.field_148547_k.get(p_72391_1_.func_110124_au());
|
||||
|
||||
@@ -343,6 +373,7 @@
|
||||
p_72377_1_.field_71135_a.func_147359_a(new SPacketPlayerListItem(SPacketPlayerListItem.Action.ADD_PLAYER, new EntityPlayerMP[] {this.field_72404_b.get(i)}));
|
||||
}
|
||||
|
||||
+ net.minecraftforge.common.chunkio.ChunkIOExecutor.adjustPoolSize(this.func_72394_k());
|
||||
worldserver.func_72838_d(p_72377_1_);
|
||||
this.func_72375_a(p_72377_1_, (WorldServer)null);
|
||||
}
|
||||
@@ -354,6 +385,7 @@
|
||||
|
||||
public void func_72367_e(EntityPlayerMP p_72367_1_)
|
||||
{
|
||||
+ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerLoggedOut(p_72367_1_);
|
||||
WorldServer worldserver = p_72367_1_.func_71121_q();
|
||||
p_72367_1_.func_71029_a(StatList.field_75947_j);
|
||||
this.func_72391_b(p_72367_1_);
|
||||
@@ -376,6 +408,7 @@
|
||||
worldserver.func_72964_e(p_72367_1_.field_70176_ah, p_72367_1_.field_70164_aj).func_76630_e();
|
||||
}
|
||||
}
|
||||
+ net.minecraftforge.common.chunkio.ChunkIOExecutor.adjustPoolSize(this.func_72394_k());
|
||||
|
||||
worldserver.func_72900_e(p_72367_1_);
|
||||
worldserver.func_184164_w().func_72695_c(p_72367_1_);
|
||||
@@ -473,13 +506,24 @@
|
||||
|
||||
public EntityPlayerMP func_72368_a(EntityPlayerMP p_72368_1_, int p_72368_2_, boolean p_72368_3_)
|
||||
{
|
||||
+ World world = field_72400_f.func_71218_a(p_72368_2_);
|
||||
+ if (world == null)
|
||||
+ {
|
||||
+ p_72368_2_ = p_72368_1_.getSpawnDimension();
|
||||
+ }
|
||||
+ else if (!world.field_73011_w.func_76567_e())
|
||||
+ {
|
||||
+ p_72368_2_ = world.field_73011_w.getRespawnDimension(p_72368_1_);
|
||||
+ }
|
||||
+ if (field_72400_f.func_71218_a(p_72368_2_) == null) p_72368_2_ = 0;
|
||||
+
|
||||
p_72368_1_.func_71121_q().func_73039_n().func_72787_a(p_72368_1_);
|
||||
p_72368_1_.func_71121_q().func_73039_n().func_72790_b(p_72368_1_);
|
||||
p_72368_1_.func_71121_q().func_184164_w().func_72695_c(p_72368_1_);
|
||||
this.field_72404_b.remove(p_72368_1_);
|
||||
this.field_72400_f.func_71218_a(p_72368_1_.field_71093_bK).func_72973_f(p_72368_1_);
|
||||
- BlockPos blockpos = p_72368_1_.func_180470_cg();
|
||||
- boolean flag = p_72368_1_.func_82245_bX();
|
||||
+ BlockPos blockpos = p_72368_1_.getBedLocation(p_72368_2_);
|
||||
+ boolean flag = p_72368_1_.isSpawnForced(p_72368_2_);
|
||||
p_72368_1_.field_71093_bK = p_72368_2_;
|
||||
PlayerInteractionManager playerinteractionmanager;
|
||||
|
||||
@@ -495,6 +539,7 @@
|
||||
EntityPlayerMP entityplayermp = new EntityPlayerMP(this.field_72400_f, this.field_72400_f.func_71218_a(p_72368_1_.field_71093_bK), p_72368_1_.func_146103_bH(), playerinteractionmanager);
|
||||
entityplayermp.field_71135_a = p_72368_1_.field_71135_a;
|
||||
entityplayermp.func_193104_a(p_72368_1_, p_72368_3_);
|
||||
+ entityplayermp.field_71093_bK = p_72368_2_;
|
||||
entityplayermp.func_145769_d(p_72368_1_.func_145782_y());
|
||||
entityplayermp.func_174817_o(p_72368_1_);
|
||||
entityplayermp.func_184819_a(p_72368_1_.func_184591_cq());
|
||||
@@ -542,6 +587,7 @@
|
||||
this.field_177454_f.put(entityplayermp.func_110124_au(), entityplayermp);
|
||||
entityplayermp.func_71116_b();
|
||||
entityplayermp.func_70606_j(entityplayermp.func_110143_aJ());
|
||||
+ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerRespawnEvent(entityplayermp, p_72368_3_);
|
||||
return entityplayermp;
|
||||
}
|
||||
|
||||
@@ -556,15 +602,26 @@
|
||||
|
||||
public void func_187242_a(EntityPlayerMP p_187242_1_, int p_187242_2_)
|
||||
{
|
||||
+ transferPlayerToDimension(p_187242_1_, p_187242_2_, field_72400_f.func_71218_a(p_187242_2_).func_85176_s());
|
||||
+ }
|
||||
+
|
||||
+ // TODO: Remove (1.13)
|
||||
+ public void transferPlayerToDimension(EntityPlayerMP p_187242_1_, int p_187242_2_, net.minecraft.world.Teleporter teleporter)
|
||||
+ {
|
||||
+ transferPlayerToDimension(p_187242_1_, p_187242_2_, (net.minecraftforge.common.util.ITeleporter) teleporter);
|
||||
+ }
|
||||
+
|
||||
+ public void transferPlayerToDimension(EntityPlayerMP p_187242_1_, int p_187242_2_, net.minecraftforge.common.util.ITeleporter teleporter)
|
||||
+ {
|
||||
int i = p_187242_1_.field_71093_bK;
|
||||
WorldServer worldserver = this.field_72400_f.func_71218_a(p_187242_1_.field_71093_bK);
|
||||
p_187242_1_.field_71093_bK = p_187242_2_;
|
||||
WorldServer worldserver1 = this.field_72400_f.func_71218_a(p_187242_1_.field_71093_bK);
|
||||
- p_187242_1_.field_71135_a.func_147359_a(new SPacketRespawn(p_187242_1_.field_71093_bK, p_187242_1_.field_70170_p.func_175659_aa(), p_187242_1_.field_70170_p.func_72912_H().func_76067_t(), p_187242_1_.field_71134_c.func_73081_b()));
|
||||
+ p_187242_1_.field_71135_a.func_147359_a(new SPacketRespawn(p_187242_1_.field_71093_bK, worldserver1.func_175659_aa(), worldserver1.func_72912_H().func_76067_t(), p_187242_1_.field_71134_c.func_73081_b()));
|
||||
this.func_187243_f(p_187242_1_);
|
||||
worldserver.func_72973_f(p_187242_1_);
|
||||
p_187242_1_.field_70128_L = false;
|
||||
- this.func_82448_a(p_187242_1_, i, worldserver, worldserver1);
|
||||
+ this.transferEntityToWorld(p_187242_1_, i, worldserver, worldserver1, teleporter);
|
||||
this.func_72375_a(p_187242_1_, worldserver);
|
||||
p_187242_1_.field_71135_a.func_147364_a(p_187242_1_.field_70165_t, p_187242_1_.field_70163_u, p_187242_1_.field_70161_v, p_187242_1_.field_70177_z, p_187242_1_.field_70125_A);
|
||||
p_187242_1_.field_71134_c.func_73080_a(worldserver1);
|
||||
@@ -576,17 +633,34 @@
|
||||
{
|
||||
p_187242_1_.field_71135_a.func_147359_a(new SPacketEntityEffect(p_187242_1_.func_145782_y(), potioneffect));
|
||||
}
|
||||
+ // Fix MC-88179: on non-death SPacketRespawn, also resend attributes
|
||||
+ net.minecraft.entity.ai.attributes.AttributeMap attributemap = (net.minecraft.entity.ai.attributes.AttributeMap) p_187242_1_.func_110140_aT();
|
||||
+ java.util.Collection<net.minecraft.entity.ai.attributes.IAttributeInstance> watchedAttribs = attributemap.func_111160_c();
|
||||
+ if (!watchedAttribs.isEmpty()) p_187242_1_.field_71135_a.func_147359_a(new net.minecraft.network.play.server.SPacketEntityProperties(p_187242_1_.func_145782_y(), watchedAttribs));
|
||||
+ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerChangedDimensionEvent(p_187242_1_, i, p_187242_2_);
|
||||
}
|
||||
|
||||
public void func_82448_a(Entity p_82448_1_, int p_82448_2_, WorldServer p_82448_3_, WorldServer p_82448_4_)
|
||||
{
|
||||
- double d0 = p_82448_1_.field_70165_t;
|
||||
- double d1 = p_82448_1_.field_70161_v;
|
||||
+ transferEntityToWorld(p_82448_1_, p_82448_2_, p_82448_3_, p_82448_4_, p_82448_4_.func_85176_s());
|
||||
+ }
|
||||
+
|
||||
+ // TODO: Remove (1.13)
|
||||
+ public void transferEntityToWorld(Entity p_82448_1_, int p_82448_2_, WorldServer p_82448_3_, WorldServer p_82448_4_, net.minecraft.world.Teleporter teleporter)
|
||||
+ {
|
||||
+ transferEntityToWorld(p_82448_1_, p_82448_2_, p_82448_3_, p_82448_4_, (net.minecraftforge.common.util.ITeleporter) teleporter);
|
||||
+ }
|
||||
+
|
||||
+ public void transferEntityToWorld(Entity p_82448_1_, int p_82448_2_, WorldServer p_82448_3_, WorldServer p_82448_4_, net.minecraftforge.common.util.ITeleporter teleporter)
|
||||
+ {
|
||||
+ double moveFactor = p_82448_3_.field_73011_w.getMovementFactor() / p_82448_4_.field_73011_w.getMovementFactor();
|
||||
+ double d0 = MathHelper.func_151237_a(p_82448_1_.field_70165_t * moveFactor, p_82448_4_.func_175723_af().func_177726_b() + 16.0D, p_82448_4_.func_175723_af().func_177728_d() - 16.0D);
|
||||
+ double d1 = MathHelper.func_151237_a(p_82448_1_.field_70161_v * moveFactor, p_82448_4_.func_175723_af().func_177736_c() + 16.0D, p_82448_4_.func_175723_af().func_177733_e() - 16.0D);
|
||||
double d2 = 8.0D;
|
||||
float f = p_82448_1_.field_70177_z;
|
||||
p_82448_3_.field_72984_F.func_76320_a("moving");
|
||||
|
||||
- if (p_82448_1_.field_71093_bK == -1)
|
||||
+ if (false && p_82448_1_.field_71093_bK == -1)
|
||||
{
|
||||
d0 = MathHelper.func_151237_a(d0 / 8.0D, p_82448_4_.func_175723_af().func_177726_b() + 16.0D, p_82448_4_.func_175723_af().func_177728_d() - 16.0D);
|
||||
d1 = MathHelper.func_151237_a(d1 / 8.0D, p_82448_4_.func_175723_af().func_177736_c() + 16.0D, p_82448_4_.func_175723_af().func_177733_e() - 16.0D);
|
||||
@@ -597,7 +671,7 @@
|
||||
p_82448_3_.func_72866_a(p_82448_1_, false);
|
||||
}
|
||||
}
|
||||
- else if (p_82448_1_.field_71093_bK == 0)
|
||||
+ else if (false && p_82448_1_.field_71093_bK == 0)
|
||||
{
|
||||
d0 = MathHelper.func_151237_a(d0 * 8.0D, p_82448_4_.func_175723_af().func_177726_b() + 16.0D, p_82448_4_.func_175723_af().func_177728_d() - 16.0D);
|
||||
d1 = MathHelper.func_151237_a(d1 * 8.0D, p_82448_4_.func_175723_af().func_177736_c() + 16.0D, p_82448_4_.func_175723_af().func_177733_e() - 16.0D);
|
||||
@@ -608,7 +682,7 @@
|
||||
p_82448_3_.func_72866_a(p_82448_1_, false);
|
||||
}
|
||||
}
|
||||
- else
|
||||
+ if (p_82448_1_.field_71093_bK == 1 && teleporter.isVanilla())
|
||||
{
|
||||
BlockPos blockpos;
|
||||
|
||||
@@ -634,7 +708,7 @@
|
||||
|
||||
p_82448_3_.field_72984_F.func_76319_b();
|
||||
|
||||
- if (p_82448_2_ != 1)
|
||||
+ if (p_82448_2_ != 1 || !teleporter.isVanilla())
|
||||
{
|
||||
p_82448_3_.field_72984_F.func_76320_a("placing");
|
||||
d0 = (double)MathHelper.func_76125_a((int)d0, -29999872, 29999872);
|
||||
@@ -643,7 +717,8 @@
|
||||
if (p_82448_1_.func_70089_S())
|
||||
{
|
||||
p_82448_1_.func_70012_b(d0, p_82448_1_.field_70163_u, d1, p_82448_1_.field_70177_z, p_82448_1_.field_70125_A);
|
||||
- p_82448_4_.func_85176_s().func_180266_a(p_82448_1_, f);
|
||||
+ p_82448_3_.func_72866_a(p_82448_1_, false);
|
||||
+ teleporter.placeEntity(p_82448_4_, p_82448_1_, f);
|
||||
p_82448_4_.func_72838_d(p_82448_1_);
|
||||
p_82448_4_.func_72866_a(p_82448_1_, false);
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
--- ../src-base/minecraft/net/minecraft/server/network/NetHandlerHandshakeTCP.java
|
||||
+++ ../src-work/minecraft/net/minecraft/server/network/NetHandlerHandshakeTCP.java
|
||||
@@ -22,6 +22,8 @@
|
||||
|
||||
public void func_147383_a(C00Handshake p_147383_1_)
|
||||
{
|
||||
+ if (!net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerHandshake(p_147383_1_, this.field_147386_b)) return;
|
||||
+
|
||||
switch (p_147383_1_.func_149594_c())
|
||||
{
|
||||
case LOGIN:
|
|
@ -1,21 +0,0 @@
|
|||
--- ../src-base/minecraft/net/minecraft/stats/RecipeBook.java
|
||||
+++ ../src-work/minecraft/net/minecraft/stats/RecipeBook.java
|
||||
@@ -42,9 +42,17 @@
|
||||
this.field_194078_b.clear(i);
|
||||
}
|
||||
|
||||
+ @Deprecated //DO NOT USE
|
||||
protected static int func_194075_d(@Nullable IRecipe p_194075_0_)
|
||||
{
|
||||
- return CraftingManager.field_193380_a.func_148757_b(p_194075_0_);
|
||||
+ int ret = CraftingManager.field_193380_a.func_148757_b(p_194075_0_);
|
||||
+ if (ret == -1)
|
||||
+ {
|
||||
+ ret = ((net.minecraftforge.registries.ForgeRegistry<IRecipe>)net.minecraftforge.fml.common.registry.ForgeRegistries.RECIPES).getID(p_194075_0_.getRegistryName());
|
||||
+ if (ret == -1)
|
||||
+ throw new IllegalArgumentException(String.format("Attempted to get the ID for a unknown recipe: %s Name: %s", p_194075_0_, p_194075_0_.getRegistryName()));
|
||||
+ }
|
||||
+ return ret;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
|
@ -1,19 +0,0 @@
|
|||
--- ../src-base/minecraft/net/minecraft/stats/RecipeBookServer.java
|
||||
+++ ../src-work/minecraft/net/minecraft/stats/RecipeBookServer.java
|
||||
@@ -55,7 +55,7 @@
|
||||
|
||||
private void func_194081_a(SPacketRecipeBook.State p_194081_1_, EntityPlayerMP p_194081_2_, List<IRecipe> p_194081_3_)
|
||||
{
|
||||
- p_194081_2_.field_71135_a.func_147359_a(new SPacketRecipeBook(p_194081_1_, p_194081_3_, Collections.emptyList(), this.field_192818_b, this.field_192819_c));
|
||||
+ net.minecraftforge.common.ForgeHooks.sendRecipeBook(p_194081_2_.field_71135_a, p_194081_1_, p_194081_3_, Collections.emptyList(), this.field_192818_b, this.field_192819_c);
|
||||
}
|
||||
|
||||
public NBTTagCompound func_192824_e()
|
||||
@@ -147,6 +147,6 @@
|
||||
|
||||
public void func_192826_c(EntityPlayerMP p_192826_1_)
|
||||
{
|
||||
- p_192826_1_.field_71135_a.func_147359_a(new SPacketRecipeBook(SPacketRecipeBook.State.INIT, this.func_194079_d(), this.func_194080_e(), this.field_192818_b, this.field_192819_c));
|
||||
+ net.minecraftforge.common.ForgeHooks.sendRecipeBook(p_192826_1_.field_71135_a, SPacketRecipeBook.State.INIT, this.func_194079_d(), this.func_194080_e(), this.field_192818_b, this.field_192819_c);
|
||||
}
|
||||
}
|
|
@ -1,138 +0,0 @@
|
|||
--- ../src-base/minecraft/net/minecraft/stats/StatList.java
|
||||
+++ ../src-work/minecraft/net/minecraft/stats/StatList.java
|
||||
@@ -162,7 +162,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
- func_75924_a(field_188066_af);
|
||||
+ replaceAllSimilarBlocks(field_188066_af, true);
|
||||
}
|
||||
|
||||
private static void func_151181_c()
|
||||
@@ -184,7 +184,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
- func_75924_a(field_188065_ae);
|
||||
+ replaceAllSimilarBlocks(field_188065_ae, false);
|
||||
}
|
||||
|
||||
private static void func_75925_c()
|
||||
@@ -208,7 +208,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
- func_75924_a(field_75929_E);
|
||||
+ replaceAllSimilarBlocks(field_75929_E, true);
|
||||
}
|
||||
|
||||
private static void func_151179_e()
|
||||
@@ -227,7 +227,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
- func_75924_a(field_75930_F);
|
||||
+ replaceAllSimilarBlocks(field_75930_F, true);
|
||||
}
|
||||
|
||||
private static void func_188054_f()
|
||||
@@ -247,7 +247,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
- func_75924_a(field_75930_F);
|
||||
+ replaceAllSimilarBlocks(field_75930_F, true);
|
||||
}
|
||||
|
||||
private static String func_180204_a(Item p_180204_0_)
|
||||
@@ -256,28 +256,35 @@
|
||||
return resourcelocation != null ? resourcelocation.toString().replace(':', '.') : null;
|
||||
}
|
||||
|
||||
- private static void func_75924_a(StatBase[] p_75924_0_)
|
||||
+ private static void replaceAllSimilarBlocks(StatBase[] p_75924_0_, boolean useItemIds)
|
||||
{
|
||||
- func_151180_a(p_75924_0_, Blocks.field_150355_j, Blocks.field_150358_i);
|
||||
- func_151180_a(p_75924_0_, Blocks.field_150353_l, Blocks.field_150356_k);
|
||||
- func_151180_a(p_75924_0_, Blocks.field_150428_aP, Blocks.field_150423_aK);
|
||||
- func_151180_a(p_75924_0_, Blocks.field_150470_am, Blocks.field_150460_al);
|
||||
- func_151180_a(p_75924_0_, Blocks.field_150439_ay, Blocks.field_150450_ax);
|
||||
- func_151180_a(p_75924_0_, Blocks.field_150416_aS, Blocks.field_150413_aR);
|
||||
- func_151180_a(p_75924_0_, Blocks.field_150455_bV, Blocks.field_150441_bU);
|
||||
- func_151180_a(p_75924_0_, Blocks.field_150429_aA, Blocks.field_150437_az);
|
||||
- func_151180_a(p_75924_0_, Blocks.field_150374_bv, Blocks.field_150379_bu);
|
||||
- func_151180_a(p_75924_0_, Blocks.field_150334_T, Blocks.field_150333_U);
|
||||
- func_151180_a(p_75924_0_, Blocks.field_150373_bw, Blocks.field_150376_bx);
|
||||
- func_151180_a(p_75924_0_, Blocks.field_180388_cO, Blocks.field_180389_cP);
|
||||
- func_151180_a(p_75924_0_, Blocks.field_150349_c, Blocks.field_150346_d);
|
||||
- func_151180_a(p_75924_0_, Blocks.field_150458_ak, Blocks.field_150346_d);
|
||||
+ mergeStatBases(p_75924_0_, Blocks.field_150355_j, Blocks.field_150358_i, useItemIds);
|
||||
+ mergeStatBases(p_75924_0_, Blocks.field_150353_l, Blocks.field_150356_k, useItemIds);
|
||||
+ mergeStatBases(p_75924_0_, Blocks.field_150428_aP, Blocks.field_150423_aK, useItemIds);
|
||||
+ mergeStatBases(p_75924_0_, Blocks.field_150470_am, Blocks.field_150460_al, useItemIds);
|
||||
+ mergeStatBases(p_75924_0_, Blocks.field_150439_ay, Blocks.field_150450_ax, useItemIds);
|
||||
+ mergeStatBases(p_75924_0_, Blocks.field_150416_aS, Blocks.field_150413_aR, useItemIds);
|
||||
+ mergeStatBases(p_75924_0_, Blocks.field_150455_bV, Blocks.field_150441_bU, useItemIds);
|
||||
+ mergeStatBases(p_75924_0_, Blocks.field_150429_aA, Blocks.field_150437_az, useItemIds);
|
||||
+ mergeStatBases(p_75924_0_, Blocks.field_150374_bv, Blocks.field_150379_bu, useItemIds);
|
||||
+ mergeStatBases(p_75924_0_, Blocks.field_150334_T, Blocks.field_150333_U, useItemIds);
|
||||
+ mergeStatBases(p_75924_0_, Blocks.field_150373_bw, Blocks.field_150376_bx, useItemIds);
|
||||
+ mergeStatBases(p_75924_0_, Blocks.field_180388_cO, Blocks.field_180389_cP, useItemIds);
|
||||
+ mergeStatBases(p_75924_0_, Blocks.field_150349_c, Blocks.field_150346_d, useItemIds);
|
||||
+ mergeStatBases(p_75924_0_, Blocks.field_150458_ak, Blocks.field_150346_d, useItemIds);
|
||||
}
|
||||
|
||||
- private static void func_151180_a(StatBase[] p_151180_0_, Block p_151180_1_, Block p_151180_2_)
|
||||
+ private static void mergeStatBases(StatBase[] p_151180_0_, Block p_151180_1_, Block p_151180_2_, boolean useItemIds)
|
||||
{
|
||||
- int i = Block.func_149682_b(p_151180_1_);
|
||||
- int j = Block.func_149682_b(p_151180_2_);
|
||||
+ int i;
|
||||
+ int j;
|
||||
+ if (useItemIds) {
|
||||
+ i = Item.func_150891_b(Item.func_150898_a(p_151180_1_));
|
||||
+ j = Item.func_150891_b(Item.func_150898_a(p_151180_2_));
|
||||
+ } else {
|
||||
+ i = Block.func_149682_b(p_151180_1_);
|
||||
+ j = Block.func_149682_b(p_151180_2_);
|
||||
+ }
|
||||
|
||||
if (p_151180_0_[i] != null && p_151180_0_[j] == null)
|
||||
{
|
||||
@@ -309,4 +316,36 @@
|
||||
{
|
||||
return field_188093_a.get(p_151177_0_);
|
||||
}
|
||||
+
|
||||
+ @Deprecated //MODDER DO NOT CALL THIS ITS JUST A EVENT CALLBACK FOR FORGE
|
||||
+ public static void reinit()
|
||||
+ {
|
||||
+ field_188093_a.clear();
|
||||
+ field_188094_c.clear();
|
||||
+ field_188095_d.clear();
|
||||
+ field_188096_e.clear();
|
||||
+
|
||||
+ for (StatBase[] sb : new StatBase[][]{field_188065_ae, field_188066_af, field_75929_E, field_75930_F, field_188067_ai, field_188068_aj})
|
||||
+ {
|
||||
+ for (int x = 0; x < sb.length; x++)
|
||||
+ {
|
||||
+ if (sb[x] != null)
|
||||
+ {
|
||||
+ field_75940_b.remove(sb[x]);
|
||||
+ sb[x] = null;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ List<StatBase> unknown = Lists.newArrayList(field_75940_b);
|
||||
+ field_75940_b.clear();
|
||||
+
|
||||
+ for (StatBase b : unknown)
|
||||
+ b.func_75971_g();
|
||||
+
|
||||
+ func_151181_c();
|
||||
+ func_75925_c();
|
||||
+ func_151179_e();
|
||||
+ func_75918_d();
|
||||
+ func_188054_f();
|
||||
+ }
|
||||
}
|
|
@ -1,209 +0,0 @@
|
|||
--- ../src-base/minecraft/net/minecraft/village/Village.java
|
||||
+++ ../src-work/minecraft/net/minecraft/village/Village.java
|
||||
@@ -26,7 +26,7 @@
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
-public class Village
|
||||
+public class Village implements net.minecraftforge.common.capabilities.ICapabilitySerializable<NBTTagCompound>
|
||||
{
|
||||
private World field_75586_a;
|
||||
private final List<VillageDoorInfo> field_75584_b = Lists.<VillageDoorInfo>newArrayList();
|
||||
@@ -37,17 +37,19 @@
|
||||
private int field_75581_g;
|
||||
private int field_75588_h;
|
||||
private int field_82694_i;
|
||||
- private final Map<String, Integer> field_82693_j = Maps.<String, Integer>newHashMap();
|
||||
+ private final Map<UUID, Integer> field_82693_j = Maps.<UUID, Integer>newHashMap();
|
||||
private final List<Village.VillageAggressor> field_75589_i = Lists.<Village.VillageAggressor>newArrayList();
|
||||
private int field_75587_j;
|
||||
|
||||
public Village()
|
||||
{
|
||||
+ this.capabilities = net.minecraftforge.event.ForgeEventFactory.gatherCapabilities(this);
|
||||
}
|
||||
|
||||
public Village(World p_i1675_1_)
|
||||
{
|
||||
this.field_75586_a = p_i1675_1_;
|
||||
+ this.capabilities = net.minecraftforge.event.ForgeEventFactory.gatherCapabilities(this);
|
||||
}
|
||||
|
||||
public void func_82691_a(World p_82691_1_)
|
||||
@@ -310,11 +312,11 @@
|
||||
double d0 = Double.MAX_VALUE;
|
||||
EntityPlayer entityplayer = null;
|
||||
|
||||
- for (String s : this.field_82693_j.keySet())
|
||||
+ for (UUID s : this.field_82693_j.keySet())
|
||||
{
|
||||
- if (this.func_82687_d(s))
|
||||
+ if (this.isPlayerReputationTooLow(s))
|
||||
{
|
||||
- EntityPlayer entityplayer1 = this.field_75586_a.func_72924_a(s);
|
||||
+ EntityPlayer entityplayer1 = this.field_75586_a.func_152378_a(s);
|
||||
|
||||
if (entityplayer1 != null)
|
||||
{
|
||||
@@ -362,6 +364,7 @@
|
||||
villagedoorinfo.func_75466_d();
|
||||
}
|
||||
|
||||
+ if (field_75586_a.func_175667_e(villagedoorinfo.func_179852_d())) // Forge: check that the door block is loaded to avoid loading chunks
|
||||
if (!this.func_179860_f(villagedoorinfo.func_179852_d()) || Math.abs(this.field_75581_g - villagedoorinfo.func_75473_b()) > 1200)
|
||||
{
|
||||
this.field_75585_c = this.field_75585_c.func_177973_b(villagedoorinfo.func_179852_d());
|
||||
@@ -415,25 +418,51 @@
|
||||
}
|
||||
}
|
||||
|
||||
+ @Deprecated //Hasn't worked since 1.9, use UUID version below.
|
||||
public int func_82684_a(String p_82684_1_)
|
||||
{
|
||||
+ return this.getPlayerReputation(findUUID(p_82684_1_));
|
||||
+ }
|
||||
+
|
||||
+ public int getPlayerReputation(UUID p_82684_1_)
|
||||
+ {
|
||||
Integer integer = this.field_82693_j.get(p_82684_1_);
|
||||
return integer == null ? 0 : integer.intValue();
|
||||
}
|
||||
|
||||
+ private UUID findUUID(String name)
|
||||
+ {
|
||||
+ if (this.field_75586_a == null || this.field_75586_a.func_73046_m() == null)
|
||||
+ return EntityPlayer.func_175147_b(name);
|
||||
+ GameProfile profile = this.field_75586_a.func_73046_m().func_152358_ax().func_152655_a(name);
|
||||
+ return profile == null ? EntityPlayer.func_175147_b(name) : profile.getId();
|
||||
+ }
|
||||
+
|
||||
+ @Deprecated //Hasn't worked since 1.9, use UUID version below.
|
||||
public int func_82688_a(String p_82688_1_, int p_82688_2_)
|
||||
{
|
||||
- int i = this.func_82684_a(p_82688_1_);
|
||||
+ return this.modifyPlayerReputation(findUUID(p_82688_1_), p_82688_2_);
|
||||
+ }
|
||||
+
|
||||
+ public int modifyPlayerReputation(UUID p_82688_1_, int p_82688_2_)
|
||||
+ {
|
||||
+ int i = this.getPlayerReputation(p_82688_1_);
|
||||
int j = MathHelper.func_76125_a(i + p_82688_2_, -30, 10);
|
||||
this.field_82693_j.put(p_82688_1_, Integer.valueOf(j));
|
||||
return j;
|
||||
}
|
||||
|
||||
+ @Deprecated //Hasn't worked since 1.9, use UUID version below.
|
||||
public boolean func_82687_d(String p_82687_1_)
|
||||
{
|
||||
- return this.func_82684_a(p_82687_1_) <= -15;
|
||||
+ return this.isPlayerReputationTooLow(findUUID(p_82687_1_));
|
||||
}
|
||||
|
||||
+ public boolean isPlayerReputationTooLow(UUID uuid)
|
||||
+ {
|
||||
+ return this.getPlayerReputation(uuid) <= -15;
|
||||
+ }
|
||||
+
|
||||
public void func_82690_a(NBTTagCompound p_82690_1_)
|
||||
{
|
||||
this.field_75588_h = p_82690_1_.func_74762_e("PopSize");
|
||||
@@ -459,21 +488,17 @@
|
||||
{
|
||||
NBTTagCompound nbttagcompound1 = nbttaglist1.func_150305_b(j);
|
||||
|
||||
- if (nbttagcompound1.func_74764_b("UUID") && this.field_75586_a != null && this.field_75586_a.func_73046_m() != null)
|
||||
+ if (nbttagcompound1.func_74764_b("UUID"))
|
||||
{
|
||||
- PlayerProfileCache playerprofilecache = this.field_75586_a.func_73046_m().func_152358_ax();
|
||||
- GameProfile gameprofile = playerprofilecache.func_152652_a(UUID.fromString(nbttagcompound1.func_74779_i("UUID")));
|
||||
-
|
||||
- if (gameprofile != null)
|
||||
- {
|
||||
- this.field_82693_j.put(gameprofile.getName(), Integer.valueOf(nbttagcompound1.func_74762_e("S")));
|
||||
- }
|
||||
+ this.field_82693_j.put(UUID.fromString(nbttagcompound1.func_74779_i("UUID")), Integer.valueOf(nbttagcompound1.func_74762_e("S")));
|
||||
}
|
||||
else
|
||||
{
|
||||
- this.field_82693_j.put(nbttagcompound1.func_74779_i("Name"), Integer.valueOf(nbttagcompound1.func_74762_e("S")));
|
||||
+ //World is never set here, so this will always be offline UUIDs, sadly there is no way to convert this.
|
||||
+ this.field_82693_j.put(findUUID(nbttagcompound1.func_74779_i("Name")), Integer.valueOf(nbttagcompound1.func_74762_e("S")));
|
||||
}
|
||||
}
|
||||
+ if (this.capabilities != null && p_82690_1_.func_74764_b("ForgeCaps")) this.capabilities.deserializeNBT(p_82690_1_.func_74775_l("ForgeCaps"));
|
||||
}
|
||||
|
||||
public void func_82689_b(NBTTagCompound p_82689_1_)
|
||||
@@ -507,18 +532,14 @@
|
||||
p_82689_1_.func_74782_a("Doors", nbttaglist);
|
||||
NBTTagList nbttaglist1 = new NBTTagList();
|
||||
|
||||
- for (String s : this.field_82693_j.keySet())
|
||||
+ for (UUID s : this.field_82693_j.keySet())
|
||||
{
|
||||
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
|
||||
- PlayerProfileCache playerprofilecache = this.field_75586_a.func_73046_m().func_152358_ax();
|
||||
|
||||
try
|
||||
{
|
||||
- GameProfile gameprofile = playerprofilecache.func_152655_a(s);
|
||||
-
|
||||
- if (gameprofile != null)
|
||||
{
|
||||
- nbttagcompound1.func_74778_a("UUID", gameprofile.getId().toString());
|
||||
+ nbttagcompound1.func_74778_a("UUID", s.toString());
|
||||
nbttagcompound1.func_74768_a("S", ((Integer)this.field_82693_j.get(s)).intValue());
|
||||
nbttaglist1.func_74742_a(nbttagcompound1);
|
||||
}
|
||||
@@ -530,6 +551,7 @@
|
||||
}
|
||||
|
||||
p_82689_1_.func_74782_a("Players", nbttaglist1);
|
||||
+ if (this.capabilities != null) p_82689_1_.func_74782_a("ForgeCaps", this.capabilities.serializeNBT());
|
||||
}
|
||||
|
||||
public void func_82692_h()
|
||||
@@ -544,9 +566,9 @@
|
||||
|
||||
public void func_82683_b(int p_82683_1_)
|
||||
{
|
||||
- for (String s : this.field_82693_j.keySet())
|
||||
+ for (UUID s : this.field_82693_j.keySet())
|
||||
{
|
||||
- this.func_82688_a(s, p_82683_1_);
|
||||
+ this.modifyPlayerReputation(s, p_82683_1_);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -561,4 +583,31 @@
|
||||
this.field_75590_b = p_i1674_3_;
|
||||
}
|
||||
}
|
||||
+
|
||||
+ /* ======================================== FORGE START =====================================*/
|
||||
+ private net.minecraftforge.common.capabilities.CapabilityDispatcher capabilities;
|
||||
+ public boolean hasCapability(net.minecraftforge.common.capabilities.Capability<?> capability, @Nullable net.minecraft.util.EnumFacing facing)
|
||||
+ {
|
||||
+ return capabilities == null ? false : capabilities.hasCapability(capability, facing);
|
||||
+ }
|
||||
+
|
||||
+ @Nullable
|
||||
+ public <T> T getCapability(net.minecraftforge.common.capabilities.Capability<T> capability, @Nullable net.minecraft.util.EnumFacing facing)
|
||||
+ {
|
||||
+ return capabilities == null ? null : capabilities.getCapability(capability, facing);
|
||||
+ }
|
||||
+
|
||||
+ public void deserializeNBT(NBTTagCompound nbt)
|
||||
+ {
|
||||
+ this.func_82690_a(nbt);;
|
||||
+ }
|
||||
+
|
||||
+ public NBTTagCompound serializeNBT()
|
||||
+ {
|
||||
+ NBTTagCompound ret = new NBTTagCompound();
|
||||
+ this.func_82689_b(ret);
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ /* ========================================= FORGE END ======================================*/
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
--- ../src-base/minecraft/net/minecraft/village/VillageCollection.java
|
||||
+++ ../src-work/minecraft/net/minecraft/village/VillageCollection.java
|
||||
@@ -151,6 +151,7 @@
|
||||
|
||||
private void func_180609_b(BlockPos p_180609_1_)
|
||||
{
|
||||
+ if (!this.field_75556_a.func_175697_a(p_180609_1_, 16)) return; // Forge: prevent loading unloaded chunks when checking for doors
|
||||
int i = 16;
|
||||
int j = 4;
|
||||
int k = 16;
|
|
@ -17,13 +17,4 @@
|
|||
+ net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.fmlServerHandshake(this.field_147327_f.func_184103_al(), this.field_147333_a, this.field_147327_f.func_184103_al().func_148545_a(this.field_147337_i));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -177,7 +177,7 @@
|
||||
this.field_147335_k = p_147315_1_.func_149300_a(privatekey);
|
||||
this.field_147328_g = NetHandlerLoginServer.LoginState.AUTHENTICATING;
|
||||
this.field_147333_a.func_150727_a(this.field_147335_k);
|
||||
- (new Thread("User Authenticator #" + field_147331_b.incrementAndGet())
|
||||
+ (new Thread(net.minecraftforge.fml.common.thread.SidedThreadGroups.SERVER, "User Authenticator #" + field_147331_b.incrementAndGet())
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
}
|
|
@ -1,17 +1,5 @@
|
|||
--- ../src-base/minecraft/net/minecraft/network/NetworkManager.java
|
||||
+++ ../src-work/minecraft/net/minecraft/network/NetworkManager.java
|
||||
@@ -88,6 +88,11 @@
|
||||
this.field_179294_g = p_i46004_1_;
|
||||
}
|
||||
|
||||
+ public EnumPacketDirection getDirection()
|
||||
+ {
|
||||
+ return this.field_179294_g;
|
||||
+ }
|
||||
+
|
||||
public void channelActive(ChannelHandlerContext p_channelActive_1_) throws Exception
|
||||
{
|
||||
super.channelActive(p_channelActive_1_);
|
||||
@@ -204,7 +209,7 @@
|
||||
final EnumConnectionState enumconnectionstate = EnumConnectionState.func_150752_a(p_150732_1_);
|
||||
final EnumConnectionState enumconnectionstate1 = (EnumConnectionState)this.field_150746_k.attr(field_150739_c).get();
|
||||
|
@ -38,24 +26,4 @@
|
|||
+ if (enumconnectionstate != enumconnectionstate1 && !( p_150732_1_ instanceof net.minecraftforge.fml.common.network.internal.FMLProxyPacket))
|
||||
{
|
||||
NetworkManager.this.func_150723_a(enumconnectionstate);
|
||||
}
|
||||
@@ -308,6 +313,7 @@
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static NetworkManager func_181124_a(InetAddress p_181124_0_, int p_181124_1_, boolean p_181124_2_)
|
||||
{
|
||||
+ if (p_181124_0_ instanceof java.net.Inet6Address) System.setProperty("java.net.preferIPv4Stack", "false");
|
||||
final NetworkManager networkmanager = new NetworkManager(EnumPacketDirection.CLIENTBOUND);
|
||||
Class <? extends SocketChannel > oclass;
|
||||
LazyLoadBase <? extends EventLoopGroup > lazyloadbase;
|
||||
@@ -454,6 +460,11 @@
|
||||
}
|
||||
}
|
||||
|
||||
+ public Channel channel()
|
||||
+ {
|
||||
+ return field_150746_k;
|
||||
+ }
|
||||
+
|
||||
static class InboundHandlerTuplePacketListener
|
||||
{
|
||||
private final Packet<?> field_150774_a;
|
||||
}
|
21
patches_old_unknown/PlayerList.java.patch
Normal file
21
patches_old_unknown/PlayerList.java.patch
Normal file
|
@ -0,0 +1,21 @@
|
|||
--- ../src-base/minecraft/net/minecraft/server/management/PlayerList.java
|
||||
+++ ../src-work/minecraft/net/minecraft/server/management/PlayerList.java
|
||||
@@ -106,7 +106,7 @@
|
||||
this.field_72405_c = 8;
|
||||
}
|
||||
|
||||
- public void func_72355_a(NetworkManager p_72355_1_, EntityPlayerMP p_72355_2_)
|
||||
+ public void initializeConnectionToPlayer(NetworkManager p_72355_1_, EntityPlayerMP p_72355_2_, NetHandlerPlayServer nethandlerplayserver)
|
||||
{
|
||||
GameProfile gameprofile = p_72355_2_.func_146103_bH();
|
||||
PlayerProfileCache playerprofilecache = this.field_72400_f.func_152358_ax();
|
||||
@@ -127,8 +138,9 @@
|
||||
WorldServer worldserver = this.field_72400_f.func_71218_a(p_72355_2_.field_71093_bK);
|
||||
WorldInfo worldinfo = worldserver.func_72912_H();
|
||||
this.func_72381_a(p_72355_2_, (EntityPlayerMP)null, worldserver);
|
||||
- NetHandlerPlayServer nethandlerplayserver = new NetHandlerPlayServer(this.field_72400_f, p_72355_1_, p_72355_2_);
|
||||
+ p_72355_2_.field_71135_a = nethandlerplayserver;
|
||||
+ net.minecraftforge.fml.common.FMLCommonHandler.instance().fireServerConnectionEvent(p_72355_1_);
|
||||
nethandlerplayserver.func_147359_a(new SPacketCustomPayload("MC|Brand", (new PacketBuffer(Unpooled.buffer())).func_180714_a(this.func_72365_p().getServerModName())));
|
||||
nethandlerplayserver.func_147359_a(new SPacketServerDifficulty(worldinfo.func_176130_y(), worldinfo.func_176123_z()));
|
||||
nethandlerplayserver.func_147359_a(new SPacketPlayerAbilities(p_72355_2_.field_71075_bZ));
|
|
@ -19,31 +19,21 @@
|
|||
|
||||
package net.minecraftforge.common;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Field;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Deque;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.google.common.base.Throwables;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Queues;
|
||||
|
@ -54,10 +44,7 @@ import com.google.gson.JsonObject;
|
|||
import com.google.gson.JsonParseException;
|
||||
|
||||
import net.minecraft.advancements.Advancement;
|
||||
import net.minecraft.advancements.AdvancementManager;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockFarmland;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.BlockWorldState;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
@ -72,17 +59,13 @@ import net.minecraft.entity.item.EntityMinecartContainer;
|
|||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.entity.projectile.EntityThrowable;
|
||||
import net.minecraft.fluid.IFluidState;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Fluids;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.inventory.ContainerRepair;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemAxe;
|
||||
import net.minecraft.item.ItemBucket;
|
||||
import net.minecraft.item.ItemEnchantedBook;
|
||||
import net.minecraft.item.ItemPickaxe;
|
||||
import net.minecraft.item.ItemPotion;
|
||||
|
@ -90,21 +73,13 @@ import net.minecraft.item.ItemSpade;
|
|||
import net.minecraft.item.ItemSpawnEgg;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemTippedArrow;
|
||||
import net.minecraft.item.ItemUseContext;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.network.NetHandlerPlayServer;
|
||||
import net.minecraft.network.Packet;
|
||||
import net.minecraft.network.play.server.SPacketBlockChange;
|
||||
import net.minecraft.network.play.server.SPacketRecipeBook;
|
||||
import net.minecraft.network.play.server.SPacketRecipeBook.State;
|
||||
import net.minecraft.potion.PotionType;
|
||||
import net.minecraft.potion.PotionUtils;
|
||||
import net.minecraft.resources.IResource;
|
||||
import net.minecraft.resources.IResourceManager;
|
||||
import net.minecraft.stats.StatList;
|
||||
import net.minecraft.tags.ItemTags;
|
||||
import net.minecraft.tags.Tag;
|
||||
import net.minecraft.tileentity.MobSpawnerBaseLogic;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
@ -113,7 +88,6 @@ import net.minecraft.util.EnumActionResult;
|
|||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.JsonUtils;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.WeightedRandom;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
|
@ -135,8 +109,6 @@ import net.minecraft.world.storage.loot.LootEntry;
|
|||
import net.minecraft.world.storage.loot.LootTable;
|
||||
import net.minecraft.world.storage.loot.LootTableManager;
|
||||
import net.minecraft.world.storage.loot.conditions.LootCondition;
|
||||
import net.minecraftforge.common.crafting.CraftingHelper;
|
||||
import net.minecraftforge.common.util.BlockSnapshot;
|
||||
import net.minecraftforge.event.AnvilUpdateEvent;
|
||||
import net.minecraftforge.event.DifficultyChangeEvent;
|
||||
import net.minecraftforge.event.ForgeEventFactory;
|
||||
|
@ -163,22 +135,10 @@ import net.minecraftforge.event.entity.player.AdvancementEvent;
|
|||
import net.minecraftforge.event.world.BlockEvent;
|
||||
import net.minecraftforge.event.world.NoteBlockEvent;
|
||||
import net.minecraftforge.eventbus.api.Event.Result;
|
||||
import net.minecraftforge.fluids.IFluidBlock;
|
||||
import net.minecraftforge.fml.ModContainer;
|
||||
import net.minecraftforge.fml.ModList;
|
||||
import net.minecraftforge.fml.network.ConnectionType;
|
||||
import net.minecraftforge.fml.loading.moddiscovery.ModFile;
|
||||
import net.minecraftforge.fml.loading.moddiscovery.ModFileInfo;
|
||||
import net.minecraftforge.fml.network.NetworkHooks;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import net.minecraftforge.registries.IForgeRegistry;
|
||||
import net.minecraftforge.registries.RegistryManager;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.logging.log4j.Marker;
|
||||
|
@ -1026,23 +986,6 @@ public class ForgeHooks
|
|||
return null;
|
||||
}
|
||||
|
||||
/* TODO this should be unnecessary now?
|
||||
public static void sendRecipeBook(NetHandlerPlayServer connection, State state, List<IRecipe> recipes, List<IRecipe> display, boolean isGuiOpen, boolean isFilteringCraftable)
|
||||
{
|
||||
NetworkDispatcher disp = NetworkDispatcher.get(connection.getNetworkManager());
|
||||
//Not sure how it could ever be null, but screw it lets protect against it. Could Error the client but we dont care if they are asking for this stuff in the wrong state!
|
||||
ConnectionType type = disp == null || disp.getConnectionType() == null ? ConnectionType.MODDED : disp.getConnectionType();
|
||||
if (type == ConnectionType.VANILLA)
|
||||
{
|
||||
IForgeRegistry<IRecipe> vanilla = RegistryManager.VANILLA.getRegistry(IRecipe.class);
|
||||
recipes = recipes.stream().filter(vanilla::containsValue).collect(Collectors.toList());
|
||||
display = display.stream().filter(vanilla::containsValue).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
if (!recipes.isEmpty() || !display.isEmpty())
|
||||
connection.sendPacket(new SPacketRecipeBook(state, recipes, display, isGuiOpen, isFilteringCraftable));
|
||||
}
|
||||
*/
|
||||
public static void onAdvancement(EntityPlayerMP player, Advancement advancement)
|
||||
{
|
||||
MinecraftForge.EVENT_BUS.post(new AdvancementEvent(player, advancement));
|
||||
|
|
|
@ -130,7 +130,7 @@ public class ForgeMod implements WorldPersistenceHooks.WorldPersistenceHook
|
|||
{
|
||||
universalBucket = new UniversalBucket();
|
||||
universalBucket.setUnlocalizedName("forge.bucketFilled");
|
||||
event.getRegistry().register(universalBucket.setRegistryName(ForgeVersion.MOD_ID, "bucketFilled"));
|
||||
event.getRegistry().register(universalBucket.setRegistryName(ForgeVersion.MOD_ID, "bucket_filled"));
|
||||
MinecraftForge.EVENT_BUS.register(universalBucket);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ public class IngredientNBT extends Ingredient
|
|||
if (input == null)
|
||||
return false;
|
||||
//Can't use areItemStacksEqualUsingNBTShareTag because it compares stack size as well
|
||||
return this.stack.getItem() == input.getItem() && this.stack.getDamage() == input.getDamage() && ItemStack.areItemStackShareTagsEqual(this.stack, input);
|
||||
return this.stack.getItem() == input.getItem() && this.stack.getDamage() == input.getDamage() && this.stack.areShareTagsEqual(input);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -121,15 +121,18 @@ public interface IForgeItem
|
|||
* behavior client side!
|
||||
*
|
||||
* Note that this will sometimes be applied multiple times, the following MUST
|
||||
* be supported: Item item = stack.getItem(); NBTTagCompound nbtShare1 =
|
||||
* item.getNBTShareTag(stack); stack.setTagCompound(nbtShare1); NBTTagCompound
|
||||
* nbtShare2 = item.getNBTShareTag(stack); assert nbtShare1.equals(nbtShare2);
|
||||
* be supported:
|
||||
* Item item = stack.getItem();
|
||||
* NBTTagCompound nbtShare1 = item.getNBTShareTag(stack);
|
||||
* stack.setTagCompound(nbtShare1);
|
||||
* NBTTagCompound nbtShare2 = item.getNBTShareTag(stack);
|
||||
* assert nbtShare1.equals(nbtShare2);
|
||||
*
|
||||
* @param stack The stack to send the NBT tag for
|
||||
* @return The NBT tag
|
||||
*/
|
||||
@Nullable
|
||||
default NBTTagCompound getNBTShareTag(ItemStack stack)
|
||||
default NBTTagCompound getShareTag(ItemStack stack)
|
||||
{
|
||||
return stack.getTag();
|
||||
}
|
||||
|
@ -141,7 +144,7 @@ public interface IForgeItem
|
|||
* @param stack The stack that received NBT
|
||||
* @param nbt Received NBT, can be null
|
||||
*/
|
||||
default void readNBTShareTag(ItemStack stack, @Nullable NBTTagCompound nbt)
|
||||
default void readShareTag(ItemStack stack, @Nullable NBTTagCompound nbt)
|
||||
{
|
||||
stack.setTag(nbt);
|
||||
}
|
||||
|
|
|
@ -355,4 +355,80 @@ public interface IForgeItemStack extends ICapabilitySerializable<NBTTagCompound>
|
|||
{
|
||||
return getStack().getItem().onDroppedByPlayer(getStack(), player);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the NBT data to be sent to the client. The Item can control what data is kept in the tag.
|
||||
*
|
||||
* Note that this will sometimes be applied multiple times, the following MUST
|
||||
* be supported:
|
||||
* Item item = stack.getItem();
|
||||
* NBTTagCompound nbtShare1 = item.getNBTShareTag(stack);
|
||||
* stack.setTagCompound(nbtShare1);
|
||||
* NBTTagCompound nbtShare2 = item.getNBTShareTag(stack);
|
||||
* assert nbtShare1.equals(nbtShare2);
|
||||
*
|
||||
* @return The NBT tag
|
||||
*/
|
||||
@Nullable
|
||||
default NBTTagCompound getShareTag()
|
||||
{
|
||||
return getStack().getItem().getShareTag(getStack());
|
||||
}
|
||||
|
||||
/**
|
||||
* Override this method to decide what to do with the NBT data received from
|
||||
* getNBTShareTag().
|
||||
*
|
||||
* @param stack The stack that received NBT
|
||||
* @param nbt Received NBT, can be null
|
||||
*/
|
||||
default void readShareTag(@Nullable NBTTagCompound nbt)
|
||||
{
|
||||
getStack().getItem().readShareTag(getStack(), nbt);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Should this item, when held, allow sneak-clicks to pass through to the underlying block?
|
||||
*
|
||||
* @param world The world
|
||||
* @param pos Block position in world
|
||||
* @param player The Player that is wielding the item
|
||||
* @return
|
||||
*/
|
||||
default boolean doesSneakBypassUse(net.minecraft.world.IWorldReader world, BlockPos pos, EntityPlayer player)
|
||||
{
|
||||
return getStack().isEmpty() || getStack().getItem().doesSneakBypassUse(getStack(), world, pos, player);
|
||||
}
|
||||
|
||||
/**
|
||||
* Modeled after ItemStack.areItemStackTagsEqual
|
||||
* Uses Item.getNBTShareTag for comparison instead of NBT and capabilities.
|
||||
* Only used for comparing itemStacks that were transferred from server to client using Item.getNBTShareTag.
|
||||
*/
|
||||
default boolean areShareTagsEqual(ItemStack other)
|
||||
{
|
||||
NBTTagCompound shareTagA = getStack().getShareTag();
|
||||
NBTTagCompound shareTagB = other.getShareTag();
|
||||
if (shareTagA == null)
|
||||
return shareTagB == null;
|
||||
else
|
||||
return shareTagB != null && shareTagA.equals(shareTagB);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if the ItemStack is equal to the other item stack, including Item, Count, and NBT.
|
||||
*
|
||||
* @param other The other stack
|
||||
* @param limitTags True to use shareTag False to use full NBT tag
|
||||
* @return true if equals
|
||||
*/
|
||||
default boolean equals(ItemStack other, boolean limitTags)
|
||||
{
|
||||
if (getStack().isEmpty())
|
||||
return other.isEmpty();
|
||||
else
|
||||
return !other.isEmpty() && getStack().getCount() == other.getCount() && getStack().getItem() == other.getItem() &&
|
||||
(limitTags ? getStack().areShareTagsEqual(other) : ItemStack.areItemStackTagsEqual(getStack(), other));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,58 +0,0 @@
|
|||
/*
|
||||
* Minecraft Forge
|
||||
* Copyright (c) 2016-2018.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation version 2.1
|
||||
* of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
package net.minecraftforge.common.util;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
|
||||
public class PacketUtil
|
||||
{
|
||||
private PacketUtil() {}
|
||||
|
||||
/**
|
||||
* Most ItemStack serialization is Server to Client, and must go through PacketBuffer.writeItemStack which uses Item.getNBTShareTag.
|
||||
* One exception is items from the creative menu, which must be sent from Client to Server with their full NBT.
|
||||
* <br/>
|
||||
* This method matches PacketBuffer.writeItemStack but without the Item.getNBTShareTag patch.
|
||||
* It is compatible with PacketBuffer.readItemStack.
|
||||
*/
|
||||
public static void writeItemStackFromClientToServer(PacketBuffer buffer, ItemStack stack)
|
||||
{
|
||||
if (stack.isEmpty())
|
||||
{
|
||||
buffer.writeShort(-1);
|
||||
}
|
||||
else
|
||||
{
|
||||
buffer.writeShort(Item.getIdFromItem(stack.getItem()));
|
||||
buffer.writeByte(stack.getCount());
|
||||
NBTTagCompound nbttagcompound = null;
|
||||
|
||||
if (stack.getItem().isDamageable() || stack.getItem().getShareTag())
|
||||
{
|
||||
nbttagcompound = stack.getTag();
|
||||
}
|
||||
|
||||
buffer.writeCompoundTag(nbttagcompound);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -10,10 +10,8 @@ net/minecraft/entity/Entity.changeDimension(ILnet/minecraftforge/common/util/ITe
|
|||
#net/minecraft/entity/item/EntityMinecartContainer.changeDimension(ILnet/minecraftforge/common/util/ITeleporter;)Lnet/minecraft/entity/Entity;=|p_184204_1_,teleporter
|
||||
#net/minecraft/entity/player/EntityPlayerMP.changeDimension(ILnet/minecraftforge/common/util/ITeleporter;)Lnet/minecraft/entity/Entity;=|p_184204_1_,teleporter
|
||||
net/minecraft/entity/player/EntityPlayer.getDigSpeed(Lnet/minecraft/block/state/IBlockState;Lnet/minecraft/util/math/BlockPos;)F=|p_184813_1_,pos
|
||||
#net/minecraft/server/management/PlayerList.transferPlayerToDimension(Lnet/minecraft/entity/player/EntityPlayerMP;ILnet/minecraft/world/Teleporter;)V=|p_187242_1_,p_187242_2_,teleporter
|
||||
#net/minecraft/server/management/PlayerList.transferPlayerToDimension(Lnet/minecraft/entity/player/EntityPlayerMP;ILnet/minecraftforge/common/util/ITeleporter;)V=|p_187242_1_,p_187242_2_,teleporter
|
||||
#net/minecraft/server/management/PlayerList.transferEntityToWorld(Lnet/minecraft/entity/Entity;ILnet/minecraft/world/WorldServer;Lnet/minecraft/world/WorldServer;Lnet/minecraft/world/Teleporter;)V=|p_82448_1_,p_82448_2_,p_82448_3_,p_82448_4_,teleporter
|
||||
#net/minecraft/server/management/PlayerList.transferEntityToWorld(Lnet/minecraft/entity/Entity;ILnet/minecraft/world/WorldServer;Lnet/minecraft/world/WorldServer;Lnet/minecraftforge/common/util/ITeleporter;)V=|p_82448_1_,p_82448_2_,p_82448_3_,p_82448_4_,teleporter
|
||||
net/minecraft/server/management/PlayerList.changePlayerDimension(Lnet/minecraft/entity/player/EntityPlayerMP;ILnet/minecraftforge/common/util/ITeleporter;)V=|p_187242_1_,p_187242_2_,teleporter
|
||||
net/minecraft/server/management/PlayerList.transferEntityToWorld(Lnet/minecraft/entity/Entity;ILnet/minecraft/world/WorldServer;Lnet/minecraft/world/WorldServer;Lnet/minecraftforge/common/util/ITeleporter;)V=|p_82448_1_,p_82448_2_,p_82448_3_,p_82448_4_,teleporter
|
||||
|
||||
#net/minecraft/world/World.getBiomeGenForCoordsBody(II)Lnet/minecraft/world/biome/Biome;=|p_72807_1_,p_72807_2_
|
||||
#net/minecraft/world/World.getSunBrightnessFactor(F)F=|p_72967_1_
|
||||
|
@ -91,3 +89,5 @@ net/minecraft/village/Village.modifyPlayerReputation(Ljava/util/UUID;I)I=|p_8268
|
|||
#net/minecraft/client/audio/SoundManager.setListener(Lnet/minecraft/entity/Entity;F)V=|p_148615_1_,p_148615_2_
|
||||
|
||||
net/minecraft/item/ArmorMaterial.create(Ljava/lang/String;Ljava/lang/String;I[IILnet/minecraft/util/SoundEvent;FLjava/util/function/Supplier;)Lnet/minecraft/item/ArmorMaterial;=|name,p_i48533_3_,p_i48533_4_,p_i48533_5_,p_i48533_6_,p_i48533_7_,p_i48533_8_,p_i48533_9_
|
||||
|
||||
net/minecraft/network/PacketBuffer.writeItemStack(Lnet/minecraft/item/ItemStack;Z)Lnet/minecraft/network/PacketBuffer;=|p_150788_1_,limitedTag
|
||||
|
|
Loading…
Reference in a new issue