This commit is contained in:
DarkGuardsman 2013-12-30 15:58:47 -05:00
parent 5418d6c015
commit a43c270a7d
9 changed files with 14 additions and 313 deletions

View file

@ -20,7 +20,7 @@ import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ClientRegistryProxy extends RegistryProxy
{
@Override
@ -38,13 +38,6 @@ public class ClientRegistryProxy extends RegistryProxy
}
}
@Override
public void regiserTileEntity(String name, Class<? extends TileEntity> clazz)
{
super.regiserTileEntity(name, clazz);
}
@Override
public void renderBeam(World world, Vector3 position, Vector3 target, Color color, int age)
{

View file

@ -22,7 +22,6 @@ import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
/** Handler to make registering all parts of a mod's objects that are loaded into the game by forge
*

View file

@ -1,68 +0,0 @@
package com.builtbroken.minecraft;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
public class IndustryTabs extends CreativeTabs
{
public ItemStack itemStack = new ItemStack(Item.ingotIron, 1, 0);
private static IndustryTabs tabAutomation;
private static IndustryTabs tabIndustrial;
private static IndustryTabs tabHydrualic;
private static IndustryTabs tabMining;
private static IndustryTabs tabWar;
public IndustryTabs(String label)
{
super(label);
}
@Override
public ItemStack getIconItemStack()
{
return this.itemStack;
}
public void setIconItemStack(ItemStack stack)
{
this.itemStack = stack;
}
public static IndustryTabs tabAutomation()
{
if (tabAutomation == null)
{
tabAutomation = new IndustryTabs("Automation");
}
return tabAutomation;
}
public static IndustryTabs tabWar()
{
if (tabWar == null)
{
tabWar = new IndustryTabs("War");
}
return tabWar;
}
public static IndustryTabs tabIndustrial()
{
if (tabIndustrial == null)
{
tabIndustrial = new IndustryTabs("Industrial");
}
return tabIndustrial;
}
public static IndustryTabs tabHydraulic()
{
if (tabHydrualic == null)
{
tabHydrualic = new IndustryTabs("Hydraulic");
}
return tabHydrualic;
}
}

View file

@ -21,7 +21,7 @@ import net.minecraftforge.event.Cancelable;
import net.minecraftforge.event.Event;
import universalelectricity.api.vector.Vector3;
import com.builtbroken.minecraft.helpers.DarksHelper;
import com.builtbroken.minecraft.helpers.HelperMethods;
/** An event triggered by entities or tiles that create lasers
*
@ -265,7 +265,7 @@ public class LaserEvent extends Event
items = event.items;
for (ItemStack stack : items)
{
DarksHelper.dropItemStack(world, vec.translate(0.5), stack, false);
HelperMethods.dropItemStack(world, vec.translate(0.5), stack, false);
}
}
}

View file

@ -1,79 +0,0 @@
package com.builtbroken.minecraft;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.Cancelable;
import net.minecraftforge.event.Event;
import universalelectricity.api.vector.Vector3;
public class MachineMiningEvent extends Event
{
public final World world;
public final Vector3 spot;
public final TileEntity machine;
public MachineMiningEvent(World world, Vector3 spot, TileEntity machine)
{
this.world = world;
this.spot = spot;
this.machine = machine;
}
@Cancelable
public static class PreMine extends MachineMiningEvent
{
public PreMine(World world, Vector3 spot, TileEntity machine)
{
super(world, spot, machine);
}
}
public static class MiningDrop extends MachineMiningEvent
{
List<ItemStack> items;
public MiningDrop(World world, Vector3 spot, TileEntity machine, List<ItemStack> items)
{
super(world, spot, machine);
this.items = items;
}
}
public static class PostMine extends MachineMiningEvent
{
public PostMine(World world, Vector3 spot, TileEntity machine)
{
super(world, spot, machine);
}
}
public static boolean doMachineMiningCheck(World world, Vector3 target, TileEntity machine)
{
Block block = Block.blocksList[target.getBlockID(world)];
return block != null && target.getTileEntity(world) == null && !block.isAirBlock(world, target.intX(), target.intY(), target.intZ()) && block.getBlockHardness(world, target.intX(), target.intY(), target.intZ()) >= 0;
}
public static List<ItemStack> getItemsMined(World world, Vector3 target, TileEntity machine)
{
Block block = Block.blocksList[target.getBlockID(world)];
if (block != null)
{
List<ItemStack> items = block.getBlockDropped(world, target.intX(), target.intY(), target.intZ(), target.getBlockMetadata(world), 1);
if (items != null)
{
MiningDrop event = new MiningDrop(world, target, machine, items);
MinecraftForge.EVENT_BUS.post(event);
items = event.items;
return items;
}
}
return null;
}
}

View file

@ -17,7 +17,7 @@ import universalelectricity.api.vector.Vector3;
/** Class full of generic re-usable methods
*
* @author DarkGuardsman */
public class DarksHelper
public class HelperMethods
{
/** Used to find all tileEntities sounding the location you will have to filter for selective
* tileEntities

View file

@ -4,7 +4,7 @@ import net.minecraft.block.Block;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
/** Simple itemBlock class for quick use with a block
/** Simple itemBlock class for quick use with a block for controlling metadata
*
* @author Darkguardsman */
public class ItemBlockHolder extends ItemBlock

View file

@ -1,24 +0,0 @@
package com.builtbroken.minecraft.tilenetwork;
import net.minecraft.entity.Entity;
import universalelectricity.api.vector.Vector3;
/** Use by tiles to control the path of motion of an item threw a tile network such as items pipes
*
* @author DarkGuardsman */
public interface IMotionPath
{
/** Gets the motion applied to the entity while its on the tile **/
public Vector3 getMotion(Entity entity);
/** Can the path controller move the entity over this tile. Make sure to check the position of
* 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 */
public boolean canMoveEntity(Entity entity);
}

View file

@ -1,120 +0,0 @@
package com.builtbroken.minecraft.tilenetwork.prefab;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import net.minecraft.entity.Entity;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.ForgeDirection;
import universalelectricity.api.vector.Vector3;
import com.builtbroken.common.Pair;
import com.builtbroken.minecraft.tilenetwork.IMotionPath;
import com.builtbroken.minecraft.tilenetwork.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 };
public NetworkItemSupply(INetworkPart... parts)
{
super(parts);
}
@Override
public void updateTick()
{
Iterator<Pair<Entity, Vector3>> it = trackingList.iterator();
while (it.hasNext())
{
Pair<Entity, Vector3> entry = it.next();
if (entry.left() == null || !this.isOnPath(entry.left()))
{
it.remove();
}
else
{
if (entry.right() == null)
{
entry.setRight(new Vector3(entry.left()));
}
else
{
entry.left().setPosition(entry.right().x, entry.right().y, entry.right().z);
}
}
}
}
@Override
public int getUpdateRate()
{
return 1;
}
/** Remove an entity from the tracking list */
public void removeEntity(Entity entity)
{
this.trackingList.remove(entity);
}
/** Ignores an entity so that is can be controlled by something else for a while. Eg armbots, and
* drones */
public void ignoreEntity(Entity entity)
{
if (!this.ignoreList.contains(entity))
{
this.ignoreList.add(entity);
}
}
/** Add and entity to the tracking list */
public void addEntity(Entity entity)
{
if (!this.trackingList.contains(entity))
{
this.trackingList.add(new Pair<Entity, Vector3>(entity, new Vector3(entity)));
}
}
public boolean isTrackingEntity(Entity entity)
{
return this.trackingList.contains(entity);
}
public boolean isOnPath(Entity entity)
{
if (entity != null)
{
Vector3 ent = new Vector3(entity);
//Check all directions including the current position of the entity
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))
{
return true;
}
}
}
return false;
}
@Override
public boolean isValidMember(INetworkPart part)
{
return super.isValidMember(part) && part instanceof IMotionPath;
}
}