fix: remote detonator works now

This commit is contained in:
LordMZTE 2022-11-12 10:34:46 +01:00
parent 9a42fed16c
commit ee1862ca0c
Signed by: LordMZTE
GPG Key ID: B64802DC33A64FF6
5 changed files with 26 additions and 20 deletions

View File

@ -6,6 +6,5 @@
- can push explosive entities
- flying blocks dont properly render
- black hole doesn't suck in blocks
- remote detonator doesnt work
- see `// TODO: WTF`

View File

@ -5,9 +5,12 @@ import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import icbm.zhapin.dianqi.ItLaserDesignator;
import icbm.zhapin.dianqi.ItRadarGun;
import icbm.zhapin.zhapin.BExplosives;
import icbm.zhapin.zhapin.TExplosive;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import universalelectricity.core.electricity.ElectricityPack;
import universalelectricity.core.vector.Vector3;
@ -65,12 +68,23 @@ public class ItemUsePacketHandler implements IMessageHandler<ItemUsePacket, IMes
}
} else if (message.type == ItemUsePacket.Type.REMOTE) {
final ItemStack itemStack = player.inventory.getCurrentItem();
ICBMExplosion.itYaoKong.onProvide(
ElectricityPack.getFromWatts(
1500.0, ICBMExplosion.itYaoKong.getVoltage(itemStack)
),
itemStack
);
TileEntity te = message.pos.getTileEntity(player.worldObj);
if (te instanceof TExplosive) {
BExplosives.yinZha(
player.worldObj,
message.pos.intX(),
message.pos.intY(),
message.pos.intZ(),
((TExplosive) te).explosiveId,
0
);
ICBMExplosion.itYaoKong.onProvide(
ElectricityPack.getFromWatts(
1500.0, ICBMExplosion.itYaoKong.getVoltage(itemStack)
),
itemStack
);
}
}
return null;

View File

@ -125,10 +125,9 @@ public class ItRemoteDetonator extends ItElectricICBM {
if (this.nengZha(tileEntity)) {
if (this.getJoules(itemStack) > 1500.0) {
// TODO: WTF
//PacketDispatcher.sendPacketToServer(
// PacketManager.getPacket("ICBM|E", tileEntity,
// 2));
ICBMExplosion.channel.sendToServer(new ItemUsePacket(
ItemUsePacket.Type.REMOTE, new Vector3(tileEntity)
));
return itemStack;
}
@ -143,12 +142,9 @@ public class ItRemoteDetonator extends ItElectricICBM {
= this.getSavedCoord(itemStack).getTileEntity((IBlockAccess) world);
if (this.nengZha(tileEntity2)) {
// TODO: WTF
//PacketDispatcher.sendPacketToServer(
// PacketManager.getPacket("ICBM|E", tileEntity2, 2));
ICBMExplosion.channel.sendToServer(
new ItemUsePacket(ItemUsePacket.Type.REMOTE, new Vector3())
);
ICBMExplosion.channel.sendToServer(new ItemUsePacket(
ItemUsePacket.Type.REMOTE, new Vector3(tileEntity2)
));
}
} else {
entityPlayer.addChatMessage(

View File

@ -174,7 +174,6 @@ public class GRadarTower extends GuiBase {
int range = 4;
for (final Entity entity : this.tileEntity.entitiesInRange) {
System.out.println("AAAAAAAAAALEC: " + entity.getCommandSenderName());
final Vector2 position = new Vector2(
this.radarCenter.x
+ (entity.posX - this.tileEntity.xCoord) / this.radarMapRadius,

View File

@ -32,11 +32,9 @@ public class ExEmpSignal extends ZhaPin {
final List<Entity> entitiesNearby
= RadarRegistry.getEntitiesWithinRadius(position.toVector2(), radius);
System.out.println("AAAAAAALEC: " + entitiesNearby.size());
for (final Entity entity : entitiesNearby) {
if (entity instanceof IMissile && !entity.isEntityEqual(explosionSource)
&& ((IMissile) entity).getTicksInAir() > -1) {
System.out.println("AAAAAAALEC: dropMissileAsItem");
((IMissile) entity).dropMissileAsItem();
}
}