generated from tilera/1710mod
fix: fix more stuff
This commit is contained in:
parent
57853b60c1
commit
dece854363
18 changed files with 242 additions and 178 deletions
|
@ -1,15 +1,12 @@
|
||||||
- glass button doesn't render in inventory
|
- glass button doesn't render in inventory
|
||||||
- tons of missing packets (mostly gui stuff)
|
- missing packets (mostly gui stuff)
|
||||||
- unable to mount turret after dismounting
|
|
||||||
- turret gui kekt
|
|
||||||
- no electricity in guis
|
|
||||||
- EMP tower drops nonsense
|
- EMP tower drops nonsense
|
||||||
- no proper update on multiblock destroy
|
- no proper update on multiblock destroy
|
||||||
- condensed explosives doesn't break blocks and explodes instantly
|
- condensed explosives doesn't break blocks and explodes instantly
|
||||||
- can push explosive entities
|
- can push explosive entities
|
||||||
- flying blocks dont properly render
|
- flying blocks dont properly render
|
||||||
- black hole doesn't suck in blocks
|
- black hole doesn't suck in blocks
|
||||||
- no missiles??
|
|
||||||
- remote detonator doesnt work
|
- remote detonator doesnt work
|
||||||
- radar is completely borked
|
|
||||||
- emp tower only deletes missiles on client
|
- emp tower only deletes missiles on client
|
||||||
|
|
||||||
|
- see `// TODO: WTF`
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package icbm.api;
|
package icbm.api;
|
||||||
|
|
||||||
import icbm.api.ILauncherContainer;
|
|
||||||
import icbm.api.explosion.IExplosiveContainer;
|
import icbm.api.explosion.IExplosiveContainer;
|
||||||
import universalelectricity.core.vector.Vector3;
|
import universalelectricity.core.vector.Vector3;
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,10 @@ import icbm.gangshao.damage.EntityTileDamagable;
|
||||||
import icbm.gangshao.packet.PacketHandlerTurret;
|
import icbm.gangshao.packet.PacketHandlerTurret;
|
||||||
import icbm.gangshao.packet.PacketTurret;
|
import icbm.gangshao.packet.PacketTurret;
|
||||||
import icbm.gangshao.platform.BlockTurretPlatform;
|
import icbm.gangshao.platform.BlockTurretPlatform;
|
||||||
|
import icbm.gangshao.terminal.TerminalCommandPacket;
|
||||||
|
import icbm.gangshao.terminal.TerminalCommandPacketHandler;
|
||||||
|
import icbm.gangshao.terminal.TerminalOutputPacket;
|
||||||
|
import icbm.gangshao.terminal.TerminalOutputPacketHandler;
|
||||||
import icbm.gangshao.terminal.command.CommandAccess;
|
import icbm.gangshao.terminal.command.CommandAccess;
|
||||||
import icbm.gangshao.terminal.command.CommandDestroy;
|
import icbm.gangshao.terminal.command.CommandDestroy;
|
||||||
import icbm.gangshao.terminal.command.CommandGet;
|
import icbm.gangshao.terminal.command.CommandGet;
|
||||||
|
@ -130,6 +134,18 @@ public class ICBMSentry extends MainBase {
|
||||||
channel.registerMessage(
|
channel.registerMessage(
|
||||||
PacketHandlerTurret.class, PacketTurret.class, pktId++, Side.CLIENT
|
PacketHandlerTurret.class, PacketTurret.class, pktId++, Side.CLIENT
|
||||||
);
|
);
|
||||||
|
channel.registerMessage(
|
||||||
|
TerminalOutputPacketHandler.class,
|
||||||
|
TerminalOutputPacket.class,
|
||||||
|
pktId++,
|
||||||
|
Side.CLIENT
|
||||||
|
);
|
||||||
|
channel.registerMessage(
|
||||||
|
TerminalCommandPacketHandler.class,
|
||||||
|
TerminalCommandPacket.class,
|
||||||
|
pktId++,
|
||||||
|
Side.SERVER
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Mod.EventHandler
|
@Mod.EventHandler
|
||||||
|
|
|
@ -62,6 +62,7 @@ public class ContainerTurretPlatform extends ContainerTerminal {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ItemStack
|
public ItemStack
|
||||||
transferStackInSlot(final EntityPlayer entityPlayer, final int slotID) {
|
transferStackInSlot(final EntityPlayer entityPlayer, final int slotID) {
|
||||||
ItemStack var2 = null;
|
ItemStack var2 = null;
|
||||||
|
|
|
@ -373,8 +373,6 @@ public class TTurretPlatform extends TileEntityTerminal implements IInventory {
|
||||||
return "ICBM";
|
return "ICBM";
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: WTF
|
|
||||||
//@Override
|
|
||||||
public boolean addStackToInventory(final ItemStack itemStack) {
|
public boolean addStackToInventory(final ItemStack itemStack) {
|
||||||
for (int i = 0; i < 12; ++i) {
|
for (int i = 0; i < 12; ++i) {
|
||||||
final ItemStack checkStack = this.getStackInSlot(i);
|
final ItemStack checkStack = this.getStackInSlot(i);
|
||||||
|
@ -409,6 +407,7 @@ public class TTurretPlatform extends TileEntityTerminal implements IInventory {
|
||||||
NBTTagCompound nbt = new NBTTagCompound();
|
NBTTagCompound nbt = new NBTTagCompound();
|
||||||
|
|
||||||
nbt.setDouble("wattsReceived", super.wattsReceived);
|
nbt.setDouble("wattsReceived", super.wattsReceived);
|
||||||
|
super.writeToNBT(nbt);
|
||||||
|
|
||||||
return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord,
|
return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord,
|
||||||
this.getBlockMetadata(), nbt);
|
this.getBlockMetadata(), nbt);
|
||||||
|
@ -419,5 +418,6 @@ public class TTurretPlatform extends TileEntityTerminal implements IInventory {
|
||||||
NBTTagCompound nbt = pkt.func_148857_g();
|
NBTTagCompound nbt = pkt.func_148857_g();
|
||||||
|
|
||||||
super.wattsReceived = nbt.getDouble("wattsReceived");
|
super.wattsReceived = nbt.getDouble("wattsReceived");
|
||||||
|
super.readFromNBT(nbt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,9 +105,9 @@ public class GuiPlatformAccess extends GuiPlatformBase implements IScroll {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: WTF
|
super.tileEntity.sendCommandToServer(
|
||||||
// super.tileEntity.sendCommandToServer(super.entityPlayer,
|
super.entityPlayer, command + " " + username
|
||||||
// command + " " + username);
|
);
|
||||||
this.commandLine.setText("");
|
this.commandLine.setText("");
|
||||||
} else {
|
} else {
|
||||||
this.commandLine.textboxKeyTyped(character, keycode);
|
this.commandLine.textboxKeyTyped(character, keycode);
|
||||||
|
@ -144,10 +144,10 @@ public class GuiPlatformAccess extends GuiPlatformBase implements IScroll {
|
||||||
}
|
}
|
||||||
|
|
||||||
final AccessLevel newLevel = AccessLevel.get(newLevelOrdinal);
|
final AccessLevel newLevel = AccessLevel.get(newLevelOrdinal);
|
||||||
// TODO: WTF
|
super.tileEntity.sendCommandToServer(
|
||||||
// super.tileEntity.sendCommandToServer(super.entityPlayer,
|
super.entityPlayer,
|
||||||
// "access set " + access.username +
|
"access set " + access.username + " " + newLevel.displayName
|
||||||
// " " + newLevel.displayName);
|
);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -178,7 +178,7 @@ public class GuiPlatformAccess extends GuiPlatformBase implements IScroll {
|
||||||
final String line
|
final String line
|
||||||
= accesInfo.username + " (" + accesInfo.level.displayName + ")";
|
= accesInfo.username + " (" + accesInfo.level.displayName + ")";
|
||||||
|
|
||||||
if (line != null && line != "") {
|
if (line != null && !line.isEmpty()) {
|
||||||
final Vector2 drawPosition = new Vector2(x, 10 * i + y);
|
final Vector2 drawPosition = new Vector2(x, 10 * i + y);
|
||||||
this.outputMap.put(accesInfo, drawPosition);
|
this.outputMap.put(accesInfo, drawPosition);
|
||||||
this.fontRendererObj.drawString(
|
this.fontRendererObj.drawString(
|
||||||
|
|
|
@ -42,11 +42,6 @@ public abstract class GuiPlatformBase extends GuiBase {
|
||||||
(this.height - super.ySize) / 2 + 44,
|
(this.height - super.ySize) / 2 + 44,
|
||||||
2
|
2
|
||||||
));
|
));
|
||||||
// TODO: WTF
|
|
||||||
// PacketDispatcher.sendPacketToServer(PacketManager.getPacket(
|
|
||||||
// "ICBM", this.tileEntity,
|
|
||||||
// TileEntityTerminal.TerminalPacketType.GUI_EVENT.ordinal(),
|
|
||||||
// true));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -101,16 +96,6 @@ public abstract class GuiPlatformBase extends GuiBase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onGuiClosed() {
|
|
||||||
super.onGuiClosed();
|
|
||||||
// TODO: WTF
|
|
||||||
// PacketDispatcher.sendPacketToServer(PacketManager.getPacket(
|
|
||||||
// "ICBM", this.tileEntity,
|
|
||||||
// TileEntityTerminal.TerminalPacketType.GUI_EVENT.ordinal(),
|
|
||||||
// false));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void drawForegroundLayer(final int x, final int y, final float var1) {
|
protected void drawForegroundLayer(final int x, final int y, final float var1) {
|
||||||
if (((GuiButtonImage) this.buttonList.get(0)).isIntersect(x, y)) {
|
if (((GuiButtonImage) this.buttonList.get(0)).isIntersect(x, y)) {
|
||||||
|
|
|
@ -86,9 +86,8 @@ public class GuiPlatformTerminal extends GuiPlatformBase {
|
||||||
} else if (keycode == 208) {
|
} else if (keycode == 208) {
|
||||||
this.tileEntity.scroll(1);
|
this.tileEntity.scroll(1);
|
||||||
} else if (keycode == 28) {
|
} else if (keycode == 28) {
|
||||||
//TODO: WTF
|
this.tileEntity.sendCommandToServer(super.entityPlayer,
|
||||||
//this.tileEntity.sendCommandToServer(super.entityPlayer,
|
this.commandLine.getText());
|
||||||
// this.commandLine.getText());
|
|
||||||
this.commandLine.setText("");
|
this.commandLine.setText("");
|
||||||
} else {
|
} else {
|
||||||
this.commandLine.textboxKeyTyped(character, keycode);
|
this.commandLine.textboxKeyTyped(character, keycode);
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
package icbm.gangshao.terminal;
|
||||||
|
|
||||||
|
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
|
import universalelectricity.core.vector.Vector3;
|
||||||
|
|
||||||
|
public class TerminalCommandPacket implements IMessage {
|
||||||
|
Vector3 pos;
|
||||||
|
String cmd;
|
||||||
|
|
||||||
|
public TerminalCommandPacket() {}
|
||||||
|
|
||||||
|
public TerminalCommandPacket(Vector3 pos, String cmd) {
|
||||||
|
this.pos = pos;
|
||||||
|
this.cmd = cmd;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void fromBytes(ByteBuf buf) {
|
||||||
|
this.pos = new Vector3(buf.readInt(), buf.readInt(), buf.readInt());
|
||||||
|
int len = buf.readInt();
|
||||||
|
byte[] data = new byte[len];
|
||||||
|
buf.readBytes(data);
|
||||||
|
this.cmd = new String(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void toBytes(ByteBuf buf) {
|
||||||
|
buf.writeInt(this.pos.intX());
|
||||||
|
buf.writeInt(this.pos.intY());
|
||||||
|
buf.writeInt(this.pos.intZ());
|
||||||
|
|
||||||
|
buf.writeInt(this.cmd.getBytes().length);
|
||||||
|
buf.writeBytes(this.cmd.getBytes());
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
package icbm.gangshao.terminal;
|
||||||
|
|
||||||
|
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||||
|
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||||
|
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||||
|
import icbm.gangshao.terminal.command.CommandRegistry;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
|
||||||
|
public class TerminalCommandPacketHandler
|
||||||
|
implements IMessageHandler<TerminalCommandPacket, IMessage> {
|
||||||
|
@Override
|
||||||
|
public IMessage onMessage(TerminalCommandPacket message, MessageContext ctx) {
|
||||||
|
EntityPlayer pl = ctx.getServerHandler().playerEntity;
|
||||||
|
|
||||||
|
TileEntity te = message.pos.getTileEntity(pl.worldObj);
|
||||||
|
if (te instanceof TileEntityTerminal) {
|
||||||
|
TileEntityTerminal t = (TileEntityTerminal) te;
|
||||||
|
|
||||||
|
CommandRegistry.onCommand(pl, t, message.cmd);
|
||||||
|
t.sendTerminalOutputToClients();
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,47 @@
|
||||||
|
package icbm.gangshao.terminal;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
|
import universalelectricity.core.vector.Vector3;
|
||||||
|
|
||||||
|
public class TerminalOutputPacket implements IMessage {
|
||||||
|
Vector3 pos;
|
||||||
|
List<String> output;
|
||||||
|
|
||||||
|
public TerminalOutputPacket(Vector3 pos, List<String> output) {
|
||||||
|
this.pos = pos;
|
||||||
|
this.output = output;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TerminalOutputPacket() {
|
||||||
|
this.output = new ArrayList<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void fromBytes(ByteBuf buf) {
|
||||||
|
this.pos = new Vector3(buf.readInt(), buf.readInt(), buf.readInt());
|
||||||
|
int c = buf.readInt();
|
||||||
|
for (int i = 0; i < c; i++) {
|
||||||
|
int slen = buf.readInt();
|
||||||
|
byte[] out = new byte[slen];
|
||||||
|
buf.readBytes(out);
|
||||||
|
output.add(new String(out));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void toBytes(ByteBuf buf) {
|
||||||
|
buf.writeInt(this.pos.intX());
|
||||||
|
buf.writeInt(this.pos.intY());
|
||||||
|
buf.writeInt(this.pos.intZ());
|
||||||
|
|
||||||
|
buf.writeInt(this.output.size());
|
||||||
|
for (String s : this.output) {
|
||||||
|
buf.writeInt(s.getBytes().length);
|
||||||
|
buf.writeBytes(s.getBytes());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
package icbm.gangshao.terminal;
|
||||||
|
|
||||||
|
import cpw.mods.fml.client.FMLClientHandler;
|
||||||
|
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||||
|
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||||
|
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
public class TerminalOutputPacketHandler
|
||||||
|
implements IMessageHandler<TerminalOutputPacket, IMessage> {
|
||||||
|
@Override
|
||||||
|
public IMessage onMessage(TerminalOutputPacket message, MessageContext ctx) {
|
||||||
|
World world = FMLClientHandler.instance().getWorldClient();
|
||||||
|
|
||||||
|
TileEntity te = message.pos.getTileEntity(world);
|
||||||
|
if (te instanceof TileEntityTerminal) {
|
||||||
|
TileEntityTerminal t = (TileEntityTerminal) te;
|
||||||
|
|
||||||
|
boolean shouldSetScroll = !t.terminalOutput.equals(message.output);
|
||||||
|
t.terminalOutput = message.output;
|
||||||
|
if (shouldSetScroll) {
|
||||||
|
t.setScroll(t.terminalOutput.size() - 15);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
|
@ -6,18 +6,22 @@ import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import calclavia.lib.TileEntityUniversalRunnable;
|
import calclavia.lib.TileEntityUniversalRunnable;
|
||||||
|
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||||
|
import icbm.gangshao.ICBMSentry;
|
||||||
import icbm.gangshao.access.AccessLevel;
|
import icbm.gangshao.access.AccessLevel;
|
||||||
import icbm.gangshao.access.UserAccess;
|
import icbm.gangshao.access.UserAccess;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.nbt.NBTBase;
|
import net.minecraft.nbt.NBTBase;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.nbt.NBTTagList;
|
import net.minecraft.nbt.NBTTagList;
|
||||||
|
import net.minecraft.network.NetworkManager;
|
||||||
import net.minecraft.network.Packet;
|
import net.minecraft.network.Packet;
|
||||||
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
|
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
|
||||||
|
import universalelectricity.core.vector.Vector3;
|
||||||
|
|
||||||
public abstract class TileEntityTerminal
|
public abstract class TileEntityTerminal
|
||||||
extends TileEntityUniversalRunnable implements ITerminal {
|
extends TileEntityUniversalRunnable implements ITerminal {
|
||||||
private final List<String> terminalOutput;
|
protected List<String> terminalOutput;
|
||||||
private final List<UserAccess> users;
|
private final List<UserAccess> users;
|
||||||
public static final int SCROLL_SIZE = 15;
|
public static final int SCROLL_SIZE = 15;
|
||||||
private int scroll;
|
private int scroll;
|
||||||
|
@ -51,100 +55,32 @@ public abstract class TileEntityTerminal
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendTerminalOutputToClients() {
|
@Override
|
||||||
// TODO: WTF
|
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
|
||||||
// final List data = new ArrayList();
|
NBTTagCompound nbt = pkt.func_148857_g();
|
||||||
// data.add(TerminalPacketType.TERMINAL_OUTPUT.ordinal());
|
|
||||||
// data.add(this.getTerminalOuput().size());
|
this.readFromNBT(nbt);
|
||||||
// data.addAll(this.getTerminalOuput());
|
|
||||||
// final Packet packet = PacketManager.getPacket(this.getChannel(), this,
|
|
||||||
// data.toArray()); for (final EntityPlayer player : this.playersUsing) {
|
|
||||||
// PacketDispatcher.sendPacketToPlayer(packet, (Player) player);
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: WTF
|
public void sendTerminalOutputToClients() {
|
||||||
// public void sendCommandToServer(final EntityPlayer entityPlayer,
|
ICBMSentry.channel.sendToAllAround(
|
||||||
// final String cmdInput) {
|
new TerminalOutputPacket(new Vector3(this), this.terminalOutput),
|
||||||
// if (this.worldObj.isRemote) {
|
new TargetPoint(
|
||||||
// final Packet packet = PacketManager.getPacket(
|
this.worldObj.provider.dimensionId,
|
||||||
// this.getChannel(), this,
|
this.xCoord,
|
||||||
// TerminalPacketType.GUI_COMMAND.ordinal(),
|
this.yCoord,
|
||||||
// entityPlayer.getDisplayName(), cmdInput);
|
this.zCoord,
|
||||||
// PacketDispatcher.sendPacketToServer(packet);
|
16
|
||||||
// }
|
)
|
||||||
// }
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: WHAT THE ACTUAL FUCK!
|
public void
|
||||||
// @Override
|
sendCommandToServer(final EntityPlayer entityPlayer, final String cmdInput) {
|
||||||
// public void handlePacketData(final INetworkManager network,
|
if (this.worldObj.isRemote) {
|
||||||
// final int packetID,
|
ICBMSentry.channel.sendToServer(new TerminalCommandPacket(new Vector3(this), cmdInput));
|
||||||
// final Packet250CustomPayload packet,
|
}
|
||||||
// final EntityPlayer player,
|
}
|
||||||
// final ByteArrayDataInput dataStream) {
|
|
||||||
// try {
|
|
||||||
// final TerminalPacketType packetType =
|
|
||||||
// TerminalPacketType.values()[dataStream.readInt()]; switch
|
|
||||||
// (packetType) {
|
|
||||||
// case DESCRIPTION_DATA: {
|
|
||||||
// if (this.worldObj.isRemote) {
|
|
||||||
// final short size = dataStream.readShort();
|
|
||||||
// if (size > 0) {
|
|
||||||
// final byte[] byteCode = new byte[size];
|
|
||||||
// dataStream.readFully(byteCode);
|
|
||||||
// this.func_70307_a(CompressedStreamTools.func_74792_a(byteCode));
|
|
||||||
// }
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// case GUI_COMMAND: {
|
|
||||||
// if (!this.field_70331_k.isRemote) {
|
|
||||||
// CommandRegistry.onCommand(
|
|
||||||
// this.field_70331_k.getPlayerEntityByName(dataStream.readUTF()),
|
|
||||||
// this, dataStream.readUTF());
|
|
||||||
// this.sendTerminalOutputToClients();
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// case GUI_EVENT: {
|
|
||||||
// if (this.field_70331_k.isRemote) {
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// if (dataStream.readBoolean()) {
|
|
||||||
// this.playersUsing.add(player);
|
|
||||||
// this.sendTerminalOutputToClients();
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// this.playersUsing.remove(player);
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// case TERMINAL_OUTPUT: {
|
|
||||||
// if (this.field_70331_k.isRemote) {
|
|
||||||
// final int size2 = dataStream.readInt();
|
|
||||||
// final List oldTerminalOutput = new
|
|
||||||
// ArrayList(this.terminalOutput);
|
|
||||||
// this.terminalOutput.clear();
|
|
||||||
// for (int i = 0; i < size2; ++i) {
|
|
||||||
// this.terminalOutput.add(dataStream.readUTF());
|
|
||||||
// }
|
|
||||||
// if (!this.terminalOutput.equals(oldTerminalOutput) &&
|
|
||||||
// this.terminalOutput.size() !=
|
|
||||||
// oldTerminalOutput.size()) {
|
|
||||||
// this.setScroll(this.getTerminalOuput().size() -
|
|
||||||
// 15);
|
|
||||||
// }
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// } catch (final Exception e) {
|
|
||||||
// ZhuYaoBase.LOGGER.severe("Terminal error: " + this.toString());
|
|
||||||
// e.printStackTrace();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AccessLevel getUserAccess(final String username) {
|
public AccessLevel getUserAccess(final String username) {
|
||||||
|
@ -275,13 +211,4 @@ public abstract class TileEntityTerminal
|
||||||
|
|
||||||
nbt.setTag("Users", (NBTBase) usersTag);
|
nbt.setTag("Users", (NBTBase) usersTag);
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum TerminalPacketType {
|
|
||||||
GUI_EVENT("GUI_EVENT", 0),
|
|
||||||
GUI_COMMAND("GUI_COMMAND", 1),
|
|
||||||
TERMINAL_OUTPUT("TERMINAL_OUTPUT", 2),
|
|
||||||
DESCRIPTION_DATA("DESCRIPTION_DATA", 3);
|
|
||||||
|
|
||||||
private TerminalPacketType(final String name, final int ordinal) {}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,19 +65,12 @@ public abstract class TTurretSeat extends TTurretBase implements IMultiBlock {
|
||||||
|
|
||||||
if (entityPlayer == mountedPlayer) {
|
if (entityPlayer == mountedPlayer) {
|
||||||
if (!this.worldObj.isRemote) {
|
if (!this.worldObj.isRemote) {
|
||||||
// TODO: WTF
|
this.tryActivateWeapon();
|
||||||
// PacketManager.sendPacketToClients(this.getRotationPacket());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: WTF
|
|
||||||
// entityPlayer.unmountEntity((Entity) this.entityFake);
|
|
||||||
this.entityFake.setDead();
|
|
||||||
this.entityFake = null;
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.mount(entityPlayer);
|
this.mount(entityPlayer);
|
||||||
|
|
|
@ -141,7 +141,7 @@ public class GRadarTower extends GuiBase {
|
||||||
|
|
||||||
if (this.tileEntity.isDisabled()) {
|
if (this.tileEntity.isDisabled()) {
|
||||||
status = "Disabled!";
|
status = "Disabled!";
|
||||||
} else if (this.tileEntity.prevWatts >= this.tileEntity.getRequest().getWatts()) {
|
} else if (this.tileEntity.canRun()) {
|
||||||
color = "§2";
|
color = "§2";
|
||||||
status = "Radar On!";
|
status = "Radar On!";
|
||||||
} else {
|
} else {
|
||||||
|
@ -170,10 +170,11 @@ public class GRadarTower extends GuiBase {
|
||||||
this.info = "";
|
this.info = "";
|
||||||
this.info2 = "";
|
this.info2 = "";
|
||||||
|
|
||||||
if (this.tileEntity.prevWatts >= this.tileEntity.getRequest().getWatts()) {
|
if (this.tileEntity.canRun()) {
|
||||||
int range = 4;
|
int range = 4;
|
||||||
|
|
||||||
for (final Entity entity : this.tileEntity.xunZhaoEntity) {
|
for (final Entity entity : this.tileEntity.entitiesInRange) {
|
||||||
|
System.out.println("AAAAAAAAAALEC: " + entity.getCommandSenderName());
|
||||||
final Vector2 position = new Vector2(
|
final Vector2 position = new Vector2(
|
||||||
this.radarCenter.x
|
this.radarCenter.x
|
||||||
+ (entity.posX - this.tileEntity.xCoord) / this.radarMapRadius,
|
+ (entity.posX - this.tileEntity.xCoord) / this.radarMapRadius,
|
||||||
|
@ -222,7 +223,7 @@ public class GRadarTower extends GuiBase {
|
||||||
|
|
||||||
range = 2;
|
range = 2;
|
||||||
|
|
||||||
for (final TileEntity jiQi : this.tileEntity.xunZhaoJiQi) {
|
for (final TileEntity jiQi : this.tileEntity.tileEntitiesInRange) {
|
||||||
final Vector2 position = new Vector2(
|
final Vector2 position = new Vector2(
|
||||||
this.radarCenter.x
|
this.radarCenter.x
|
||||||
+ (jiQi.xCoord - this.tileEntity.xCoord) / this.radarMapRadius,
|
+ (jiQi.xCoord - this.tileEntity.xCoord) / this.radarMapRadius,
|
||||||
|
|
|
@ -38,22 +38,23 @@ import universalelectricity.prefab.multiblock.IMultiBlock;
|
||||||
public class TRadarTower extends TileEntityUniversalRunnable
|
public class TRadarTower extends TileEntityUniversalRunnable
|
||||||
implements IRedstoneProvider, IMultiBlock, IPeripheral {
|
implements IRedstoneProvider, IMultiBlock, IPeripheral {
|
||||||
public static final int MAX_BIAN_JING = 500;
|
public static final int MAX_BIAN_JING = 500;
|
||||||
public float xuanZhuan;
|
public float rotation;
|
||||||
public int alarmRadius;
|
public int alarmRadius;
|
||||||
public int safetyRadius;
|
public int safetyRadius;
|
||||||
private List<EMissile> missilesInRange;
|
private List<EMissile> missilesInRange;
|
||||||
public List<Entity> xunZhaoEntity;
|
public List<Entity> entitiesInRange;
|
||||||
public List<TileEntity> xunZhaoJiQi;
|
public List<TileEntity> tileEntitiesInRange;
|
||||||
public boolean emitAll;
|
public boolean emitAll;
|
||||||
private ForgeChunkManager.Ticket ticket;
|
private ForgeChunkManager.Ticket ticket;
|
||||||
|
public double wattsForDisplay;
|
||||||
|
|
||||||
public TRadarTower() {
|
public TRadarTower() {
|
||||||
this.xuanZhuan = 0.0f;
|
this.rotation = 0.0f;
|
||||||
this.alarmRadius = 100;
|
this.alarmRadius = 100;
|
||||||
this.safetyRadius = 50;
|
this.safetyRadius = 50;
|
||||||
this.missilesInRange = new ArrayList<>();
|
this.missilesInRange = new ArrayList<>();
|
||||||
this.xunZhaoEntity = new ArrayList<>();
|
this.entitiesInRange = new ArrayList<>();
|
||||||
this.xunZhaoJiQi = new ArrayList<>();
|
this.tileEntitiesInRange = new ArrayList<>();
|
||||||
this.emitAll = true;
|
this.emitAll = true;
|
||||||
RadarRegistry.register(this);
|
RadarRegistry.register(this);
|
||||||
}
|
}
|
||||||
|
@ -92,6 +93,7 @@ public class TRadarTower extends TileEntityUniversalRunnable
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (!this.worldObj.isRemote) {
|
if (!this.worldObj.isRemote) {
|
||||||
|
this.wattsForDisplay = super.wattsReceived;
|
||||||
if (super.ticks % 40L == 0L) {
|
if (super.ticks % 40L == 0L) {
|
||||||
this.worldObj.markBlockForUpdate(
|
this.worldObj.markBlockForUpdate(
|
||||||
this.xCoord, this.yCoord, this.zCoord
|
this.xCoord, this.yCoord, this.zCoord
|
||||||
|
@ -100,11 +102,11 @@ public class TRadarTower extends TileEntityUniversalRunnable
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.isDisabled()) {
|
if (!this.isDisabled()) {
|
||||||
if (super.wattsReceived >= this.getRequest().getWatts()) {
|
if (this.canRun()) {
|
||||||
this.xuanZhuan += 0.05f;
|
this.rotation += 0.05f;
|
||||||
|
|
||||||
if (this.xuanZhuan > 360.0f) {
|
if (this.rotation > 360.0f) {
|
||||||
this.xuanZhuan = 0.0f;
|
this.rotation = 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.worldObj.isRemote) {
|
if (!this.worldObj.isRemote) {
|
||||||
|
@ -113,23 +115,23 @@ public class TRadarTower extends TileEntityUniversalRunnable
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
final int prevShuMu = this.xunZhaoEntity.size();
|
final int prevShuMu = this.entitiesInRange.size();
|
||||||
this.doScan();
|
this.doScan();
|
||||||
|
|
||||||
if (prevShuMu != this.xunZhaoEntity.size()) {
|
if (prevShuMu != this.entitiesInRange.size()) {
|
||||||
this.worldObj.notifyBlocksOfNeighborChange(
|
this.worldObj.notifyBlocksOfNeighborChange(
|
||||||
this.xCoord, this.yCoord, this.zCoord, this.getBlockType()
|
this.xCoord, this.yCoord, this.zCoord, this.getBlockType()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (this.xunZhaoEntity.size() > 0) {
|
if (this.entitiesInRange.size() > 0) {
|
||||||
this.worldObj.notifyBlocksOfNeighborChange(
|
this.worldObj.notifyBlocksOfNeighborChange(
|
||||||
this.xCoord, this.yCoord, this.zCoord, this.getBlockType()
|
this.xCoord, this.yCoord, this.zCoord, this.getBlockType()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.xunZhaoEntity.clear();
|
this.entitiesInRange.clear();
|
||||||
this.xunZhaoJiQi.clear();
|
this.tileEntitiesInRange.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,8 +147,8 @@ public class TRadarTower extends TileEntityUniversalRunnable
|
||||||
|
|
||||||
private void doScan() {
|
private void doScan() {
|
||||||
this.missilesInRange.clear();
|
this.missilesInRange.clear();
|
||||||
this.xunZhaoEntity.clear();
|
this.entitiesInRange.clear();
|
||||||
this.xunZhaoJiQi.clear();
|
this.tileEntitiesInRange.clear();
|
||||||
final List<Entity> entities
|
final List<Entity> entities
|
||||||
= RadarRegistry.getEntitiesWithinRadius(new Vector3(this).toVector2(), 500);
|
= RadarRegistry.getEntitiesWithinRadius(new Vector3(this).toVector2(), 500);
|
||||||
|
|
||||||
|
@ -156,8 +158,8 @@ public class TRadarTower extends TileEntityUniversalRunnable
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.xunZhaoEntity.contains(entity)) {
|
if (!this.entitiesInRange.contains(entity)) {
|
||||||
this.xunZhaoEntity.add(entity);
|
this.entitiesInRange.add(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.isWeiXianDaoDan((EMissile) entity)) {
|
if (!this.isWeiXianDaoDan((EMissile) entity)) {
|
||||||
|
@ -166,7 +168,7 @@ public class TRadarTower extends TileEntityUniversalRunnable
|
||||||
|
|
||||||
this.missilesInRange.add((EMissile) entity);
|
this.missilesInRange.add((EMissile) entity);
|
||||||
} else {
|
} else {
|
||||||
this.xunZhaoEntity.add(entity);
|
this.entitiesInRange.add(entity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -200,7 +202,7 @@ public class TRadarTower extends TileEntityUniversalRunnable
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.xunZhaoEntity.add(player);
|
this.entitiesInRange.add(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -214,9 +216,9 @@ public class TRadarTower extends TileEntityUniversalRunnable
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.xunZhaoJiQi.add(jiQi);
|
this.tileEntitiesInRange.add(jiQi);
|
||||||
} else {
|
} else {
|
||||||
this.xunZhaoJiQi.add(jiQi);
|
this.tileEntitiesInRange.add(jiQi);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -233,17 +235,12 @@ public class TRadarTower extends TileEntityUniversalRunnable
|
||||||
< this.safetyRadius;
|
< this.safetyRadius;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: WTF
|
|
||||||
// private Packet getDescriptionPacket2() {
|
|
||||||
// return PacketManager.getPacket("ICBM|E", this, 1, this.alarmRadius,
|
|
||||||
// this.safetyBanJing);
|
|
||||||
// }
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Packet getDescriptionPacket() {
|
public Packet getDescriptionPacket() {
|
||||||
NBTTagCompound nbt = new NBTTagCompound();
|
NBTTagCompound nbt = new NBTTagCompound();
|
||||||
|
|
||||||
nbt.setDouble("wattsReceived", super.wattsReceived);
|
nbt.setDouble("wattsReceived", super.wattsReceived);
|
||||||
|
nbt.setDouble("wattsForDisplay", this.wattsForDisplay);
|
||||||
nbt.setInteger("disabledTicks", this.disabledTicks);
|
nbt.setInteger("disabledTicks", this.disabledTicks);
|
||||||
nbt.setInteger("safetyRadius", this.safetyRadius);
|
nbt.setInteger("safetyRadius", this.safetyRadius);
|
||||||
nbt.setInteger("alarmRadius", this.alarmRadius);
|
nbt.setInteger("alarmRadius", this.alarmRadius);
|
||||||
|
@ -258,6 +255,7 @@ public class TRadarTower extends TileEntityUniversalRunnable
|
||||||
NBTTagCompound nbt = pkt.func_148857_g();
|
NBTTagCompound nbt = pkt.func_148857_g();
|
||||||
|
|
||||||
super.wattsReceived = nbt.getDouble("wattsReceived");
|
super.wattsReceived = nbt.getDouble("wattsReceived");
|
||||||
|
this.wattsForDisplay = nbt.getDouble("wattsForDisplay");
|
||||||
this.disabledTicks = nbt.getInteger("disabledTicks");
|
this.disabledTicks = nbt.getInteger("disabledTicks");
|
||||||
this.safetyRadius = nbt.getInteger("safetyRadius");
|
this.safetyRadius = nbt.getInteger("safetyRadius");
|
||||||
this.alarmRadius = nbt.getInteger("alarmRadius");
|
this.alarmRadius = nbt.getInteger("alarmRadius");
|
||||||
|
@ -436,6 +434,14 @@ public class TRadarTower extends TileEntityUniversalRunnable
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean canRun() {
|
||||||
|
if (this.worldObj.isRemote) {
|
||||||
|
return this.wattsForDisplay >= this.getRequest().getWatts();
|
||||||
|
} else {
|
||||||
|
return super.wattsReceived >= this.getRequest().getWatts();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getType() {
|
public String getType() {
|
||||||
return "ICBMRadar";
|
return "ICBMRadar";
|
||||||
|
|
|
@ -24,7 +24,7 @@ public class RRadarTower extends TileEntitySpecialRenderer {
|
||||||
GL11.glTranslatef((float) x + 0.5f, (float) y + 1.5f, (float) z + 0.5f);
|
GL11.glTranslatef((float) x + 0.5f, (float) y + 1.5f, (float) z + 0.5f);
|
||||||
this.bindTexture(new ResourceLocation("icbm", "textures/models/radar.png"));
|
this.bindTexture(new ResourceLocation("icbm", "textures/models/radar.png"));
|
||||||
GL11.glRotatef(180.0f, 0.0f, 0.0f, 1.0f);
|
GL11.glRotatef(180.0f, 0.0f, 0.0f, 1.0f);
|
||||||
RRadarTower.MODEL.render(tileEntity.xuanZhuan, 0.0625f);
|
RRadarTower.MODEL.render(tileEntity.rotation, 0.0625f);
|
||||||
GL11.glPopMatrix();
|
GL11.glPopMatrix();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,9 +32,11 @@ public class ExEmpSignal extends ZhaPin {
|
||||||
final List<Entity> entitiesNearby
|
final List<Entity> entitiesNearby
|
||||||
= RadarRegistry.getEntitiesWithinRadius(position.toVector2(), radius);
|
= RadarRegistry.getEntitiesWithinRadius(position.toVector2(), radius);
|
||||||
|
|
||||||
|
System.out.println("AAAAAAALEC: " + entitiesNearby.size());
|
||||||
for (final Entity entity : entitiesNearby) {
|
for (final Entity entity : entitiesNearby) {
|
||||||
if (entity instanceof IMissile && !entity.isEntityEqual(explosionSource)
|
if (entity instanceof IMissile && !entity.isEntityEqual(explosionSource)
|
||||||
&& ((IMissile) entity).getTicksInAir() > -1) {
|
&& ((IMissile) entity).getTicksInAir() > -1) {
|
||||||
|
System.out.println("AAAAAAALEC: dropMissileAsItem");
|
||||||
((IMissile) entity).dropMissileAsItem();
|
((IMissile) entity).dropMissileAsItem();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue