mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-22 21:09:51 +00:00
Fix #739 Trade station crashes when loaded without name set
This commit is contained in:
1 parent
f79a8b3896
commit
f0fa49f46c
8 files changed
+135
-70
No files matched your search
@@ -0,0 +1,51 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.mail.network;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import forestry.core.network.DataInputStreamForestry;
|
||||
import forestry.core.network.DataOutputStreamForestry;
|
||||
import forestry.core.network.PacketCoordinates;
|
||||
import forestry.core.network.PacketId;
|
||||
import forestry.mail.gadgets.MachineTrader;
|
||||
|
||||
public class PacketTraderAddress extends PacketCoordinates {
|
||||
|
||||
private String addressName;
|
||||
|
||||
public PacketTraderAddress(DataInputStreamForestry data) throws IOException {
|
||||
super(data);
|
||||
}
|
||||
|
||||
public PacketTraderAddress(MachineTrader tile, String addressName) {
|
||||
super(PacketId.TRADING_ADDRESS_SET, tile);
|
||||
|
||||
this.addressName = addressName;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void writeData(DataOutputStreamForestry data) throws IOException {
|
||||
super.writeData(data);
|
||||
data.writeUTF(addressName);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void readData(DataInputStreamForestry data) throws IOException {
|
||||
super.readData(data);
|
||||
|
||||
addressName = data.readUTF();
|
||||
}
|
||||
|
||||
public String getAddressName() {
|
||||
return addressName;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user