This commit is contained in:
DarkGuardsman 2013-09-08 18:56:13 -04:00
parent 1473ae2a05
commit 8f15c5357c
17 changed files with 45 additions and 39 deletions

View file

@ -14,12 +14,13 @@ import dark.core.common.CommonProxy;
import dark.core.common.CoreRecipeLoader; import dark.core.common.CoreRecipeLoader;
import dark.core.common.DarkMain; import dark.core.common.DarkMain;
import dark.core.common.transmit.TileEntityWire; import dark.core.common.transmit.TileEntityWire;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public class ClientProxy extends CommonProxy public class ClientProxy extends CommonProxy
{ {
/** Renders a laser beam from one power to another by a set color for a set time /** Renders a laser beam from one power to another by a set color for a set time
* *
* @param world - world this laser is to be rendered in * @param world - world this laser is to be rendered in
* @param position - start vector3 * @param position - start vector3
* @param target - end vector3 * @param target - end vector3

View file

@ -19,7 +19,7 @@ import cpw.mods.fml.relauncher.SideOnly;
import dark.core.common.DarkMain; import dark.core.common.DarkMain;
/** Based off Thaumcraft's Beam Renderer. /** Based off Thaumcraft's Beam Renderer.
* *
* @author Calclavia, Azanor */ * @author Calclavia, Azanor */
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public class FXBeam extends EntityFX public class FXBeam extends EntityFX

View file

@ -39,16 +39,19 @@ public class FluidBlockRenderer
Icon icon = fluid.getStillIcon(); Icon icon = fluid.getStillIcon();
if (icon == null) if (icon == null)
{ {
Block block = Block.blocksList[fluid.getBlockID()]; if (fluid.getBlockID() > 0)
if (block != null)
{ {
if (block.blockID == Block.waterStill.blockID) Block block = Block.blocksList[fluid.getBlockID()];
if (block != null)
{ {
icon = Block.waterStill.getIcon(0, 0); if (block.blockID == Block.waterStill.blockID)
} {
if (block.blockID == Block.lavaStill.blockID) icon = Block.waterStill.getIcon(0, 0);
{ }
icon = Block.lavaStill.getIcon(0, 0); if (block.blockID == Block.lavaStill.blockID)
{
icon = Block.lavaStill.getIcon(0, 0);
}
} }
} }
if (icon == null) if (icon == null)

View file

@ -23,6 +23,7 @@ import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import dark.core.prefab.helpers.BlockRenderInfo; import dark.core.prefab.helpers.BlockRenderInfo;
import dark.core.prefab.helpers.EntityFakeBlock; import dark.core.prefab.helpers.EntityFakeBlock;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public class RenderFakeBlock extends Render public class RenderFakeBlock extends Render
{ {
@ -88,7 +89,7 @@ public class RenderFakeBlock extends Render
} }
/** Renders a block at given location /** Renders a block at given location
* *
* @param blockInterface - class used to store info for the render process * @param blockInterface - class used to store info for the render process
* @param world - world rendering in * @param world - world rendering in
* @param x - position on x axis * @param x - position on x axis

View file

@ -27,7 +27,7 @@ public class CommonProxy
} }
/** Renders a laser beam from one power to another by a set color for a set time /** Renders a laser beam from one power to another by a set color for a set time
* *
* @param world - world this laser is to be rendered in * @param world - world this laser is to be rendered in
* @param position - start vector3 * @param position - start vector3
* @param target - end vector3 * @param target - end vector3

View file

@ -6,7 +6,7 @@ import buildcraft.api.transport.IPipeTile.PipeType;
import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.Loader;
/** Handles working with other mod without or without the need of the APIs. /** Handles working with other mod without or without the need of the APIs.
* *
* @author DarkGuardsman */ * @author DarkGuardsman */
public class ExternalModHandler public class ExternalModHandler
{ {
@ -37,7 +37,7 @@ public class ExternalModHandler
} }
/** Checks to see if something can run powerless based on mods loaded /** Checks to see if something can run powerless based on mods loaded
* *
* @param optional - power system that the device can use * @param optional - power system that the device can use
* @return true if free power is to be generated */ * @return true if free power is to be generated */
public static boolean runPowerLess() public static boolean runPowerLess()

View file

@ -40,7 +40,8 @@ public class BlockColorGlass extends BlockColored
return false; return false;
} }
@Override @SideOnly(Side.CLIENT) @Override
@SideOnly(Side.CLIENT)
public boolean renderAsNormalBlock() public boolean renderAsNormalBlock()
{ {
return false; return false;

View file

@ -42,7 +42,8 @@ public class BlockOre extends Block implements IExtraObjectInfo
} }
} }
@Override @SideOnly(Side.CLIENT) @Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister par1IconRegister) public void registerIcons(IconRegister par1IconRegister)
{ {
for (int i = 0; i < EnumMeterials.values().length; i++) for (int i = 0; i < EnumMeterials.values().length; i++)
@ -54,7 +55,8 @@ public class BlockOre extends Block implements IExtraObjectInfo
} }
} }
@Override @SideOnly(Side.CLIENT) @Override
@SideOnly(Side.CLIENT)
public Icon getIcon(int side, int metadata) public Icon getIcon(int side, int metadata)
{ {
if (this.icons[metadata] != null) if (this.icons[metadata] != null)

View file

@ -13,7 +13,7 @@ import dark.core.common.DarkMain;
import dark.core.prefab.items.ItemBasic; import dark.core.prefab.items.ItemBasic;
/** A metadata item containing parts of various machines in Liquid Mechanics Mod. /** A metadata item containing parts of various machines in Liquid Mechanics Mod.
* *
* @author Rs */ * @author Rs */
public class ItemParts extends ItemBasic public class ItemParts extends ItemBasic
{ {

View file

@ -26,7 +26,7 @@ import cpw.mods.fml.common.network.PacketDispatcher;
import cpw.mods.fml.common.network.Player; import cpw.mods.fml.common.network.Player;
/** Packet manager based off the PacketManager from UE created by Calclavia /** Packet manager based off the PacketManager from UE created by Calclavia
* *
* @author DarkGuardsman */ * @author DarkGuardsman */
public class PacketHandler implements IPacketHandler, IPacketReceiver public class PacketHandler implements IPacketHandler, IPacketReceiver
{ {
@ -34,7 +34,6 @@ public class PacketHandler implements IPacketHandler, IPacketReceiver
public static HashMap<Integer, IPacketManager> packetTypes = new HashMap(); public static HashMap<Integer, IPacketManager> packetTypes = new HashMap();
public static PacketManagerTile tile = new PacketManagerTile(); public static PacketManagerTile tile = new PacketManagerTile();
public static PacketManagerEffects effects = new PacketManagerEffects(); public static PacketManagerEffects effects = new PacketManagerEffects();
@ -137,7 +136,6 @@ public class PacketHandler implements IPacketHandler, IPacketReceiver
return new Vector3(data.readDouble(), data.readDouble(), data.readDouble()); return new Vector3(data.readDouble(), data.readDouble(), data.readDouble());
} }
@SuppressWarnings("resource") @SuppressWarnings("resource")
public Packet getPacketWithID(String channelName, int id, Object... sendData) public Packet getPacketWithID(String channelName, int id, Object... sendData)
{ {
@ -171,7 +169,7 @@ public class PacketHandler implements IPacketHandler, IPacketReceiver
} }
/** Gets a packet for the tile entity. /** Gets a packet for the tile entity.
* *
* @return */ * @return */
@SuppressWarnings("resource") @SuppressWarnings("resource")
public Packet getPacket(String channelName, TileEntity sender, Object... sendData) public Packet getPacket(String channelName, TileEntity sender, Object... sendData)
@ -307,7 +305,6 @@ public class PacketHandler implements IPacketHandler, IPacketReceiver
return data; return data;
} }
@Override @Override
public void onPacketData(INetworkManager network, Packet250CustomPayload packet, Player player) public void onPacketData(INetworkManager network, Packet250CustomPayload packet, Player player)
{ {
@ -321,7 +318,7 @@ public class PacketHandler implements IPacketHandler, IPacketReceiver
if (packetType != null) if (packetType != null)
{ {
packetType.handlePacket(network, packet, player, data); packetType.handlePacket(network, packet, player, data);
} }
else else
{ {

View file

@ -35,12 +35,14 @@ public class PacketManagerEffects implements IPacketManager
{ {
try try
{ {
System.out.println("Effect packet being handled");
World world = ((EntityPlayer) player).worldObj; World world = ((EntityPlayer) player).worldObj;
String effectName = data.readUTF(); String effectName = data.readUTF();
if (world != null) if (world != null)
{ {
if (effectName.equalsIgnoreCase("laser")) if (effectName.equalsIgnoreCase("laser"))
{ {
System.out.println("Received laser packet");
DarkMain.proxy.renderBeam(world, PacketHandler.readVector3(data), PacketHandler.readVector3(data), new Color(data.readInt(), data.readInt(), data.readInt()), data.readInt()); DarkMain.proxy.renderBeam(world, PacketHandler.readVector3(data), PacketHandler.readVector3(data), new Color(data.readInt(), data.readInt(), data.readInt()), data.readInt());
} }
} }
@ -55,8 +57,9 @@ public class PacketManagerEffects implements IPacketManager
public static void sendClientLaserEffect(World world, Vector3 position, Vector3 target, Color color, int age) public static void sendClientLaserEffect(World world, Vector3 position, Vector3 target, Color color, int age)
{ {
Packet packet = PacketHandler.instance().getPacketWithID(DarkMain.CHANNEL, packetID, position, target, color.getRed(), color.getBlue(), color.getGreen(), age); Packet packet = PacketHandler.instance().getPacketWithID(DarkMain.CHANNEL, packetID, "laser", position, target, color.getRed(), color.getBlue(), color.getGreen(), age);
PacketHandler.instance().sendPacketToClients(packet, world, position, position.distance(target)); PacketHandler.instance().sendPacketToClients(packet, world, position, position.distance(target));
System.out.println("Sent laser render packet to client");
} }
} }

View file

@ -99,7 +99,6 @@ public abstract class TileEntityMachine extends TileEntityUniversalElectrical im
this.running = this.canRun() && this.consumePower(this.WATTS_PER_TICK, true); this.running = this.canRun() && this.consumePower(this.WATTS_PER_TICK, true);
if (prevRun != this.running) if (prevRun != this.running)
{ {
System.out.println("\n\nPower update packet sent to client\n\n\n");
this.sendPowerUpdate(); this.sendPowerUpdate();
} }
} }
@ -117,7 +116,7 @@ public abstract class TileEntityMachine extends TileEntityUniversalElectrical im
System.out.println(" RedPower: " + this.worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord)); System.out.println(" RedPower: " + this.worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord));
System.out.println(" IsDisabled: " + this.isDisabled());//TODO i'm going to kick myself if this is it, yep disabled System.out.println(" IsDisabled: " + this.isDisabled());//TODO i'm going to kick myself if this is it, yep disabled
System.out.println(" HasPower: " + this.consumePower(WATTS_PER_TICK, false)); System.out.println(" HasPower: " + this.consumePower(WATTS_PER_TICK, false));
System.out.println(" IsRunning: " + this.running + " \n"); System.out.println(" IsRunning: " + this.running);
} }
/** Called to consume power from the internal storage */ /** Called to consume power from the internal storage */
@ -288,7 +287,6 @@ public abstract class TileEntityMachine extends TileEntityUniversalElectrical im
if (id.equalsIgnoreCase(TilePacketTypes.POWER.name)) if (id.equalsIgnoreCase(TilePacketTypes.POWER.name))
{ {
this.running = dis.readBoolean(); this.running = dis.readBoolean();
System.out.println("Received isRunning packet");
return true; return true;
} }
if (id.equalsIgnoreCase(TilePacketTypes.NBT.name)) if (id.equalsIgnoreCase(TilePacketTypes.NBT.name))

View file

@ -15,7 +15,7 @@ import com.google.common.io.ByteArrayDataInput;
import dark.core.network.PacketHandler; import dark.core.network.PacketHandler;
/** This is a multiblock to be used for blocks that are bigger than one block. /** This is a multiblock to be used for blocks that are bigger than one block.
* *
* @author Calclavia */ * @author Calclavia */
public class TileEntityMulti extends TileEntity implements IPacketReceiver public class TileEntityMulti extends TileEntity implements IPacketReceiver
{ {
@ -117,7 +117,7 @@ public class TileEntityMulti extends TileEntity implements IPacketReceiver
} }
/** Determines if this TileEntity requires update calls. /** Determines if this TileEntity requires update calls.
* *
* @return True if you want updateEntity() to be called, false if not */ * @return True if you want updateEntity() to be called, false if not */
@Override @Override
public boolean canUpdate() public boolean canUpdate()

View file

@ -6,12 +6,12 @@ import dark.core.interfaces.IBlockActivated;
/** Used by tiles that want to pretend to be living objects. Will require the use of this interface /** Used by tiles that want to pretend to be living objects. Will require the use of this interface
* as well spawning a EntityTileDamage entity as its location * as well spawning a EntityTileDamage entity as its location
* *
* @author DarkGuardsman */ * @author DarkGuardsman */
public interface IDamageableTile extends IBlockActivated public interface IDamageableTile extends IBlockActivated
{ {
/** Same as attackEntityFrom in Entity.class /** Same as attackEntityFrom in Entity.class
* *
* @param source - DamageSource/DamageType * @param source - DamageSource/DamageType
* @param ammount - amount of damage * @param ammount - amount of damage
* @return */ * @return */
@ -25,7 +25,7 @@ public interface IDamageableTile extends IBlockActivated
public float health(); public float health();
/** Sets the tiles heath /** Sets the tiles heath
* *
* @param health - amount hit points * @param health - amount hit points
* @param increase - increase instead of replace */ * @param increase - increase instead of replace */
public void setHealth(float health); public void setHealth(float health);

View file

@ -88,7 +88,7 @@ public class FluidHelper
public static FluidStack getStack(FluidStack stack, int amount) public static FluidStack getStack(FluidStack stack, int amount)
{ {
if (stack != null) if (stack != null && stack.getFluid() != null)
{ {
return new FluidStack(stack.getFluid().getID(), amount, stack.tag); return new FluidStack(stack.getFluid().getID(), amount, stack.tag);
} }

View file

@ -24,9 +24,9 @@ public class Pair<L, R>
@Override @Override
public int hashCode() public int hashCode()
{ {
if(left == null || right == null) if (left == null || right == null)
{ {
super.hashCode(); super.hashCode();
} }
return left.hashCode() ^ right.hashCode(); return left.hashCode() ^ right.hashCode();
} }

View file

@ -74,7 +74,7 @@ public abstract class ResourcePathFinder
} }
/** Searches for nodes attached to the given node /** Searches for nodes attached to the given node
* *
* @return True on success finding, false on failure. */ * @return True on success finding, false on failure. */
public boolean findNodes(Vector3 node) public boolean findNodes(Vector3 node)
{ {
@ -125,7 +125,7 @@ public abstract class ResourcePathFinder
} }
/** Finds a node in a give direction /** Finds a node in a give direction
* *
* Note: Calls findNode if the next code is valid */ * Note: Calls findNode if the next code is valid */
public boolean find(ForgeDirection direction, Vector3 origin) public boolean find(ForgeDirection direction, Vector3 origin)
{ {
@ -148,7 +148,7 @@ public abstract class ResourcePathFinder
/** Called when the pathfinder jumps to the next block. Use this to inject other processes into /** Called when the pathfinder jumps to the next block. Use this to inject other processes into
* the find method * the find method
* *
* @return true if you found results, or just want the calling method to return true */ * @return true if you found results, or just want the calling method to return true */
public boolean onFind() public boolean onFind()
{ {