Skip to content

Commit

Permalink
Fix #4399 - a critical dedicated server crash whenever items moved th…
Browse files Browse the repository at this point in the history
…rough pipes with a player watching.
  • Loading branch information
AlexIIL committed Apr 21, 2019
1 parent b28d5e5 commit a5b4376
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion build.properties
@@ -1,4 +1,4 @@
mc_version=1.12.2
forge_version=14.23.0.2544
mappings_version=snapshot_20171120
mod_version=7.99.24
mod_version=7.99.24.1
3 changes: 3 additions & 0 deletions buildcraft_resources/changelog/7.99.24.1
@@ -0,0 +1,3 @@
Bug fixes:

* [#4399] Dedicated server crash when sending items through pipes.
8 changes: 4 additions & 4 deletions common/buildcraft/transport/net/MessageMultiPipeItem.java
Expand Up @@ -10,7 +10,6 @@

import io.netty.buffer.ByteBuf;

import net.minecraft.client.Minecraft;
import net.minecraft.item.EnumDyeColor;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
Expand All @@ -24,6 +23,7 @@
import buildcraft.api.transport.pipe.IPipeHolder;
import buildcraft.api.transport.pipe.PipeFlow;

import buildcraft.lib.BCLibProxy;
import buildcraft.lib.misc.MessageUtil;
import buildcraft.lib.net.PacketBufferBC;

Expand Down Expand Up @@ -132,17 +132,17 @@ void toBuffer(PacketBufferBC buf) {

@Override
public IMessage onMessage(MessageMultiPipeItem message, MessageContext ctx) {
World world = Minecraft.getMinecraft().world;
World world = BCLibProxy.getProxy().getClientWorld();
if (world == null) {
return null;
}
for (Entry<BlockPos, List<TravellingItemData>> entry : message.items.entrySet()) {
BlockPos pos = entry.getKey();
TileEntity tile = world.getTileEntity(pos);
if (tile instanceof IPipeHolder) {
PipeFlow flow = ((IPipeHolder)tile).getPipe().getFlow();
PipeFlow flow = ((IPipeHolder) tile).getPipe().getFlow();
if (flow instanceof PipeFlowItems) {
((PipeFlowItems)flow).handleClientReceviedItems(entry.getValue());
((PipeFlowItems) flow).handleClientReceviedItems(entry.getValue());
}
}
}
Expand Down

0 comments on commit a5b4376

Please sign in to comment.