Updated internal names consistency
This commit is contained in:
parent
04613742d4
commit
2a61625f7d
13 changed files with 158 additions and 49 deletions
|
@ -88,11 +88,11 @@ import cr0s.warpdrive.block.passive.BlockIridium;
|
|||
import cr0s.warpdrive.block.passive.BlockTransportBeacon;
|
||||
import cr0s.warpdrive.block.passive.ItemBlockDecorative;
|
||||
import cr0s.warpdrive.block.weapon.BlockLaserCamera;
|
||||
import cr0s.warpdrive.command.DebugCommand;
|
||||
import cr0s.warpdrive.command.GenerateCommand;
|
||||
import cr0s.warpdrive.command.InvisibleCommand;
|
||||
import cr0s.warpdrive.command.JumpgateCommand;
|
||||
import cr0s.warpdrive.command.SpaceTpCommand;
|
||||
import cr0s.warpdrive.command.CommandDebug;
|
||||
import cr0s.warpdrive.command.CommandGenerate;
|
||||
import cr0s.warpdrive.command.CommandInvisible;
|
||||
import cr0s.warpdrive.command.CommandJumpgates;
|
||||
import cr0s.warpdrive.command.CommandSpace;
|
||||
import cr0s.warpdrive.conf.WarpDriveConfig;
|
||||
import cr0s.warpdrive.data.CamerasRegistry;
|
||||
import cr0s.warpdrive.data.CloakManager;
|
||||
|
@ -733,11 +733,11 @@ public class WarpDrive implements LoadingCallback {
|
|||
cloaks = new CloakManager();
|
||||
MinecraftForge.EVENT_BUS.register(new CloakChunkWatcher());
|
||||
|
||||
event.registerServerCommand(new GenerateCommand());
|
||||
event.registerServerCommand(new SpaceTpCommand());
|
||||
event.registerServerCommand(new InvisibleCommand());
|
||||
event.registerServerCommand(new JumpgateCommand());
|
||||
event.registerServerCommand(new DebugCommand());
|
||||
event.registerServerCommand(new CommandGenerate());
|
||||
event.registerServerCommand(new CommandSpace());
|
||||
event.registerServerCommand(new CommandInvisible());
|
||||
event.registerServerCommand(new CommandJumpgates());
|
||||
event.registerServerCommand(new CommandDebug());
|
||||
}
|
||||
|
||||
public Ticket registerChunkLoadTE(TileEntityAbstractChunkLoading te, boolean refreshLoading) {
|
||||
|
|
|
@ -15,7 +15,7 @@ import cr0s.warpdrive.conf.WarpDriveConfig;
|
|||
* /wdebug <dimension> <coordinates> <blockId> <Metadata> <actions>
|
||||
*/
|
||||
|
||||
public class DebugCommand extends CommandBase
|
||||
public class CommandDebug extends CommandBase
|
||||
{
|
||||
@Override
|
||||
public String getCommandName()
|
|
@ -17,7 +17,7 @@ import cr0s.warpdrive.world.WorldGenStation;
|
|||
* moon, ship, asteroid, astfield, gascloud, star
|
||||
*/
|
||||
|
||||
public class GenerateCommand extends CommandBase {
|
||||
public class CommandGenerate extends CommandBase {
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
return "generate";
|
|
@ -9,7 +9,7 @@ import net.minecraft.server.MinecraftServer;
|
|||
|
||||
import cr0s.warpdrive.WarpDrive;
|
||||
|
||||
public class InvisibleCommand extends CommandBase {
|
||||
public class CommandInvisible extends CommandBase {
|
||||
@Override
|
||||
public int getRequiredPermissionLevel() {
|
||||
return 4;
|
|
@ -5,7 +5,7 @@ import net.minecraft.command.ICommandSender;
|
|||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import cr0s.warpdrive.WarpDrive;
|
||||
|
||||
public class JumpgateCommand extends CommandBase {
|
||||
public class CommandJumpgates extends CommandBase {
|
||||
@Override
|
||||
public int getRequiredPermissionLevel() {
|
||||
return 4;
|
|
@ -13,7 +13,7 @@ import cr0s.warpdrive.WarpDrive;
|
|||
import cr0s.warpdrive.conf.WarpDriveConfig;
|
||||
import cr0s.warpdrive.world.SpaceTeleporter;
|
||||
|
||||
public class SpaceTpCommand extends CommandBase {
|
||||
public class CommandSpace extends CommandBase {
|
||||
@Override
|
||||
public int getRequiredPermissionLevel() {
|
||||
return 2;
|
110
src/main/java/cr0s/warpdrive/network/MessageBeamEffect.java
Normal file
110
src/main/java/cr0s/warpdrive/network/MessageBeamEffect.java
Normal file
|
@ -0,0 +1,110 @@
|
|||
package cr0s.warpdrive.network;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.world.World;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
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 cr0s.warpdrive.WarpDrive;
|
||||
import cr0s.warpdrive.conf.WarpDriveConfig;
|
||||
import cr0s.warpdrive.data.Vector3;
|
||||
import cr0s.warpdrive.render.EntityFXBeam;
|
||||
|
||||
|
||||
public class MessageBeamEffect implements IMessage, IMessageHandler<MessageBeamEffect, IMessage> {
|
||||
|
||||
private Vector3 source;
|
||||
private Vector3 target;
|
||||
private float red;
|
||||
private float green;
|
||||
private float blue;
|
||||
private int age;
|
||||
private int energy;
|
||||
|
||||
public MessageBeamEffect() {
|
||||
// required on receiving side
|
||||
}
|
||||
|
||||
public MessageBeamEffect(final Vector3 source, final Vector3 target, final float red, final float green, final float blue, final int age, final int energy) {
|
||||
this.source = source;
|
||||
this.target = target;
|
||||
this.red = red;
|
||||
this.green = green;
|
||||
this.blue = blue;
|
||||
this.age = age;
|
||||
this.energy = energy;
|
||||
}
|
||||
|
||||
public MessageBeamEffect(
|
||||
final double sourceX, final double sourceY, final double sourceZ,
|
||||
final double targetX, final double targetY, final double targetZ,
|
||||
final float red, final float green, final float blue,
|
||||
final int age, final int energy) {
|
||||
this.source = new Vector3(sourceX, sourceY, sourceZ);
|
||||
this.target = new Vector3(targetX, targetY, targetZ);
|
||||
this.red = red;
|
||||
this.green = green;
|
||||
this.blue = blue;
|
||||
this.age = age;
|
||||
this.energy = energy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fromBytes(ByteBuf buffer) {
|
||||
double x = buffer.readDouble();
|
||||
double y = buffer.readDouble();
|
||||
double z = buffer.readDouble();
|
||||
source = new Vector3(x, y, z);
|
||||
|
||||
x = buffer.readDouble();
|
||||
y = buffer.readDouble();
|
||||
z = buffer.readDouble();
|
||||
target = new Vector3(x, y, z);
|
||||
|
||||
red = buffer.readFloat();
|
||||
green = buffer.readFloat();
|
||||
blue = buffer.readFloat();
|
||||
age = buffer.readByte();
|
||||
energy = buffer.readInt();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toBytes(ByteBuf buffer) {
|
||||
buffer.writeDouble(source.x);
|
||||
buffer.writeDouble(source.y);
|
||||
buffer.writeDouble(source.z);
|
||||
buffer.writeDouble(target.x);
|
||||
buffer.writeDouble(target.y);
|
||||
buffer.writeDouble(target.z);
|
||||
buffer.writeFloat(red);
|
||||
buffer.writeFloat(green);
|
||||
buffer.writeFloat(blue);
|
||||
buffer.writeByte(age);
|
||||
buffer.writeInt(energy);
|
||||
}
|
||||
|
||||
private void handle(World worldObj) {
|
||||
FMLClientHandler.instance().getClient().effectRenderer.addEffect(new EntityFXBeam(worldObj, source.clone(), target.clone(), red, green, blue, age, energy));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMessage onMessage(MessageBeamEffect beamEffectMessage, MessageContext context) {
|
||||
// skip in case player just logged in
|
||||
if (Minecraft.getMinecraft().theWorld == null) {
|
||||
WarpDrive.logger.error("WorldObj is null, ignoring beam packet");
|
||||
return null;
|
||||
}
|
||||
|
||||
if (WarpDriveConfig.G_DEBUGMODE) {
|
||||
WarpDrive.debugPrint("Received beam packet from " + beamEffectMessage.source + " to " + beamEffectMessage.target
|
||||
+ " as RGB " + beamEffectMessage.red + " " + beamEffectMessage.green + " " + beamEffectMessage.blue
|
||||
+ " age " + beamEffectMessage.age +" energy " + beamEffectMessage.energy);
|
||||
}
|
||||
|
||||
beamEffectMessage.handle(Minecraft.getMinecraft().theWorld);
|
||||
|
||||
return null; // no response
|
||||
}
|
||||
}
|
|
@ -18,10 +18,10 @@ import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
|||
import cr0s.warpdrive.WarpDrive;
|
||||
import cr0s.warpdrive.conf.WarpDriveConfig;
|
||||
import cr0s.warpdrive.data.Vector3;
|
||||
import cr0s.warpdrive.render.FXBeam;
|
||||
import cr0s.warpdrive.render.EntityFXBeam;
|
||||
|
||||
|
||||
public class CloakMessage implements IMessage, IMessageHandler<CloakMessage, IMessage> {
|
||||
public class MessageCloak implements IMessage, IMessageHandler<MessageCloak, IMessage> {
|
||||
private int minX;
|
||||
private int minY;
|
||||
private int minZ;
|
||||
|
@ -31,11 +31,11 @@ public class CloakMessage implements IMessage, IMessageHandler<CloakMessage, IMe
|
|||
private int tier;
|
||||
private boolean decloak;
|
||||
|
||||
public CloakMessage() {
|
||||
public MessageCloak() {
|
||||
// required on receiving side
|
||||
}
|
||||
|
||||
public CloakMessage(final AxisAlignedBB aabb, final int tier, final boolean decloak) {
|
||||
public MessageCloak(final AxisAlignedBB aabb, final int tier, final boolean decloak) {
|
||||
this.minX = (int)aabb.minX;
|
||||
this.minY = (int)aabb.minY;
|
||||
this.minZ = (int)aabb.minZ;
|
||||
|
@ -115,7 +115,7 @@ public class CloakMessage implements IMessage, IMessageHandler<CloakMessage, IMe
|
|||
double radiusZ = (maxZ - minZ) / 2.0D + 5.0D;
|
||||
|
||||
for (int i = 0; i < numLasers; i++) {
|
||||
FMLClientHandler.instance().getClient().effectRenderer.addEffect(new FXBeam(player.worldObj,
|
||||
FMLClientHandler.instance().getClient().effectRenderer.addEffect(new EntityFXBeam(player.worldObj,
|
||||
new Vector3(
|
||||
centerX + radiusX * player.worldObj.rand.nextGaussian(),
|
||||
centerY + radiusY * player.worldObj.rand.nextGaussian(),
|
||||
|
@ -131,7 +131,7 @@ public class CloakMessage implements IMessage, IMessageHandler<CloakMessage, IMe
|
|||
}
|
||||
|
||||
@Override
|
||||
public IMessage onMessage(CloakMessage cloakMessage, MessageContext context) {
|
||||
public IMessage onMessage(MessageCloak cloakMessage, MessageContext context) {
|
||||
// skip in case player just logged in
|
||||
if (Minecraft.getMinecraft().theWorld == null) {
|
||||
WarpDrive.logger.error("WorldObj is null, ignoring cloak packet");
|
|
@ -15,24 +15,24 @@ import cr0s.warpdrive.conf.WarpDriveConfig;
|
|||
import cr0s.warpdrive.data.Vector3;
|
||||
|
||||
|
||||
public class FrequencyMessage implements IMessage, IMessageHandler<FrequencyMessage, IMessage> {
|
||||
public class MessageFrequency implements IMessage, IMessageHandler<MessageFrequency, IMessage> {
|
||||
private int x;
|
||||
private int y;
|
||||
private int z;
|
||||
private int frequency;
|
||||
|
||||
public FrequencyMessage() {
|
||||
public MessageFrequency() {
|
||||
// required on receiving side
|
||||
}
|
||||
|
||||
public FrequencyMessage(final Vector3 target, final int frequency) {
|
||||
public MessageFrequency(final Vector3 target, final int frequency) {
|
||||
this.x = target.intX();
|
||||
this.y = target.intY();
|
||||
this.z = target.intZ();
|
||||
this.frequency = frequency;
|
||||
}
|
||||
|
||||
public FrequencyMessage(final int x, final int y, final int z, final int frequency) {
|
||||
public MessageFrequency(final int x, final int y, final int z, final int frequency) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
|
@ -73,7 +73,7 @@ public class FrequencyMessage implements IMessage, IMessageHandler<FrequencyMess
|
|||
}
|
||||
|
||||
@Override
|
||||
public IMessage onMessage(FrequencyMessage frequencyMessage, MessageContext context) {
|
||||
public IMessage onMessage(MessageFrequency frequencyMessage, MessageContext context) {
|
||||
// skip in case player just logged in
|
||||
if (Minecraft.getMinecraft().theWorld == null) {
|
||||
WarpDrive.logger.error("WorldObj is null, ignoring frequency packet");
|
|
@ -12,18 +12,18 @@ import cr0s.warpdrive.conf.WarpDriveConfig;
|
|||
import cr0s.warpdrive.data.Vector3;
|
||||
|
||||
|
||||
public class TargetingMessage implements IMessage, IMessageHandler<TargetingMessage, IMessage> {
|
||||
public class MessageTargeting implements IMessage, IMessageHandler<MessageTargeting, IMessage> {
|
||||
private int x;
|
||||
private int y;
|
||||
private int z;
|
||||
private float yaw;
|
||||
private float pitch;
|
||||
|
||||
public TargetingMessage() {
|
||||
public MessageTargeting() {
|
||||
// required on receiving side
|
||||
}
|
||||
|
||||
public TargetingMessage(final Vector3 target, final float yaw, final float pitch) {
|
||||
public MessageTargeting(final Vector3 target, final float yaw, final float pitch) {
|
||||
this.x = target.intX();
|
||||
this.y = target.intY();
|
||||
this.z = target.intZ();
|
||||
|
@ -31,7 +31,7 @@ public class TargetingMessage implements IMessage, IMessageHandler<TargetingMess
|
|||
this.pitch = pitch;
|
||||
}
|
||||
|
||||
public TargetingMessage(final int x, final int y, final int z, final float yaw, final float pitch) {
|
||||
public MessageTargeting(final int x, final int y, final int z, final float yaw, final float pitch) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
|
@ -66,7 +66,7 @@ public class TargetingMessage implements IMessage, IMessageHandler<TargetingMess
|
|||
}
|
||||
|
||||
@Override
|
||||
public IMessage onMessage(TargetingMessage targetingMessage, MessageContext context) {
|
||||
public IMessage onMessage(MessageTargeting targetingMessage, MessageContext context) {
|
||||
if (WarpDriveConfig.G_DEBUGMODE) {
|
||||
WarpDrive.debugPrint("Received target packet: (" + targetingMessage.x + "; " + targetingMessage.y + "; " + targetingMessage.z
|
||||
+ ") yaw: " + targetingMessage.yaw + " pitch: " + targetingMessage.pitch);
|
|
@ -13,10 +13,10 @@ import cpw.mods.fml.common.network.NetworkRegistry;
|
|||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cr0s.warpdrive.network.CloakMessage;
|
||||
import cr0s.warpdrive.network.FrequencyMessage;
|
||||
import cr0s.warpdrive.network.BeamEffectMessage;
|
||||
import cr0s.warpdrive.network.TargetingMessage;
|
||||
import cr0s.warpdrive.network.MessageCloak;
|
||||
import cr0s.warpdrive.network.MessageFrequency;
|
||||
import cr0s.warpdrive.network.MessageBeamEffect;
|
||||
import cr0s.warpdrive.network.MessageTargeting;
|
||||
import cr0s.warpdrive.WarpDrive;
|
||||
import cr0s.warpdrive.data.Vector3;
|
||||
|
||||
|
@ -24,17 +24,17 @@ public class PacketHandler {
|
|||
public static final SimpleNetworkWrapper simpleNetworkManager = NetworkRegistry.INSTANCE.newSimpleChannel(WarpDrive.MODID);
|
||||
|
||||
public static void init() {
|
||||
simpleNetworkManager.registerMessage(BeamEffectMessage.class, BeamEffectMessage.class, 0, Side.CLIENT);
|
||||
simpleNetworkManager.registerMessage(FrequencyMessage.class , FrequencyMessage.class , 1, Side.CLIENT);
|
||||
simpleNetworkManager.registerMessage(TargetingMessage.class , TargetingMessage.class , 2, Side.SERVER);
|
||||
simpleNetworkManager.registerMessage(CloakMessage.class , CloakMessage.class , 3, Side.CLIENT);
|
||||
simpleNetworkManager.registerMessage(MessageBeamEffect.class, MessageBeamEffect.class, 0, Side.CLIENT);
|
||||
simpleNetworkManager.registerMessage(MessageFrequency.class , MessageFrequency.class , 1, Side.CLIENT);
|
||||
simpleNetworkManager.registerMessage(MessageTargeting.class , MessageTargeting.class , 2, Side.SERVER);
|
||||
simpleNetworkManager.registerMessage(MessageCloak.class , MessageCloak.class , 3, Side.CLIENT);
|
||||
}
|
||||
|
||||
// Beam effect sent to client side
|
||||
public static void sendBeamPacket(World worldObj, Vector3 source, Vector3 target, float red, float green, float blue, int age, int energy, int radius) {
|
||||
assert(FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER);
|
||||
|
||||
BeamEffectMessage beamMessage = new BeamEffectMessage(source, target, red, green, blue, age, energy);
|
||||
MessageBeamEffect beamMessage = new MessageBeamEffect(source, target, red, green, blue, age, energy);
|
||||
|
||||
// small beam are sent relative to beam center
|
||||
if (source.distanceTo_square(target) < 3600 /* 60 * 60 */) {
|
||||
|
@ -67,7 +67,7 @@ public class PacketHandler {
|
|||
public static void sendBeamPacketToPlayersInArea(World worldObj, Vector3 source, Vector3 target, float red, float green, float blue, int age, int energy, AxisAlignedBB aabb) {
|
||||
assert(FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER);
|
||||
|
||||
BeamEffectMessage beamMessage = new BeamEffectMessage(source, target, red, green, blue, age, energy);
|
||||
MessageBeamEffect beamMessage = new MessageBeamEffect(source, target, red, green, blue, age, energy);
|
||||
// Send packet to all players within cloaked area
|
||||
List<Entity> list = worldObj.getEntitiesWithinAABB(EntityPlayerMP.class, aabb);
|
||||
for (Entity entity : list) {
|
||||
|
@ -79,21 +79,21 @@ public class PacketHandler {
|
|||
|
||||
// Monitor/Laser/Camera updating its frequency to client side
|
||||
public static void sendFreqPacket(int dimensionId, int xCoord, int yCoord, int zCoord, int frequency) {
|
||||
FrequencyMessage frequencyMessage = new FrequencyMessage(xCoord, yCoord, zCoord, frequency);
|
||||
MessageFrequency frequencyMessage = new MessageFrequency(xCoord, yCoord, zCoord, frequency);
|
||||
simpleNetworkManager.sendToAllAround(frequencyMessage, new TargetPoint(dimensionId, xCoord, yCoord, zCoord, 100));
|
||||
WarpDrive.debugPrint("Sent frequency packet (" + xCoord + ", " + yCoord + ", " + zCoord + ") frequency " + frequency);
|
||||
}
|
||||
|
||||
// LaserCamera shooting at target (client -> server)
|
||||
public static void sendLaserTargetingPacket(int x, int y, int z, float yaw, float pitch) {
|
||||
TargetingMessage targetingMessage = new TargetingMessage(x, y, z, yaw, pitch);
|
||||
MessageTargeting targetingMessage = new MessageTargeting(x, y, z, yaw, pitch);
|
||||
simpleNetworkManager.sendToServer(targetingMessage);
|
||||
WarpDrive.debugPrint("Sent targeting packet (" + x + ", " + y + ", " + z + ") yaw " + yaw + " pitch " + pitch);
|
||||
}
|
||||
|
||||
// Sending cloaking area definition (server -> client)
|
||||
public static void sendCloakPacket(EntityPlayer player, AxisAlignedBB aabb, int tier, boolean decloak) {
|
||||
CloakMessage cloakMessage = new CloakMessage(aabb, tier, decloak);
|
||||
MessageCloak cloakMessage = new MessageCloak(aabb, tier, decloak);
|
||||
simpleNetworkManager.sendTo(cloakMessage, (EntityPlayerMP) player);
|
||||
WarpDrive.debugPrint("Sent cloak packet (aabb " + aabb + ") tier " + tier + " decloak " + decloak);
|
||||
}
|
||||
|
|
|
@ -12,8 +12,7 @@ import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
|||
import cr0s.warpdrive.WarpDrive;
|
||||
import cr0s.warpdrive.conf.WarpDriveConfig;
|
||||
|
||||
public class CameraOverlay
|
||||
{
|
||||
public class CameraOverlay {
|
||||
private Minecraft mc;
|
||||
private int frameCount = 0;
|
||||
private static int ANIMATION_FRAMES = 200;
|
||||
|
|
|
@ -17,7 +17,7 @@ import cpw.mods.fml.relauncher.SideOnly;
|
|||
import cr0s.warpdrive.data.Vector3;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class FXBeam extends EntityFX
|
||||
public class EntityFXBeam extends EntityFX
|
||||
{
|
||||
private static ResourceLocation TEXTURE = null;
|
||||
|
||||
|
@ -40,7 +40,7 @@ public class FXBeam extends EntityFX
|
|||
|
||||
boolean a = false;
|
||||
|
||||
public FXBeam(World par1World, Vector3 position, float yaw, float pitch, float red, float green, float blue, int age, int energy)
|
||||
public EntityFXBeam(World par1World, Vector3 position, float yaw, float pitch, float red, float green, float blue, int age, int energy)
|
||||
{
|
||||
super(par1World, position.x, position.y, position.z, 0.0D, 0.0D, 0.0D);
|
||||
a = true;
|
||||
|
@ -79,7 +79,7 @@ public class FXBeam extends EntityFX
|
|||
}
|
||||
}
|
||||
|
||||
public FXBeam(World par1World, Vector3 position, Vector3 target, float red, float green, float blue, int age, int energy)
|
||||
public EntityFXBeam(World par1World, Vector3 position, Vector3 target, float red, float green, float blue, int age, int energy)
|
||||
{
|
||||
super(par1World, position.x, position.y, position.z, 0.0D, 0.0D, 0.0D);
|
||||
this.setRGB(red, green, blue);
|
Loading…
Reference in a new issue