Merge branch 'nightly' of github.com:BuildCraft/BuildCraft into nightly
This commit is contained in:
commit
7e4b66c127
1 changed files with 16 additions and 8 deletions
|
@ -115,7 +115,9 @@ public class ContainerGateInterface extends BuildCraftContainer {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canInteractWith(EntityPlayer entityplayer) {
|
public boolean canInteractWith(EntityPlayer player) {
|
||||||
|
if (pipe == null || pipe.gate == null)
|
||||||
|
return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -169,31 +171,31 @@ public class ContainerGateInterface extends BuildCraftContainer {
|
||||||
try {
|
try {
|
||||||
PacketPayloadStream payload = (PacketPayloadStream) packet.payload;
|
PacketPayloadStream payload = (PacketPayloadStream) packet.payload;
|
||||||
DataInputStream data = payload.stream;
|
DataInputStream data = payload.stream;
|
||||||
|
|
||||||
int position = data.readInt();
|
int position = data.readInt();
|
||||||
|
|
||||||
setTrigger(position, ActionManager.triggers.get(data.readUTF()), notify);
|
setTrigger(position, ActionManager.triggers.get(data.readUTF()), notify);
|
||||||
setAction(position, ActionManager.actions.get(data.readUTF()), notify);
|
setAction(position, ActionManager.actions.get(data.readUTF()), notify);
|
||||||
|
|
||||||
ItemStack parameter = Packet.readItemStack(data);
|
ItemStack parameter = Packet.readItemStack(data);
|
||||||
if(parameter != null) {
|
if (parameter != null) {
|
||||||
ITriggerParameter param = new TriggerParameter();
|
ITriggerParameter param = new TriggerParameter();
|
||||||
param.set(parameter);
|
param.set(parameter);
|
||||||
setTriggerParameter(position, param, notify);
|
setTriggerParameter(position, param, notify);
|
||||||
} else {
|
} else {
|
||||||
setTriggerParameter(position, null, notify);
|
setTriggerParameter(position, null, notify);
|
||||||
}
|
}
|
||||||
} catch(IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private PacketPayload getSelectionPayload(final int position) {
|
private PacketPayload getSelectionPayload(final int position) {
|
||||||
PacketPayloadStream payload = new PacketPayloadStream(new PacketPayloadStream.StreamWriter() {
|
PacketPayloadStream payload = new PacketPayloadStream(new PacketPayloadStream.StreamWriter() {
|
||||||
@Override
|
@Override
|
||||||
public void writeData(DataOutputStream data) throws IOException {
|
public void writeData(DataOutputStream data) throws IOException {
|
||||||
data.writeInt(position);
|
data.writeInt(position);
|
||||||
|
|
||||||
if (pipe.gate.triggers[position] != null) {
|
if (pipe.gate.triggers[position] != null) {
|
||||||
data.writeUTF(pipe.gate.triggers[position].getUniqueTag());
|
data.writeUTF(pipe.gate.triggers[position].getUniqueTag());
|
||||||
} else {
|
} else {
|
||||||
|
@ -389,10 +391,14 @@ public class ContainerGateInterface extends BuildCraftContainer {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isNearbyTriggerActive(ITrigger trigger, ITriggerParameter parameter) {
|
public boolean isNearbyTriggerActive(ITrigger trigger, ITriggerParameter parameter) {
|
||||||
|
if (pipe.gate == null)
|
||||||
|
return false;
|
||||||
return pipe.gate.isNearbyTriggerActive(trigger, parameter);
|
return pipe.gate.isNearbyTriggerActive(trigger, parameter);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTrigger(int position, ITrigger trigger, boolean notify) {
|
public void setTrigger(int position, ITrigger trigger, boolean notify) {
|
||||||
|
if (pipe.gate == null)
|
||||||
|
return;
|
||||||
pipe.gate.setTrigger(position, trigger);
|
pipe.gate.setTrigger(position, trigger);
|
||||||
if (CoreProxy.proxy.isRenderWorld(pipe.container.worldObj) && notify) {
|
if (CoreProxy.proxy.isRenderWorld(pipe.container.worldObj) && notify) {
|
||||||
sendSelectionChange(position);
|
sendSelectionChange(position);
|
||||||
|
@ -400,6 +406,8 @@ public class ContainerGateInterface extends BuildCraftContainer {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTriggerParameter(int position, ITriggerParameter parameter, boolean notify) {
|
public void setTriggerParameter(int position, ITriggerParameter parameter, boolean notify) {
|
||||||
|
if (pipe.gate == null)
|
||||||
|
return;
|
||||||
pipe.gate.setTriggerParameter(position, parameter);
|
pipe.gate.setTriggerParameter(position, parameter);
|
||||||
if (CoreProxy.proxy.isRenderWorld(pipe.container.worldObj) && notify) {
|
if (CoreProxy.proxy.isRenderWorld(pipe.container.worldObj) && notify) {
|
||||||
sendSelectionChange(position);
|
sendSelectionChange(position);
|
||||||
|
|
Loading…
Reference in a new issue