Auto-Sync

This commit is contained in:
DarkGuardsman 2013-11-26 00:29:56 -05:00
parent a6c868e7da
commit c5c3488c21
46 changed files with 111 additions and 159 deletions

View file

@ -1,7 +1,7 @@
package com.builtbroken.common;
/** Container for two objects
*
*
* @author Robert Seifert */
public class Pair<L, R>
{

View file

@ -1,8 +1,6 @@
package dark.api;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import universalelectricity.core.vector.Vector3;
/** Applied to blocks that store items in stacks above 64
*

View file

@ -1,7 +1,5 @@
package dark.api.access;
import net.minecraft.entity.player.EntityPlayer;
/** Container of access groups that can be used by anything. Only the core machine should load/save
* global access collections to prevent conflicts.
*

View file

@ -31,7 +31,8 @@ public interface ISpecialAccess
/** Get all groups linked this */
public List<AccessGroup> getGroups();
/** Add a group to the group list
/** Add a group to the group list
*
* @return */
public boolean addGroup(AccessGroup group);

View file

@ -1,11 +1,11 @@
package dark.api.events;
import dark.core.helpers.AutoCraftingManager.IAutoCrafter;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.event.Cancelable;
import net.minecraftforge.event.Event;
import universalelectricity.core.vector.Vector3;
import dark.core.helpers.AutoCraftingManager.IAutoCrafter;
/** Events called when an automated crafter is working on crafting an item
*

View file

@ -3,9 +3,6 @@ package dark.api.events;
import java.util.ArrayList;
import java.util.List;
import dark.core.common.items.EnumTool;
import dark.core.helpers.ItemWorldHelper;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.entity.Entity;
@ -23,6 +20,8 @@ import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.Cancelable;
import net.minecraftforge.event.Event;
import universalelectricity.core.vector.Vector3;
import dark.core.common.items.EnumTool;
import dark.core.helpers.ItemWorldHelper;
/** An event triggered by entities or tiles that create lasers
*
@ -213,7 +212,7 @@ public class LaserEvent extends Event
if (block.blockID == Block.tnt.blockID)
{
world.setBlock(vec.intX(), vec.intY(), vec.intZ(), 0, 0, 3);
EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(world, (double) ((float) vec.intX() + 0.5F), (double) ((float) vec.intY() + 0.5F), (double) ((float) vec.intZ() + 0.5F), player instanceof EntityLivingBase ? ((EntityLivingBase) player) : null);
EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(world, (vec.intX() + 0.5F), (vec.intY() + 0.5F), (vec.intZ() + 0.5F), player instanceof EntityLivingBase ? ((EntityLivingBase) player) : null);
entitytntprimed.fuse = world.rand.nextInt(entitytntprimed.fuse / 4) + entitytntprimed.fuse / 8;
world.spawnEntityInWorld(entitytntprimed);
return;

View file

@ -10,7 +10,6 @@ import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.Cancelable;
import net.minecraftforge.event.Event;
import universalelectricity.core.vector.Vector3;
import dark.core.prefab.machine.TileEntityMachine;
public class MachineMiningEvent extends Event
{

View file

@ -1,8 +1,7 @@
package dark.api.parts;
import universalelectricity.core.vector.Vector3;
import net.minecraft.entity.Entity;
import net.minecraftforge.common.ForgeDirection;
import universalelectricity.core.vector.Vector3;
public interface IMotionPath
{
@ -14,7 +13,7 @@ public interface IMotionPath
* the tile as the controller doesn't know the range of control of the tile. Though it does
* limit itself to blocks around the entity. So if your tile only effects entities above it
* within its bound then make sure the tile is inside those bounds
*
*
* @param entity - entity in question
* @param from - direction the entity came from
* @return true if it can, false if something is wrong like no power, or solid side */

View file

@ -5,7 +5,7 @@ import java.util.Set;
import net.minecraft.tileentity.TileEntity;
/** Applied to network entities that don't exist in the world but manage its tiles
*
*
* @author DarkGuardsman */
public interface ITileNetwork
{
@ -16,7 +16,7 @@ public interface ITileNetwork
public Set<INetworkPart> getMembers();
/** Called when something want the network to add the tile
*
*
* @param entity - tile in question
* @param member - add it as a member if true
* @return true if added without issue */

View file

@ -5,7 +5,7 @@ import net.minecraft.item.ItemStack;
/** Simple interface that allows an item to control how its salvaged, processed, or refined by a
* processor. This is 100% optional as the processor by default can break down most items. The only
* reason to use this is for more complex processing or were the item was created with NBT.
*
*
* @author Darkgaurdsman */
public interface IProcessable
{
@ -13,7 +13,7 @@ public interface IProcessable
public boolean canProcess(ProcessorType type, ItemStack stack);
/** Gets the output array of items when this item is processed by a processor machine
*
*
* @param type - type of machine see ProcessorTypes enum for info
* @param stack - ItemStack of this item or block
* @return Array of all item outputed, Make sure to return less than or equal to the amount of

View file

@ -1,20 +1,21 @@
package dark.core.client.gui;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import cpw.mods.fml.client.FMLClientHandler;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
import dark.core.common.DarkMain;
import dark.core.prefab.invgui.GuiBase;
import dark.core.prefab.invgui.GuiButtonImage;
import dark.core.prefab.machine.TileEntityMachine;
/** To be used with all machine that have a gui to allow generic settings and feature all all devices
*
*
* @author DarkGuardsman */
public class GuiMachineBase extends GuiBase
{

View file

@ -10,9 +10,6 @@ import net.minecraft.inventory.Container;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import universalelectricity.core.vector.Vector2;
import universalelectricity.core.vector.Vector3;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@ -31,7 +28,7 @@ public abstract class GuiMachineContainer extends GuiContainer
public GuiMachineContainer(Object mod, Container container, InventoryPlayer inventoryPlayer, TileEntityMachine tileEntity)
{
super(container);
super(container);
this.tileEntity = tileEntity;
this.entityPlayer = inventoryPlayer.player;
this.ySize = 380 / 2;

View file

@ -161,6 +161,7 @@ public class ModelTestCar extends ModelBase
setRotation(backLeftWheel, 0F, 0F, 0F);
}
@Override
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)
{
super.render(entity, f, f1, f2, f3, f4, f5);

View file

@ -37,7 +37,7 @@ public class RenderTestCar extends Render
GL11.glRotatef(180.0F - rYaw, 0.0F, 1.0F, 0.0F);
if (entity instanceof EntityAdvanced)
{
float f2 = (float) ((EntityAdvanced) entity).getTimeSinceHit() - rPitch;
float f2 = ((EntityAdvanced) entity).getTimeSinceHit() - rPitch;
float f3 = ((EntityAdvanced) entity).getHealth() - rPitch;
if (f3 < 0.0F)
@ -47,7 +47,7 @@ public class RenderTestCar extends Render
if (f2 > 0.0F)
{
GL11.glRotatef(MathHelper.sin(f2) * f2 * f3 / 10.0F * (float) ((EntityAdvanced) entity).getForwardDirection(), 1.0F, 0.0F, 0.0F);
GL11.glRotatef(MathHelper.sin(f2) * f2 * f3 / 10.0F * ((EntityAdvanced) entity).getForwardDirection(), 1.0F, 0.0F, 0.0F);
}
}

View file

@ -2,16 +2,10 @@ package dark.core.common;
import java.util.EnumSet;
import net.minecraft.block.material.Material;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.potion.Potion;
import net.minecraft.util.DamageSource;
import net.minecraft.world.World;
import net.minecraft.world.WorldProvider;
import net.minecraft.world.WorldServer;
import net.minecraftforge.common.DimensionManager;
import cpw.mods.fml.common.ITickHandler;

View file

@ -3,18 +3,12 @@ package dark.core.common;
import java.util.EnumSet;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityClientPlayerMP;
import net.minecraft.client.settings.GameSettings;
import net.minecraft.client.settings.KeyBinding;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
import cpw.mods.fml.client.registry.KeyBindingRegistry.KeyHandler;
import cpw.mods.fml.common.IScheduledTickHandler;
import cpw.mods.fml.common.ITickHandler;
import cpw.mods.fml.common.TickType;
import dark.core.network.PacketManagerKeyEvent;

View file

@ -4,13 +4,6 @@ import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
import net.minecraftforge.oredict.ShapedOreRecipe;
import com.builtbroken.common.Pair;
import com.builtbroken.common.Triple;
import cpw.mods.fml.common.registry.GameRegistry;
import dark.core.helpers.AutoCraftingManager;
/** Recipe system to make it easier to load recipes for a mod
*
@ -95,5 +88,5 @@ public abstract class RecipeLoader
return itemStack;
}
return stack;
}
}
}

View file

@ -137,6 +137,7 @@ public class BlockGasOre extends Block implements IGasBlock
return null;
}
@Override
public boolean isCollidable()
{
return false;

View file

@ -1,21 +1,15 @@
package dark.core.common.blocks;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.ChunkProviderEnd;
import net.minecraft.world.gen.ChunkProviderGenerate;
import net.minecraft.world.gen.ChunkProviderHell;
import net.minecraftforge.fluids.FluidStack;
import universalelectricity.prefab.ore.OreGenBase;
import cpw.mods.fml.common.IWorldGenerator;
import cpw.mods.fml.common.registry.GameRegistry;
import dark.core.common.CoreRecipeLoader;
public class GasOreGenerator implements IWorldGenerator

View file

@ -12,8 +12,8 @@ import cpw.mods.fml.relauncher.SideOnly;
import dark.core.common.CoreRecipeLoader;
/** Class for storing materials, there icon names, sub items to be made from them or there sub ores
*
*
*
*
* @author DarkGuardsman */
public enum EnumMaterial
{
@ -75,7 +75,7 @@ public enum EnumMaterial
/** Creates a new item stack using material and part given. Uses a preset length of 50 for parts
* enum so to prevent any unwanted changes in loading of itemStacks metadata.
*
*
* @param mat - material
* @param part - part
* @return new ItemStack created from the two enums as long as everything goes right */

View file

@ -1,11 +1,12 @@
package dark.core.common.items;
import net.minecraft.item.Item;
import net.minecraft.util.Icon;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import dark.core.common.DMCreativeTab;
import dark.core.common.DarkMain;
import net.minecraft.item.Item;
import net.minecraft.util.Icon;
import dark.core.prefab.ModPrefab;
/** Small fluid can that is designed to store up to one bucket of fluid.
*
@ -19,7 +20,7 @@ public class ItemFluidCan extends Item
public ItemFluidCan()
{
super(DarkMain.CONFIGURATION.getItem("FluidCan", DarkMain.getNextItemId()).getInt());
super(DarkMain.CONFIGURATION.getItem("FluidCan", ModPrefab.getNextItemId()).getInt());
this.setCreativeTab(DMCreativeTab.tabIndustrial);
}
}

View file

@ -19,7 +19,7 @@ import dark.core.prefab.ItemBasic;
import dark.core.prefab.ModPrefab;
/** A series of items that are derived from a basic material
*
*
* @author DarkGuardsman */
public class ItemOreDirv extends ItemBasic implements IExtraItemInfo
{

View file

@ -1,6 +1,6 @@
package dark.core.common.items;
/** Can that is used to store items such as food, parts, or solid fuels.
/** Can that is used to store items such as food, parts, or solid fuels.
*
* @author DarkGuardsman */
public class ItemStorageCan

View file

@ -14,11 +14,10 @@ import net.minecraftforge.common.ForgeDirection;
import universalelectricity.core.vector.Vector3;
import dark.api.IExtendedStorage;
import dark.core.prefab.machine.TileEntityMulti;
/**
* Helper that handles most of the interaction of the tile with the inventories around it
* @author Rseifert
*
*/
/** Helper that handles most of the interaction of the tile with the inventories around it
*
* @author Rseifert */
public class InvInteractionHelper
{
public World world;
@ -45,7 +44,7 @@ public class InvInteractionHelper
}
/** Throws the items from the manipulator into the world.
*
*
* @param outputPosition
* @param items */
public void throwItem(Vector3 outputPosition, ItemStack items)
@ -76,7 +75,7 @@ public class InvInteractionHelper
}
/** Tries to place an itemStack in a specific position if it is an inventory.
*
*
* @return The ItemStack remained after place attempt */
public ItemStack tryPlaceInPosition(ItemStack itemStack, Vector3 position, ForgeDirection dir)
{
@ -213,7 +212,7 @@ public class InvInteractionHelper
}
/** Tries to get an item from a position
*
*
* @param position - location of item
* @param direction - direction this item is from the original
* @param ammount - amount up to one stack to grab

View file

@ -29,7 +29,7 @@ public class ItemWorldHelper
}
/** Gets all EntityItems in an area and sorts them by a list of itemStacks
*
*
* @param world - world being worked in
* @param start - start point
* @param end - end point
@ -76,7 +76,7 @@ public class ItemWorldHelper
}
/** filter a list of itemStack to another list of itemStacks
*
*
* @param totalItems - full list of items being filtered
* @param desiredItems - list the of item that are being filtered too
* @return a list of item from the original that are wanted */
@ -99,7 +99,7 @@ public class ItemWorldHelper
}
/** grabs all the items that the block can drop then pass them onto dropBlockAsItem_do
*
*
* @param world
* @param x
* @param y

View file

@ -128,8 +128,8 @@ public class MathHelper extends net.minecraft.util.MathHelper
public static double updateRotation(double from, double to, double speed)
{
from = MathHelper.wrapAngleTo180_double(from);
to = MathHelper.wrapAngleTo180_double(to);
from = net.minecraft.util.MathHelper.wrapAngleTo180_double(from);
to = net.minecraft.util.MathHelper.wrapAngleTo180_double(to);
double delta = Math.abs(from - to);
if (delta > 0.001f)
{
@ -152,8 +152,8 @@ public class MathHelper extends net.minecraft.util.MathHelper
public static double updateRotation(float from, float to, float speed)
{
from = MathHelper.wrapAngleTo180_float(from);
to = MathHelper.wrapAngleTo180_float(to);
from = net.minecraft.util.MathHelper.wrapAngleTo180_float(from);
to = net.minecraft.util.MathHelper.wrapAngleTo180_float(to);
double delta = Math.abs(from - to);
if (delta > 0.001f)
{

View file

@ -2,15 +2,13 @@ package dark.core.helpers;
import java.util.List;
import universalelectricity.core.vector.Quaternion;
import universalelectricity.core.vector.Vector3;
import net.minecraft.entity.Entity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import universalelectricity.core.vector.Vector3;
public class RayTraceHelper
{
@ -75,7 +73,7 @@ public class RayTraceHelper
@SuppressWarnings("unchecked")
public static MovingObjectPosition raytraceEntities(World world, Vec3 start, Vec3 end, double range, boolean collisionFlag, Entity exclude)
{
AxisAlignedBB boxToScan = AxisAlignedBB.getBoundingBox(start.xCoord, start.yCoord, start.zCoord, end.xCoord, end.yCoord, end.zCoord);
AxisAlignedBB boxToScan = AxisAlignedBB.getBoundingBox(start.xCoord, start.yCoord, start.zCoord, end.xCoord, end.yCoord, end.zCoord);
List<Entity> entitiesHit = null;
if (exclude != null)
{
@ -93,9 +91,9 @@ public class RayTraceHelper
return null;
}
for (Entity entityHit : entitiesHit)
{
{
if (entityHit != null && entityHit.canBeCollidedWith() && entityHit.boundingBox != null)
{
{
float border = entityHit.getCollisionBorderSize();
AxisAlignedBB aabb = entityHit.boundingBox.expand(border, border, border);
MovingObjectPosition hitMOP = aabb.calculateIntercept(start, end);

View file

@ -45,7 +45,7 @@ public class LaserEntityDamageSource extends EntityDamageSource
{
if (((EntityPlayer) event.entity).inventory.armorItemInSlot(3) == new ItemStack(Item.plateDiamond, 1))
{
if(event.isCancelable())
if (event.isCancelable())
{
event.setCanceled(true);
}

View file

@ -1,9 +1,5 @@
package dark.core.prefab.entities;
import universalelectricity.core.block.IElectrical;
import universalelectricity.core.block.IElectricalStorage;
import universalelectricity.core.electricity.ElectricityPack;
import dark.api.IDrone;
import net.minecraft.entity.EntityCreature;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.attributes.Attribute;
@ -11,11 +7,15 @@ import net.minecraft.entity.ai.attributes.RangedAttribute;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection;
import universalelectricity.core.block.IElectrical;
import universalelectricity.core.block.IElectricalStorage;
import universalelectricity.core.electricity.ElectricityPack;
import dark.api.IDrone;
public class EntityDroneBase extends EntityCreature implements IDrone, IElectrical, IElectricalStorage
{
private float energyStored = 0.0f;
public static final Attribute maxEnergy = (new RangedAttribute("drone.maxEnergy", 100.0D, 0.0D, Double.MAX_VALUE)).func_111117_a("Max Energy").setShouldWatch(true);
public EntityDroneBase(World par1World)
@ -24,6 +24,7 @@ public class EntityDroneBase extends EntityCreature implements IDrone, IElectric
this.getNavigator().setAvoidsWater(true);
}
@Override
protected void applyEntityAttributes()
{
super.applyEntityAttributes();
@ -54,8 +55,7 @@ public class EntityDroneBase extends EntityCreature implements IDrone, IElectric
{
return false;
}
public boolean consumePower(float watts, boolean doDrain)
{
if (this.getEnergyStored() >= watts)
@ -79,7 +79,7 @@ public class EntityDroneBase extends EntityCreature implements IDrone, IElectric
public void setEnergyStored(float energy)
{
this.energyStored = energy;
}
@Override
@ -103,7 +103,7 @@ public class EntityDroneBase extends EntityCreature implements IDrone, IElectric
}
return 0;
}
/** A non-side specific version of receiveElectricity for you to optionally use it internally. */
public float receiveElectricity(ElectricityPack receive, boolean doReceive)
{
@ -127,7 +127,6 @@ public class EntityDroneBase extends EntityCreature implements IDrone, IElectric
return this.receiveElectricity(ElectricityPack.getFromWatts(energy, this.getVoltage()), doReceive);
}
@Override
public ElectricityPack provideElectricity(ForgeDirection from, ElectricityPack request, boolean doProvide)
{
@ -151,8 +150,7 @@ public class EntityDroneBase extends EntityCreature implements IDrone, IElectric
{
return 30;
}
@Override
public void readFromNBT(NBTTagCompound nbt)
{

View file

@ -2,13 +2,13 @@ package dark.core.prefab.invgui;
import java.awt.Color;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import universalelectricity.core.vector.Vector2;
import dark.core.common.DarkMain;

View file

@ -30,7 +30,7 @@ import dark.core.registration.ModObjectRegistry.BlockBuildData;
/** Basic TileEntity Container class designed to be used by generic machines. It is suggested that
* each mod using this create there own basic block extending this to reduce need to use build data
* per block.
*
*
* @author Darkguardsman */
public abstract class BlockMachine extends BlockTile implements IExtraBlockInfo
{

View file

@ -1,10 +1,5 @@
package dark.core.prefab.machine;
import ic2.api.energy.event.EnergyTileLoadEvent;
import ic2.api.energy.event.EnergyTileUnloadEvent;
import ic2.api.energy.tile.IEnergySink;
import ic2.api.energy.tile.IEnergySource;
import ic2.api.energy.tile.IEnergyTile;
import ic2.api.item.IElectricItemManager;
import ic2.api.item.ISpecialElectricItem;
@ -14,9 +9,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.oredict.OreDictionary;
import thermalexpansion.api.item.IChargeableItem;
import universalelectricity.compatibility.Compatibility;
@ -29,9 +22,7 @@ import universalelectricity.core.item.ElectricItemHelper;
import universalelectricity.core.item.IItemElectric;
import universalelectricity.core.vector.Vector3;
import universalelectricity.core.vector.VectorHelper;
import buildcraft.api.power.IPowerReceptor;
import buildcraft.api.power.PowerHandler;
import buildcraft.api.power.PowerHandler.PowerReceiver;
import buildcraft.api.power.PowerHandler.Type;
import dark.api.energy.IPowerLess;
import dark.core.common.ExternalModHandler;

View file

@ -2,6 +2,7 @@ package dark.core.prefab.machine;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.ISidedInventory;

View file

@ -4,8 +4,8 @@ import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import dark.core.prefab.ItemBlockHolder;
/** Item block that is the unplaced sentry gun. All sentry gun data is held by NBT to allow the sentry
* gun to exist without metadata limits.
/** Item block that is the unplaced sentry gun. All sentry gun data is held by NBT to allow the
* sentry gun to exist without metadata limits.
*
* @author DarkGuardsman */
public class ItemBlockSentry extends ItemBlockHolder

View file

@ -1,6 +1,5 @@
package dark.core.prefab.sentry;
public class TileEntityAutoSentry extends TileEntitySentry
{
public TileEntityAutoSentry(float maxDamage)

View file

@ -1,6 +1,5 @@
package dark.core.prefab.sentry;
public class TileEntityMountedSentry extends TileEntitySentry
{
public TileEntityMountedSentry(float maxDamage)

View file

@ -1,12 +1,7 @@
package dark.core.prefab.sentry;
import java.io.IOException;
import java.util.List;
import com.google.common.io.ByteArrayDataInput;
import cpw.mods.fml.common.network.Player;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.packet.Packet;
@ -16,6 +11,10 @@ import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.DamageSource;
import net.minecraftforge.common.ForgeDirection;
import universalelectricity.core.vector.Vector3;
import com.google.common.io.ByteArrayDataInput;
import cpw.mods.fml.common.network.Player;
import dark.api.ISentryGun;
import dark.core.common.DarkMain;
import dark.core.helpers.MathHelper;
@ -23,7 +22,6 @@ import dark.core.helpers.RayTraceHelper;
import dark.core.network.PacketHandler;
import dark.core.prefab.EntityTileDamage;
import dark.core.prefab.machine.TileEntityMachine;
import dark.core.prefab.machine.TileEntityMachine.SimplePacketTypes;
/** Prefab tileEntity for creating senty guns that can be of type aimed, mounted, or automated.
* Contains most of the code for a sentry gun to operate short of aiming and operating logic. This
@ -299,7 +297,7 @@ public abstract class TileEntitySentry extends TileEntityMachine implements ISen
{
return PacketHandler.instance().getTilePacket(DarkMain.CHANNEL, this, "Desc", this.isRunning, this.rotation);
}
@Override
public boolean simplePacket(String id, ByteArrayDataInput dis, Player player)
{

View file

@ -105,7 +105,7 @@ public class TerminalCommandRegistry
List<AccessGroup> groups = getNewGroupSet();
for (AccessGroup group : groups)
{
terminal.addGroup(group);
terminal.addGroup(group);
}
}
}

View file

@ -16,14 +16,15 @@ import dark.api.parts.INetworkPart;
/** Class that acts like the redpower pipes system. Each item is marked with a destination. Intended
* use it to improve the assembly line network
*
*
* @author DarkGuardsman */
public class NetworkItemSupply extends NetworkTileEntities
{
List<Pair<Entity, Vector3>> trackingList = new ArrayList<Pair<Entity, Vector3>>();
List<Entity> ignoreList = new ArrayList<Entity>();
/** Same as valid directions from forge direction enum but Unknown was added so that is gets check and checked first */
public static final ForgeDirection[] VALID_DIRECTIONS = {ForgeDirection.UNKNOWN, ForgeDirection.DOWN, ForgeDirection.UP, ForgeDirection.NORTH, ForgeDirection.SOUTH, ForgeDirection.WEST, ForgeDirection.EAST};
/** Same as valid directions from forge direction enum but Unknown was added so that is gets
* check and checked first */
public static final ForgeDirection[] VALID_DIRECTIONS = { ForgeDirection.UNKNOWN, ForgeDirection.DOWN, ForgeDirection.UP, ForgeDirection.NORTH, ForgeDirection.SOUTH, ForgeDirection.WEST, ForgeDirection.EAST };
public NetworkItemSupply(INetworkPart... parts)
{
@ -98,7 +99,7 @@ public class NetworkItemSupply extends NetworkTileEntities
{
Vector3 ent = new Vector3(entity);
//Check all directions including the current position of the entity
for (ForgeDirection direction : this.VALID_DIRECTIONS)
for (ForgeDirection direction : NetworkItemSupply.VALID_DIRECTIONS)
{
TileEntity a = ent.clone().modifyPositionFromSide(direction).getTileEntity(entity.worldObj);
if (a instanceof IMotionPath && ((IMotionPath) a).canMoveEntity(entity) && this.networkMembers.contains(a))

View file

@ -8,7 +8,7 @@ import net.minecraftforge.common.ForgeDirection;
import dark.api.parts.INetworkPart;
/** Network that supplies resources to tiles that demand a set resource
*
*
* @param C - Storage class used to handle what the network transports
* @param I - Base acceptor class
* @author DarkGuardsman */

View file

@ -47,7 +47,7 @@ public class NetworkTileEntities implements ITileNetwork
@Override
public Set<INetworkPart> getMembers()
{
if(this.networkMembers == null)
if (this.networkMembers == null)
{
this.networkMembers = new HashSet<INetworkPart>();
}
@ -160,17 +160,17 @@ public class NetworkTileEntities implements ITileNetwork
/** Processing that needs too be done before the network merges. Use this to do final network
* merge calculations and to cause network merge failure
*
*
* @param network the network that is to merge with this one
* @param part the part at which started the network merge. Use this to cause damage if two
* networks merge with real world style failures
*
*
* @return false if the merge needs to be canceled.
*
*
* Cases in which the network should fail to merge are were the two networks merge with error.
* Or, in the case of pipes the two networks merge and the merge point was destroyed by
* combination of liquids.
*
*
* Ex Lava and water */
public boolean preMergeProcessing(ITileNetwork network, INetworkPart part)
{

View file

@ -6,13 +6,12 @@ import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import cpw.mods.fml.common.IScheduledTickHandler;
import cpw.mods.fml.common.ITickHandler;
import cpw.mods.fml.common.TickType;
import dark.api.parts.ITileNetwork;
/** Manages all the tile networks making sure they get world save events, and updates every so often
*
*
* @author DarkGuardsman */
public class NetworkUpdateHandler implements ITickHandler
{
@ -102,7 +101,7 @@ public class NetworkUpdateHandler implements ITickHandler
@Override
public void tickStart(EnumSet<TickType> type, Object... tickData)
{
if (count + 1 >= this.refreshTicks)
if (count + 1 >= NetworkUpdateHandler.refreshTicks)
{
count = 0;
for (ITileNetwork network : allNetworks)

View file

@ -1,14 +1,14 @@
package dark.core.prefab.vehicles;
import dark.core.common.CoreRecipeLoader;
import net.minecraft.world.World;
import dark.core.common.CoreRecipeLoader;
public class EntityTestCar extends EntityVehicle
{
public EntityTestCar(World world)
{
super(world);
super(world);
}
public EntityTestCar(World world, float xx, float yy, float zz)

View file

@ -2,9 +2,6 @@ package dark.core.prefab.vehicles;
import java.util.List;
import com.google.common.io.ByteArrayDataInput;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.Entity;
@ -15,6 +12,8 @@ import net.minecraft.util.ChatMessageComponent;
import net.minecraft.util.DamageSource;
import net.minecraft.world.World;
import com.google.common.io.ByteArrayDataInput;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.common.network.Player;
import dark.core.helpers.MathHelper;
@ -118,11 +117,11 @@ public abstract class EntityVehicle extends EntityAdvanced implements IControlRe
if (this.worldObj.isRemote)
{
((EntityPlayer)this.riddenByEntity).sendChatToPlayer(ChatMessageComponent.createFromText("Client:RotationYaw: "+this.rotationYaw));
((EntityPlayer) this.riddenByEntity).sendChatToPlayer(ChatMessageComponent.createFromText("Client:RotationYaw: " + this.rotationYaw));
}
else
{
((EntityPlayer)this.riddenByEntity).sendChatToPlayer(ChatMessageComponent.createFromText("Server:RotationYaw: "+this.rotationYaw));
((EntityPlayer) this.riddenByEntity).sendChatToPlayer(ChatMessageComponent.createFromText("Server:RotationYaw: " + this.rotationYaw));
}
}
if (this.worldObj.isRemote)
@ -137,12 +136,12 @@ public abstract class EntityVehicle extends EntityAdvanced implements IControlRe
double z;
if (this.boatPosRotationIncrements > 0)
{
x = this.posX + (this.boatX - this.posX) / (double) this.boatPosRotationIncrements;
y = this.posY + (this.boatY - this.posY) / (double) this.boatPosRotationIncrements;
z = this.posZ + (this.boatZ - this.posZ) / (double) this.boatPosRotationIncrements;
x = this.posX + (this.boatX - this.posX) / this.boatPosRotationIncrements;
y = this.posY + (this.boatY - this.posY) / this.boatPosRotationIncrements;
z = this.posZ + (this.boatZ - this.posZ) / this.boatPosRotationIncrements;
this.rotationYaw = (float) ((double) this.rotationYaw + MathHelper.wrapAngleTo180_double(this.boatYaw - (double) this.rotationYaw) / (double) this.boatPosRotationIncrements);
this.rotationPitch = (float) ((double) this.rotationPitch + (this.boatPitch - (double) this.rotationPitch) / (double) this.boatPosRotationIncrements);
this.rotationYaw = (float) (this.rotationYaw + net.minecraft.util.MathHelper.wrapAngleTo180_double(this.boatYaw - this.rotationYaw) / this.boatPosRotationIncrements);
this.rotationPitch = (float) (this.rotationPitch + (this.boatPitch - this.rotationPitch) / this.boatPosRotationIncrements);
--this.boatPosRotationIncrements;
this.setPosition(x, y, z);
this.setRotation(this.rotationYaw, this.rotationPitch);
@ -172,8 +171,8 @@ public abstract class EntityVehicle extends EntityAdvanced implements IControlRe
if (this.speed != 0.0D)
{
this.motionX = -Math.sin((double) (this.rotationYaw * (float) Math.PI / 180.0F)) * this.speed;
this.motionZ = Math.cos((double) (this.rotationYaw * (float) Math.PI / 180.0F)) * this.speed;
this.motionX = -Math.sin((this.rotationYaw * (float) Math.PI / 180.0F)) * this.speed;
this.motionZ = Math.cos((this.rotationYaw * (float) Math.PI / 180.0F)) * this.speed;
}
currentVel = Math.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ);
@ -281,12 +280,12 @@ public abstract class EntityVehicle extends EntityAdvanced implements IControlRe
for (l = 0; l < 4; ++l)
{
int i1 = MathHelper.floor_double(this.posX + ((double) (l % 2) - 0.5D) * 0.8D);
int j1 = MathHelper.floor_double(this.posZ + ((double) (l / 2) - 0.5D) * 0.8D);
int i1 = net.minecraft.util.MathHelper.floor_double(this.posX + ((l % 2) - 0.5D) * 0.8D);
int j1 = net.minecraft.util.MathHelper.floor_double(this.posZ + ((l / 2) - 0.5D) * 0.8D);
for (int k1 = 0; k1 < 2; ++k1)
{
int l1 = MathHelper.floor_double(this.posY) + k1;
int l1 = net.minecraft.util.MathHelper.floor_double(this.posY) + k1;
int i2 = this.worldObj.getBlockId(i1, l1, j1);
if (i2 == Block.snow.blockID)
@ -303,7 +302,7 @@ public abstract class EntityVehicle extends EntityAdvanced implements IControlRe
}
/** Increases the speed by a determined amount per tick the player holds the forward key down
*
*
* @param forward */
public void accelerate(boolean forward)
{

View file

@ -15,6 +15,7 @@ import net.minecraft.world.World;
import dark.core.common.DMCreativeTab;
import dark.core.common.DarkMain;
import dark.core.helpers.MathHelper;
import dark.core.prefab.ModPrefab;
/** Basic item used to spawn a vehicle
*
@ -23,7 +24,7 @@ public class ItemVehicleSpawn extends Item
{
public ItemVehicleSpawn()
{
super(DarkMain.getNextItemId());
super(ModPrefab.getNextItemId());
this.setUnlocalizedName("Vehicle");
this.setCreativeTab(DMCreativeTab.tabIndustrial);
}
@ -44,9 +45,9 @@ public class ItemVehicleSpawn extends Item
//Find the vector X blocks away from the player in the same direction as the player is looking
double searchRange = 5.0D;
float deltaX = MathHelper.sin(-playerYaw * 0.017453292F - (float) Math.PI) * -MathHelper.cos(-playerPitch * 0.017453292F);
float deltaY = MathHelper.sin(-playerPitch * 0.017453292F);
float deltaZ = MathHelper.cos(-playerYaw * 0.017453292F - (float) Math.PI) * -MathHelper.cos(-playerPitch * 0.017453292F);
float deltaX = net.minecraft.util.MathHelper.sin(-playerYaw * 0.017453292F - (float) Math.PI) * -net.minecraft.util.MathHelper.cos(-playerPitch * 0.017453292F);
float deltaY = net.minecraft.util.MathHelper.sin(-playerPitch * 0.017453292F);
float deltaZ = net.minecraft.util.MathHelper.cos(-playerYaw * 0.017453292F - (float) Math.PI) * -net.minecraft.util.MathHelper.cos(-playerPitch * 0.017453292F);
Vec3 end = start.addVector(deltaX * searchRange, deltaY * searchRange, deltaZ * searchRange);

View file

@ -22,7 +22,6 @@ import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.registry.GameRegistry;
import dark.core.common.DarkMain;
import dark.core.common.blocks.BlockGasOre;
import dark.core.interfaces.IExtraInfo;
import dark.core.interfaces.IExtraInfo.IExtraBlockInfo;
import dark.core.interfaces.IExtraInfo.IExtraItemInfo;