Merged in Mining mod classes, without using git tree method

This commit is contained in:
DarkGuardsman 2014-01-06 00:24:14 -05:00
parent c19ca9da74
commit 242c91e8f5
69 changed files with 2385 additions and 42 deletions

View file

View file

@ -0,0 +1 @@
Used to break holes in bedrock to access areas bellow including the mining dim. When combined with other machines in can be used as a way to automaticly mine large sums of ore.

View file

@ -0,0 +1,7 @@
So, it will have a few stages.
1) It destroys all blocks underneath it. (.5KJ per destroy)
2) It deploys the pipe (.5KJ per deploy)
3) It uses up water and sand (2KJ per use)
4) It collects gas (4KJ per collection)

View file

@ -0,0 +1 @@
Gas powered version of the furnace that is used to cook items with. Should either be a block on its own or support the heating system currently in progress that heats up other blocks.

View file

@ -0,0 +1,7 @@
Both a compact version and a extended version
Gas being gases like butan, and methain not gasoel as that will be used in fluid mechanics
Compact version will be self comtained including a 6 bucket tank to store gas in. It will generate direct AC power to the UE network
Extend version will generate rotational force using the gas. This force will be applied to a mechanical rod from the core and used to generate power when conencted to a motor.

View file

@ -0,0 +1,4 @@
2 Tracked vehicle that can support several options for mining. Including a drill, laser, claw, and hammer. Each tool will have its advantages and down sides.
The render for the vehicle should be very generic allowing for additional tools to be added without issues. The player should site on the left side of the vehicle with the tool extending down the right side. The model should include a cab to protect the player from damage. Including prevent mobs from attack the player while inside. The cab and tools should be able to rotate while on top of the tracks and act like a tank.

View file

@ -0,0 +1,20 @@
Basic device to scan an area to give a rough idea of the mineral value in the area.
Functionality
Scan for ores and output a data table of elements found. Useful for planning large scale mining sites. In which a smart player will look for a good site before laying down the gear.
Mod compatibility
Use ore directory to pin down a rough idea what is going on. Though some mods will need direct support to work beyond the normal ores. Any unkown blocks will be lumped in with stone.
Display out
Minerals will be displayed in the main mode of percent total. This will make the user work a bit to understand what is going on but they will get a very large idea of what is here to mine. Though there will be display config option to sort out what is there. Along with advanced scanning to get per blockID and ammount output.
Ex.
75% Rock/Soil/Other
11% Cu
9% Fe
5% Silicon
End product
I'm thinking about making a underground mapping system to go with this. Though it will become its own set of sub blocks that link with the scanner. This can be used for both mining, treasure hunting, and base protection. As well a very cool thing to look at since it will 3D render above the block.

View file

@ -0,0 +1 @@
When the Crane is finished for Assembly line an addon should be created for it to mine as well. Addons should include a laser drill, and core drill. They should act very similiar to quarry from buildcraft but will need more setup by the player to function. However, for the extra setup the crane will mine much faster including up to 4 blocks at a time.

View file

@ -0,0 +1,3 @@
I'm looking to add vechicals too all the mods in the near future. For the mining mod we need to add a small work truck(not a pickup) that the player will have a double chest to store items with and can drive around. On the outside it should have slots for tools, and a solar panel upgrade option to charge the tools. It should be very fast and very useful. A battery and fuel version should be offered.
Render should be simple though the player should not render normally. Instead the vehicel should de-render the player and render the player seated correctly. This way we don't have to worry about the player's body parts moving around or sticking out of the model. As well the texture for the model should be a faded constrution orange. The vehicle should only have one seat for the player and a single head light. Doors should open and shut when the player access the vehicle. The back should have 4 doors that are connected to small chests. Each chest will have 1/4 a chests inventory adding up to 2 chests in total.

View file

@ -0,0 +1,11 @@
3 versions of this will need to be created
A) Sentry gun version
This will use an advanced system in combo with the player to select mine around it. The player using a hand tool will flag blocks to be mined. A few seconds after doing this the sentry will aim at the block and start to mine it.
B) Player mounted version
Mounted version of C. It will use code like that used in the vehicle prefab but will not move. The player will aim it with the WASD keys since mouse input will let the player move it to fast. The player will then fire it with the space bar or mouse button if we can code that in correctly.
c) Prototype version
This will be dumped down almost item mining laser type. It will need to be manually moved by the player without the player mounting it. This means it will be hard to use and about useless. However, its purpose is a stepping stone in the developement of mining lasers. Once the player crafts it they should then be able to create the other two versions.

View file

@ -0,0 +1,4 @@
Combine this will a drill that will be created later. The idea is that a player can drill a hole threw bedrock to tab into an underground well for water. This way they have an inf source of water since well generally can hold 1M gallons of water and are constanly refilled when it rains. Though make sure that we limit the max water output to a few bucks a min to prevent abuse. As well after making the well the player will need to make a pipe down to it which should be 1-3K blocks under bedrock. The player will also need to pump it out using the FM pump.
We can also do the same to tap into a lava source though there will be dire outcomes. Example is the lava escapes from the well and errupts causing damage tot eh sourounding area. Make sure to add a config option for this. Options should be can create, volume per hour output, and can greif.

View file

@ -0,0 +1 @@
A very small single block evelvator that can carry either a playter or a few items. Is designed to be an earlier tier elevator for deep mines.Later version of this will be used by the player to access the mining dimension that exist bellow bedrock.

View file

@ -0,0 +1,25 @@
Since i'm looking to start having each mod support railcraft and mods like it we need some mining carts. Including a much better version of railcrafts bore.
Cart 1: Ore cart
Simple as create a handler to turn let a normal cart be filled with items and render the items in it. We will need to override the built in cart or at least make a right click function that turns the current cart into a new ore cart. As well another to turn it back into a cart the player can ride. The purpose of this is a very cheap way to move a large amount of ore in cart without a chest. As well it looks really nice.
Cart 2: Drill cart
More of a comical cart as it doesn't do much though when combined with a track layer it can dig and lay tracks down.
Cart 3: Laser cart
More useful as it can be angled in all direction to act as a mobile digger when combined with a steam engine and battery cart. Will eat up a lot of power but will melt a block a second.
Cart 4: Mining cart
A decoration cart that allows the player to place a pick ax on the outside.
Cart 5: Demo cart
A cart that is used to store demolition gear and a more visual way. Once again is a decortaion cart as it has no real function.
Cart 6: Boring machine
Same as the railcraft cart but is a bit more complex. Not only can it drill but it has 4 robotic arms on the outside to place blocks to create a tunnel. The arms can also mine the walls as well and later with FM can spray concrete on the wall to form blocks. This version of the boring machine is a lot slower than the railcraft version but has many more uses. Including a GUI to design the tunnel, run time args to tell it when to stop, and built in chunk loading. It will also lay down pipes or conveyor belts so that items are funnel back to the exit of the tunnel. Though this will be a configurable option. As well this machine should only be activated with assembly line installed since it will use the robotic arms to function. However, we could make a lesser version of it that loads in its place.
Cart 7: Track layer
Can lay tracks. Though i'm unsure which mod to place this in but it makes since to add it to a heavy mining mod. Basicly its a 2 robotic arm machine that places tracks. The arms can only place forwards and are attacked to the side of the cart. The tracks will sit in the cart up right. The track layer can only hold 64 tracks but can be combined with a chest cart to carry many more. Though we can add a config option for the number of storage slots.

View file

@ -0,0 +1,5 @@
Demo tools and explosive are listed in the tool txt file.
This will be a very effective way to mine. In which the rocks will be broken down into easy to mine rubble blocks. The rubble blocks will be non-ticking tileEntities that store the itemStack of the item they will drop. These blocks will look like gravel and mine just as easy. Other machines will be added to make this very fast. As well this will work in combo with the current rubble ore items used by Assembly Line crusher and grinder. That way we get a more realistic explosive drop rate.
To do this the base explosion will be override as well some ICBM content. In which it will logicaly understand that different items drop. Though we might be able to pull this off with a forge hook as well. Some research will be needed to make this work correctly

View file

@ -0,0 +1,3 @@
Upgraded version of the current mining laser using the same Item that has the ability to collect the items using a gravity field. Should cost the player a lot to create and render a blue/purple cone like void around the laser.
Render should be about the same size of the current laser but look more like a cannon.

View file

@ -0,0 +1,9 @@
Idea of the drill is the same as the IC2 drill but vastly improved.
Main thing to work on is have it drill on right click and not mine on left. Though how this is actually done is optional. The recommended plan is to have it drill only while right click is held just like the mining laser. The same code can actually be used but with the range being 3 blocks only. This should allow it to work much better than the slow left clikc hold that will not work with the model.
For animation the drill head should spin and kick up particles from what it mines. Yes, even when attacking an entity should it create particles but instead if will be blood. Its a bit graphics but will make for a more full experience when using the tool.
The down side for the drill should be the same as the mining laser. Its a heavy peace of mining gear that is very effect at mining stone but is a bit hard for the player to move around with. It should actually out do the mining laser as the laser advantage is range over speed.
Another downside is the drill's head should slowly fade away but can be replace by several material types. As well both a fuel and battery powered drill should be created for the player to pick between.

View file

@ -0,0 +1 @@
remote version of the ore scanner. It has a much weaker range than the block version but should work just the same. Though it's down side is it will only give the player very generic results unless they bring it back to an actual ore scanner to process.

Binary file not shown.

View file

@ -0,0 +1 @@
Replace the built in mine world generator to create more complex and fuller mines. As well add special biome cases were the mine will change. For example watery biomes should have flood chances.

View file

@ -0,0 +1,3 @@
Too support the idea of ore viens existing bellow bedrock we need to create a dim that the player can access. This dim will use the ore vien map to actually generate a very large vien of ore for the player to see. While the player is in the dim they will actually see their machines work on collecting ore. As well any ore they mine will be removed from the global vien map.
Another thing this dim will not actually save, and will regen often. Its used as a fake dim for the player to have an area to always mine from. Though we might be able to tie in a few feature to let it remain.

View file

@ -0,0 +1,3 @@
We could later on add a system to override mod ores. Then generate very large vains of ore that will cause player to look for them. Instead of getting small pockets of ore a player could find a 1K long span of ore. This will keep them mining for a while. As well SMP will make a reason to build mining sites and fight over land.
Another part of this will be bedrock mines. In which a mine can be built that will dig down to bed rock and pertend that there is land under bedrock. This can be used as a long term mining output at a slow pace. Eg 20 bars an hour comparted to a player getting 100 an hour. Deminson support can be added to this simulating an actual cave world that is being mined. I was planning on adding this to my NPC mod but we can develope it out here first. As well don't confuse this will infite mining as sites will go dry. A map will be created that will log vains of ore under the bedrock. It will say how many blocks and the size of the vain. In which the player will get his ore as long as the vain is still there. After a while the vain will run out, though it could take weeks.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 194 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View file

@ -0,0 +1,5 @@
{
"animation": {
"frametime": 2
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 945 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 822 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 186 B

View file

@ -0,0 +1,17 @@
# German @author Archadia and Vexatos
## Items
item.HandDrill.name=Handbohrer
item.InstaHole.name=[Dev]Instant-Loch
item.MiningLaser.name=Laser-Handbohrer
## Blocks
tile.Machine_Fracker.name=Fracking-Maschine
tile.Machine_OreScanner.name=Zyklischer Scanner
tile.Fracking_Pipe.name=Fracking-Rohr
tile.World_Rubble.name=Schutt
tile.Machine_ApertureExcavator.name=Aperturexkavator
tile.LaserMiner.name=Minierturm
tile.LaserMiner.0.name=Minierturm: Laser
tile.LaserMiner.1.name=Minierposten
tile.Machine_LaserDrill.name=Apertur-Laser-Bohrer

View file

@ -0,0 +1,17 @@
# English @author Archadia
## Items
item.HandDrill.name=Hand Drill: Bit
item.InstaHole.name=[Dev]Instant Hole
item.MiningLaser.name=Hand Drill: Laser
## Blocks
tile.Machine_Fracker.name=Fracking Machine
tile.Machine_OreScanner.name=Cyclic Scanner
tile.Fracking_Pipe.name=Fracking Pipe
tile.World_Rubble.name=Rubble
tile.Machine_ApertureExcavator.name=Aperture Excavator
tile.LaserMiner.name=Mining Turret
tile.LaserMiner.0.name=Mining Turret: Laser
tile.LaserMiner.1.name=Mining Sentry: Laser
tile.Machine_LaserDrill.name=Aperture Laser Drill

View file

@ -63,6 +63,8 @@ public class ALRecipeLoader
public static Block blockGlowGlass; public static Block blockGlowGlass;
public static Block blockSteamGen, blockSolar, blockBatBox; public static Block blockSteamGen, blockSolar, blockBatBox;
public static Block blockGas; public static Block blockGas;
public static Block frackingPipe;
public static Block laserSentry = null;
public static Item itemImprint; public static Item itemImprint;
public static Item itemDisk; public static Item itemDisk;

View file

@ -1,15 +0,0 @@
package com.builtbroken.assemblyline.api;
import universalelectricity.api.vector.Vector2;
/** Class used in the creation of servo based object
*
* @author Rseifert */
public interface IServo
{
/** Gets the rotation as a Vector2 (X - Yaw, Y - pitch) */
public Vector2 getRotation();
/** Forces the rotation to the two angles */
public void setRotation(float yaw, float pitch);
}

View file

@ -1,21 +0,0 @@
package com.builtbroken.assemblyline.api;
import java.util.HashMap;
/** Container like class to handle several servos in an object.
*
* @author DarkGuardsman */
public interface IServoHandler
{
/** Gets a map of the handler's server with a string to ID them by. Mainly will only be used by
* advanced encoders to change the handlers servos in code */
public HashMap<String, IServo> getServos();
/** Ask the handler to rotation the servo.
*
* @return true if the handler will rotate the servo */
public boolean updateRotation(String servo, float rotation);
/** Forces the rotation angle of a servo. */
public void setRotation(String servo, float rotation);
}

View file

@ -0,0 +1,79 @@
package com.builtbroken.assemblyline.api;
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

@ -0,0 +1,97 @@
package com.builtbroken.assemblyline.client.model;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
public class ModelFrackingPipe extends ModelBase
{
ModelRenderer Back;
ModelRenderer Top;
ModelRenderer Left;
ModelRenderer Right;
ModelRenderer Front;
ModelRenderer Bottom;
ModelRenderer Pipe;
public ModelFrackingPipe()
{
textureWidth = 128;
textureHeight = 64;
Back = new ModelRenderer(this, 35, 18);
Back.addBox(0F, 0F, 0F, 14, 14, 1);
Back.setRotationPoint(-7F, 9F, 7F);
Back.setTextureSize(128, 64);
Back.mirror = true;
setRotation(Back, 0F, 0F, 0F);
Top = new ModelRenderer(this, 0, 0);
Top.addBox(0F, 0F, 0F, 16, 1, 16);
Top.setRotationPoint(-8F, 8F, -8F);
Top.setTextureSize(128, 64);
Top.mirror = true;
setRotation(Top, 0F, 0F, 0F);
Left = new ModelRenderer(this, 0, 18);
Left.addBox(0F, 0F, 0F, 1, 14, 16);
Left.setRotationPoint(-8F, 9F, -8F);
Left.setTextureSize(128, 64);
Left.mirror = true;
setRotation(Left, 0F, 0F, 0F);
Right = new ModelRenderer(this, 0, 18);
Right.addBox(0F, 0F, 0F, 1, 14, 16);
Right.setRotationPoint(7F, 9F, -8F);
Right.setTextureSize(128, 64);
Right.mirror = true;
setRotation(Right, 0F, 0F, 0F);
Front = new ModelRenderer(this, 35, 18);
Front.addBox(0F, 0F, 0F, 14, 14, 1);
Front.setRotationPoint(-7F, 9F, -8F);
Front.setTextureSize(128, 64);
Front.mirror = true;
setRotation(Front, 0F, 0F, 0F);
Bottom = new ModelRenderer(this, 0, 0);
Bottom.addBox(0F, 0F, 0F, 16, 1, 16);
Bottom.setRotationPoint(-8F, 23F, -8F);
Bottom.setTextureSize(128, 64);
Bottom.mirror = true;
setRotation(Bottom, 0F, 0F, 0F);
Pipe = new ModelRenderer(this, 35, 34);
Pipe.addBox(0F, 0F, 0F, 6, 14, 6);
Pipe.setRotationPoint(-3F, 9F, -3F);
Pipe.setTextureSize(128, 64);
Pipe.mirror = true;
setRotation(Pipe, 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);
setRotationAngles(f, f1, f2, f3, f4, f5, entity);
}
public void renderAll()
{
Back.render(0.0625F);
Top.render(0.0625F);
Left.render(0.0625F);
Right.render(0.0625F);
Front.render(0.0625F);
Bottom.render(0.0625F);
Pipe.render(0.0625F);
}
private void setRotation(ModelRenderer model, float x, float y, float z)
{
model.rotateAngleX = x;
model.rotateAngleY = y;
model.rotateAngleZ = z;
}
@Override
public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity)
{
super.setRotationAngles(f, f1, f2, f3, f4, f5, entity);
}
}

View file

@ -0,0 +1,119 @@
// Date: 11/12/2013 5:27:39 PM
// Template version 1.1
// Java generated by Techne
// Keep in mind that you still need to fill in some blanks
// - ZeuX
package com.builtbroken.assemblyline.client.model;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
public class ModelLaserTile extends ModelBase
{
//fields
ModelRenderer base;
ModelRenderer base2;
ModelRenderer rod;
ModelRenderer body;
ModelRenderer body2;
ModelRenderer body3;
ModelRenderer body4;
ModelRenderer body5;
ModelRenderer body6;
ModelRenderer body7;
public ModelLaserTile()
{
textureWidth = 128;
textureHeight = 128;
base = new ModelRenderer(this, 0, 76);
base.addBox(-5F, 0F, -5F, 10, 1, 10);
base.setRotationPoint(0F, 23F, 0F);
base.setTextureSize(128, 128);
base.mirror = true;
setRotation(base, 0F, 0F, 0F);
base2 = new ModelRenderer(this, 0, 66);
base2.addBox(-4F, 0F, -4F, 8, 1, 8);
base2.setRotationPoint(0F, 22F, 0F);
base2.setTextureSize(128, 128);
base2.mirror = true;
setRotation(base2, 0F, 0F, 0F);
rod = new ModelRenderer(this, 0, 53);
rod.addBox(-1.5F, -1F, -1.5F, 3, 8, 3);
rod.setRotationPoint(0F, 15F, 0F);
rod.setTextureSize(128, 128);
rod.mirror = true;
setRotation(rod, 0F, 0F, 0F);
body = new ModelRenderer(this, 0, 35);
body.addBox(-3.5F, -1F, -2.5F, 9, 3, 5);
body.setRotationPoint(0F, 10F, 0F);
body.setTextureSize(128, 128);
body.mirror = true;
setRotation(body, 0F, 0F, 0F);
body2 = new ModelRenderer(this, 0, 44);
body2.addBox(-3.5F, -1F, -2F, 7, 2, 4);
body2.setRotationPoint(0F, 13F, 0F);
body2.setTextureSize(128, 128);
body2.mirror = true;
setRotation(body2, 0F, 0F, 0F);
body3 = new ModelRenderer(this, 30, 37);
body3.addBox(-3.5F, -1F, -2F, 3, 4, 4);
body3.setRotationPoint(-3F, 10.3F, 0F);
body3.setTextureSize(128, 128);
body3.mirror = true;
setRotation(body3, 0F, 0F, 0F);
body4 = new ModelRenderer(this, 57, 34);
body4.addBox(-3.5F, -1.5F, -1F, 3, 1, 2);
body4.setRotationPoint(-6F, 11F, 0F);
body4.setTextureSize(128, 128);
body4.mirror = true;
setRotation(body4, 0F, 0F, 0F);
body5 = new ModelRenderer(this, 57, 47);
body5.addBox(-3.5F, -1.5F, -1F, 3, 1, 2);
body5.setRotationPoint(-6F, 13F, 0F);
body5.setTextureSize(128, 128);
body5.mirror = true;
setRotation(body5, 0F, 0F, 0F);
body6 = new ModelRenderer(this, 66, 42);
body6.addBox(-3.5F, -1.5F, -1.5F, 3, 1, 1);
body6.setRotationPoint(-6F, 12F, 0F);
body6.setTextureSize(128, 128);
body6.mirror = true;
setRotation(body6, 0F, 0F, 0F);
body7 = new ModelRenderer(this, 51, 41);
body7.addBox(-3.5F, -1.5F, 0.5F, 3, 1, 1);
body7.setRotationPoint(-6F, 12F, 0F);
body7.setTextureSize(128, 128);
body7.mirror = true;
setRotation(body7, 0F, 0F, 0F);
}
public void render(float f5)
{
base.render(f5);
base2.render(f5);
rod.render(f5);
body.render(f5);
body2.render(f5);
body3.render(f5);
body4.render(f5);
body5.render(f5);
body6.render(f5);
body7.render(f5);
}
public void renderAll()
{
this.render(0.0625F);
}
private void setRotation(ModelRenderer model, float x, float y, float z)
{
model.rotateAngleX = x;
model.rotateAngleY = y;
model.rotateAngleZ = z;
}
}

View file

@ -0,0 +1,146 @@
// Date: 11/12/2013 5:48:04 PM
// Template version 1.1
// Java generated by Techne
// Keep in mind that you still need to fill in some blanks
// - ZeuX
package com.builtbroken.assemblyline.client.model;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
public class ModelMiningLaserGun extends ModelBase
{
//fields
ModelRenderer grip;
ModelRenderer grip2;
ModelRenderer body;
ModelRenderer body2;
ModelRenderer body3;
ModelRenderer body4;
ModelRenderer body5;
ModelRenderer body6;
ModelRenderer barrel;
ModelRenderer barrel2;
ModelRenderer screen;
ModelRenderer battery;
ModelRenderer batteryClip;
ModelRenderer batteryClip2;
public ModelMiningLaserGun()
{
textureWidth = 128;
textureHeight = 64;
grip = new ModelRenderer(this, 1, 26);
grip.addBox(0F, 0F, 0F, 1, 2, 1);
grip.setRotationPoint(0.5F, 19F, -2F);
grip.setTextureSize(128, 64);
grip.mirror = true;
setRotation(grip, 0.4014257F, 0F, 0F);
grip2 = new ModelRenderer(this, 32, 2);
grip2.addBox(-1.5F, 0F, 0F, 3, 1, 1);
grip2.setRotationPoint(4.5F, 17.58F, -12.01F);
grip2.setTextureSize(128, 64);
grip2.mirror = true;
setRotation(grip2, 0F, 0F, 0F);
body = new ModelRenderer(this, 16, 39);
body.addBox(-1.5F, 0F, 0F, 3, 3, 13);
body.setRotationPoint(1F, 15.8F, -11.01F);
body.setTextureSize(128, 64);
body.mirror = true;
setRotation(body, 0F, 0F, 0F);
body2 = new ModelRenderer(this, 49, 41);
body2.addBox(0F, 0F, 0F, 2, 1, 13);
body2.setRotationPoint(0F, 15.6F, -11.01F);
body2.setTextureSize(128, 64);
body2.mirror = true;
setRotation(body2, 0F, 0F, 0F);
body3 = new ModelRenderer(this, 55, 7);
body3.addBox(-1.5F, 0F, 0F, 2, 1, 8);
body3.setRotationPoint(1.5F, 18.8F, -15.01F);
body3.setTextureSize(128, 64);
body3.mirror = true;
setRotation(body3, 0F, 0F, 0F);
body4 = new ModelRenderer(this, 0, 0);
body4.addBox(0F, 0F, 0F, 2, 1, 5);
body4.setRotationPoint(0F, 18F, -3F);
body4.setTextureSize(128, 64);
body4.mirror = true;
setRotation(body4, 0F, 0F, 0F);
body5 = new ModelRenderer(this, 17, 7);
body5.addBox(-1.5F, 0F, 0F, 1, 2, 8);
body5.setRotationPoint(0.5F, 17F, -15.01F);
body5.setTextureSize(128, 64);
body5.mirror = true;
setRotation(body5, 0F, 0F, 0F);
body6 = new ModelRenderer(this, 36, 7);
body6.addBox(-1.5F, 0F, 0F, 1, 2, 8);
body6.setRotationPoint(3.5F, 17F, -15.01F);
body6.setTextureSize(128, 64);
body6.mirror = true;
setRotation(body6, 0F, 0F, 0F);
barrel = new ModelRenderer(this, 34, 21);
barrel.addBox(0F, 0F, 0F, 1, 3, 8);
barrel.setRotationPoint(0.5F, 16F, -19.01F);
barrel.setTextureSize(128, 64);
barrel.mirror = true;
setRotation(barrel, 0F, 0F, 0F);
barrel2 = new ModelRenderer(this, 55, 23);
barrel2.addBox(0F, 0F, 0F, 2, 2, 6);
barrel2.setRotationPoint(0F, 16.8F, -17.01F);
barrel2.setTextureSize(128, 64);
barrel2.mirror = true;
setRotation(barrel2, 0F, 0F, 0F);
screen = new ModelRenderer(this, 7, 10);
screen.addBox(0F, 0F, 0F, 3, 3, 1);
screen.setRotationPoint(2.5F, 16F, -8.01F);
screen.setTextureSize(128, 64);
screen.mirror = true;
setRotation(screen, 0.5410521F, 0F, 0F);
battery = new ModelRenderer(this, 17, 22);
battery.addBox(-1.5F, 0F, 0F, 2, 4, 5);
battery.setRotationPoint(-1F, 16F, -6.5F);
battery.setTextureSize(128, 64);
battery.mirror = true;
setRotation(battery, 0F, 0F, 0F);
batteryClip = new ModelRenderer(this, 17, 0);
batteryClip.addBox(-1.5F, 0F, 0F, 2, 1, 1);
batteryClip.setRotationPoint(-0.4F, 16.5F, -2F);
batteryClip.setTextureSize(128, 64);
batteryClip.mirror = true;
setRotation(batteryClip, 0F, 0F, 0F);
batteryClip2 = new ModelRenderer(this, 17, 0);
batteryClip2.addBox(-1.5F, 0F, 0F, 2, 1, 1);
batteryClip2.setRotationPoint(-0.4F, 16.5F, -7F);
batteryClip2.setTextureSize(128, 64);
batteryClip2.mirror = true;
setRotation(batteryClip2, 0F, 0F, 0F);
}
public void render(float f5)
{
grip.render(f5);
grip2.render(f5);
body.render(f5);
body2.render(f5);
body3.render(f5);
body4.render(f5);
body5.render(f5);
body6.render(f5);
barrel.render(f5);
barrel2.render(f5);
screen.render(f5);
battery.render(f5);
batteryClip.render(f5);
batteryClip2.render(f5);
}
private void setRotation(ModelRenderer model, float x, float y, float z)
{
model.rotateAngleX = x;
model.rotateAngleY = y;
model.rotateAngleZ = z;
}
}

View file

@ -69,6 +69,21 @@ public class BlockRenderHelper implements ISimpleBlockRenderingHandler
conPump.renderMotor(0.0725F); conPump.renderMotor(0.0725F);
} }
else if (ALRecipeLoader.frackingPipe != null && block.blockID == ALRecipeLoader.frackingPipe.blockID)
{
FMLClientHandler.instance().getClient().renderEngine.bindTexture(RenderFrackingPipe.TEXTURE);
GL11.glTranslatef(0, 1F, 0);
GL11.glScalef(1.0F, -1F, -1F);
RenderFrackingPipe.model.renderAll();
}
else if (ALRecipeLoader.laserSentry != null && block.blockID == ALRecipeLoader.laserSentry.blockID)
{
FMLClientHandler.instance().getClient().renderEngine.bindTexture(RenderMiningLaser.TEXTURE);
GL11.glTranslatef(0, 1.7F, 0);
GL11.glScalef(1.0F, -1F, -1F);
GL11.glRotatef(180, 0, 1, 0);
RenderMiningLaser.model.renderAll();
}
GL11.glPopMatrix(); GL11.glPopMatrix();
} }

View file

@ -0,0 +1,32 @@
package com.builtbroken.assemblyline.client.render;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import com.builtbroken.assemblyline.AssemblyLine;
import com.builtbroken.assemblyline.client.model.ModelFrackingPipe;
import com.builtbroken.minecraft.DarkCore;
/** @author Archadia */
public class RenderFrackingPipe extends TileEntitySpecialRenderer
{
public static final ModelFrackingPipe model = new ModelFrackingPipe();
public static final ResourceLocation TEXTURE = new ResourceLocation(AssemblyLine.DOMAIN, DarkCore.MODEL_DIRECTORY + "frackingpipe.png");
@Override
public void renderTileEntityAt(TileEntity tileEntity, double d, double d1, double d2, float f)
{
bindTexture(TEXTURE);
GL11.glPushMatrix();
GL11.glTranslatef((float) d + 0.5F, (float) d1 + 1.5F, (float) d2 + 0.5F);
GL11.glScalef(1.0F, -1F, -1F);
model.renderAll();
GL11.glPopMatrix(); // end
}
}

View file

@ -0,0 +1,37 @@
package com.builtbroken.assemblyline.client.render;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import com.builtbroken.assemblyline.AssemblyLine;
import com.builtbroken.assemblyline.client.model.ModelLaserTile;
import com.builtbroken.assemblyline.machine.TileLaserSentry;
import com.builtbroken.minecraft.DarkCore;
/** @author Darkguardsman */
public class RenderMiningLaser extends TileEntitySpecialRenderer
{
public static final ModelLaserTile model = new ModelLaserTile();
public static final ResourceLocation TEXTURE = new ResourceLocation(AssemblyLine.DOMAIN, DarkCore.MODEL_DIRECTORY + "LaserTile.png");
@Override
public void renderTileEntityAt(TileEntity tileEntity, double d, double d1, double d2, float f)
{
bindTexture(TEXTURE);
GL11.glPushMatrix();
GL11.glTranslatef((float) d + 0.5F, (float) d1 + 1.5F, (float) d2 + 0.5F);
GL11.glScalef(1.0F, -1F, -1F);
if (tileEntity instanceof TileLaserSentry)
{
float yaw = ((TileLaserSentry) tileEntity).getYaw() - 90;
GL11.glRotatef(yaw, 0, 1, 0);
}
model.renderAll();
GL11.glPopMatrix(); // end
}
}

View file

@ -0,0 +1,86 @@
package com.builtbroken.assemblyline.client.render;
import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.IItemRenderer;
import org.lwjgl.opengl.GL11;
import com.builtbroken.assemblyline.AssemblyLine;
import com.builtbroken.assemblyline.client.model.ModelMiningLaserGun;
import com.builtbroken.minecraft.DarkCore;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class RenderMiningLaserGun implements IItemRenderer
{
private static final ModelMiningLaserGun MODEL = new ModelMiningLaserGun();
private static final ResourceLocation TEXTURE = new ResourceLocation(AssemblyLine.DOMAIN, DarkCore.MODEL_DIRECTORY + "LaserGun.png");
@Override
public boolean handleRenderType(ItemStack item, ItemRenderType type)
{
return true;
}
@Override
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper)
{
return true;
}
@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data)
{
GL11.glPushMatrix();
FMLClientHandler.instance().getClient().renderEngine.bindTexture(TEXTURE);
if (type == ItemRenderType.EQUIPPED_FIRST_PERSON)
{
float scale = 3f;
if (Minecraft.getMinecraft().thePlayer.getItemInUse() != item)
{
GL11.glScalef(scale, scale, scale);
GL11.glTranslatef(0, 1.5f, .5f);
GL11.glRotatef(180, 0, 0, 1);
GL11.glRotatef(30, 0, 1, 0);
GL11.glRotatef(10, 1, 0, 0);
}
else
{
scale = 8f;
GL11.glScalef(scale, scale, scale);
GL11.glTranslatef(-.01f, 1.0f, .8f);
GL11.glRotatef(180, 0, 0, 1);
GL11.glRotatef(40, 0, 1, 0);
GL11.glRotatef(-20, 1, 0, 0);
}
}
else if (type == ItemRenderType.EQUIPPED)
{
float scale = 3f;
GL11.glScalef(scale, scale, scale);
GL11.glRotatef(-105, 0, 0, 1);
GL11.glRotatef(-70, 0, 1, 0);
GL11.glTranslatef(0.3f, -0.9f, 0.42f);
}
else if (type == ItemRenderType.INVENTORY)
{
float scale = 2f;
GL11.glScalef(scale, scale, scale);
GL11.glRotatef(180, 0, 0, 1);
GL11.glRotatef(-70, 0, 1, 0);
GL11.glTranslatef(-0.07f, -1.2f, 0.52f);
}
MODEL.render(0.0625F);
GL11.glPopMatrix();
}
}

View file

@ -300,16 +300,16 @@ public abstract class TileEntityFluidNetworkTile extends TileEntityFluidDevice i
if (fluid.getFluid().isGaseous(fluid) && !mat.canSupportGas) if (fluid.getFluid().isGaseous(fluid) && !mat.canSupportGas)
{ {
//TODO lose 25% of the gas, and render the escaping gas as a particle effect //TODO lose 25% of the gas, and render the escaping gas as a particle effect
this.getTileNetwork().drainNetworkTank(this.worldObj, (int) (fluid.amount * .25), true); this.getTileNetwork().drainNetworkTank(this.worldObj, (int) (fluid.amount * .05), true);
} }
else if (FluidMasterList.isMolten(fluid.getFluid()) && !mat.canSupportMoltenFluids) else if (FluidMasterList.isMolten(fluid.getFluid()) && !mat.canSupportMoltenFluids)
{ {
//TODO start to heat up the pipe to melting point. When it hits melting point turn the pipe to its molten metal equal //TODO start to heat up the pipe to melting point. When it hits melting point turn the pipe to its molten metal equal
//TODO also once it reaches a set heat level start burning up blocks around the pipe such as wood //TODO also once it reaches a set heat level start burning up blocks around the pipe such as wood
this.heat += FluidMasterList.getHeatPerPass(fluid.getFluid()); // this.heat += FluidMasterList.getHeatPerPass(fluid.getFluid());
if (heat >= this.maxHeat) if (heat >= this.maxHeat)
{ {
this.worldObj.setBlock(xCoord, yCoord, zCoord, Block.lavaStill.blockID); this.worldObj.setBlock(xCoord, yCoord, zCoord, Block.fire.blockID);
return true; return true;
} }
} }

View file

@ -107,11 +107,11 @@ public enum EnumTool
} }
public static Icon getToolIcon(int metadata) public static Icon getToolIcon(int metadata)
{
if (metadata < EnumMaterial.values().length)
{ {
int mat = getToolMatFromMeta(metadata).ordinal(); int mat = getToolMatFromMeta(metadata).ordinal();
int tool = getToolFromMeta(metadata).ordinal(); int tool = getToolFromMeta(metadata).ordinal();
if (mat < EnumMaterial.values().length)
{
if (EnumTool.values()[tool].toolIcons == null) if (EnumTool.values()[tool].toolIcons == null)
{ {
EnumTool.values()[tool].toolIcons = new Icon[EnumMaterial.values().length]; EnumTool.values()[tool].toolIcons = new Icon[EnumMaterial.values().length];

View file

@ -0,0 +1,57 @@
package com.builtbroken.assemblyline.item;
import net.minecraft.block.Block;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import com.builtbroken.minecraft.DarkCore;
/** Creative mod tool to quickly create a large hole in the ground. Is designed only for debug
* testing of ore generation.
*
* @author DarkGuardsman */
public class ItemInstaHole extends Item
{
public ItemInstaHole()
{
super(DarkCore.getNextItemId());
this.setUnlocalizedName("InstaHole");
this.setCreativeTab(CreativeTabs.tabTools);
}
@Override
public boolean onItemUse(ItemStack item, EntityPlayer player, World world, int xx, int yy, int zz, int par7, float par8, float par9, float par10)
{
if (player != null && player.capabilities.isCreativeMode)
{
if (world.isRemote)
{
return true;
}
for (int y = yy; y > 0; y--)
{
for (int x = xx - 10; x < xx + 10; x++)
{
for (int z = zz - 10; z < zz + 10; z++)
{
int id = world.getBlockId(x, y, z);
if (id == 0)
{
world.setBlock(x, y, z, 20);
}
else if (id == Block.sand.blockID || id == Block.gravel.blockID || id == 1 || id == Block.dirt.blockID || id == Block.grass.blockID)
{
world.setBlock(x, y, z, 0);
}
}
}
}
return true;
}
return false;
}
}

View file

@ -0,0 +1,268 @@
package com.builtbroken.assemblyline.item;
import java.awt.Color;
import java.util.HashMap;
import java.util.List;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.DamageSource;
import net.minecraft.util.EnumMovingObjectType;
import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import net.minecraftforge.common.Configuration;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.oredict.OreDictionary;
import universalelectricity.api.item.ItemElectric;
import universalelectricity.api.vector.Vector3;
import com.builtbroken.assemblyline.AssemblyLine;
import com.builtbroken.common.Pair;
import com.builtbroken.minecraft.CoreRegistry;
import com.builtbroken.minecraft.DarkCore;
import com.builtbroken.minecraft.IExtraInfo.IExtraItemInfo;
import com.builtbroken.minecraft.LaserEvent;
import com.builtbroken.minecraft.helpers.RayTraceHelper;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
/** Stream laser mining tool, When held down it will slowly mine away at the block in front of it.
*
*
* TODO create model for this that is 3D. The front should spin around the barrel as its mines
* generating a laser. As well the player should be wearing a battery pack when the laser is out.
* Other option is to force the player to wear a battery pack as armor when using the tool
*
* TODO when the laser hits the block there should be a flaring effect that simi blinds the player.
* That way they are force to wear wielding googles. As well this will gear the player more towards
* mining and less to fighting. Though the laser should still be a very effect fighting weapon, with
* only down side being its battery, and that it slows you down when held. Eg its a heavy peace of
* mining gear and the player will be simi-stationary when using it
*
* @author DarkGuardsman */
public class ItemMiningLaser extends ItemElectric implements IExtraItemInfo
{
long batterySize = 100000;
float wattPerShot = 1;
float damageToEntities = 3.3f;
int blockRange = 50;
int firingDelay = 5;
int breakTime = 15;
boolean createLava = true, setFire = true;
HashMap<EntityPlayer, Pair<Vector3, Integer>> miningMap = new HashMap<EntityPlayer, Pair<Vector3, Integer>>();
public ItemMiningLaser()
{
super(AssemblyLine.CONFIGURATION.getItem("LaserMiningGun", DarkCore.getNextItemId()).getInt());
this.setUnlocalizedName("MiningLaser");
this.setMaxStackSize(1);
this.setCreativeTab(CreativeTabs.tabTools);
}
@Override
public EnumAction getItemUseAction(ItemStack par1ItemStack)
{
return EnumAction.bow;
}
@Override
public int getMaxItemUseDuration(ItemStack par1ItemStack)
{
//TODO change render of the laser too show it slowly over heat, when it over heats eg gets to max use damage the player, and tool
return 1000;
}
@Override
public void onUpdate(ItemStack itemStack, World par2World, Entity entity, int par4, boolean par5)
{
//Slow any entity that carries this down as a side effect of using heavy mining gear
if (entity instanceof EntityLivingBase)
{
boolean flag = entity instanceof EntityPlayer && ((EntityPlayer) entity).capabilities.isCreativeMode;
if (!flag)
{
((EntityLivingBase) entity).addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 5, 0));
}
else
{
//((EntityPlayer) entity).setItemInUse(itemStack, this.getMaxItemUseDuration(itemStack));
}
}
}
@Override
public void onCreated(ItemStack stack, World par2World, EntityPlayer entityPlayer)
{
this.setEnergy(stack, 0);
if (stack.getTagCompound() == null)
{
stack.setTagCompound(new NBTTagCompound());
}
if (entityPlayer != null)
{
stack.getTagCompound().setString("Creator", entityPlayer.username);
}
}
@Override
public void onUsingItemTick(ItemStack stack, EntityPlayer player, int count)
{
if (count > 5)
{
Vec3 playerPosition = Vec3.createVectorHelper(player.posX, player.posY + player.getEyeHeight(), player.posZ);
Vec3 playerLook = RayTraceHelper.getLook(player, 1.0f);
Vec3 p = Vec3.createVectorHelper(playerPosition.xCoord + playerLook.xCoord, playerPosition.yCoord + playerLook.yCoord, playerPosition.zCoord + playerLook.zCoord);
Vec3 playerViewOffset = Vec3.createVectorHelper(playerPosition.xCoord + playerLook.xCoord * blockRange, playerPosition.yCoord + playerLook.yCoord * blockRange, playerPosition.zCoord + playerLook.zCoord * blockRange);
MovingObjectPosition hit = RayTraceHelper.do_rayTraceFromEntity(player, new Vector3().toVec3(), blockRange, true);
//TODO fix sound
if (hit != null)
{
LaserEvent event = new LaserEvent.LaserFiredPlayerEvent(player, hit, stack);
MinecraftForge.EVENT_BUS.post(event);
if (!player.worldObj.isRemote && !event.isCanceled())
{
if (hit.typeOfHit == EnumMovingObjectType.ENTITY && hit.entityHit != null)
{
//TODO re-implements laser damage source
DamageSource damageSource = DamageSource.causeMobDamage(player);
hit.entityHit.attackEntityFrom(damageSource, damageToEntities);
hit.entityHit.setFire(5);
}
else if (hit.typeOfHit == EnumMovingObjectType.TILE)
{
int time = 1;
boolean mined = false;
if (miningMap.containsKey(player))
{
Pair<Vector3, Integer> lastHit = miningMap.get(player);
if (lastHit != null && lastHit.left() != null && lastHit.left().equals(new Vector3(hit)))
{
time = lastHit.right() + 1;
if (time >= breakTime)
{
LaserEvent.onBlockMinedByLaser(player.worldObj, player, new Vector3(hit));
mined = true;
miningMap.remove(player);
}
else
{
//TODO get the actual hit side from the angle of the ray trace
LaserEvent.onLaserHitBlock(player.worldObj, player, new Vector3(hit), ForgeDirection.UP);
}
}
}
if (!mined)
{
miningMap.put(player, new Pair<Vector3, Integer>(new Vector3(hit), time));
}
}
}
playerViewOffset = hit.hitVec;
}
//TODO make beam brighter the longer it has been used
//TODO adjust the laser for the end of the gun
float x = (float) (MathHelper.cos((float) (player.rotationYawHead * 0.0174532925)) * (-.4) - MathHelper.sin((float) (player.rotationYawHead * 0.0174532925)) * (-.1));
float z = (float) (MathHelper.sin((float) (player.rotationYawHead * 0.0174532925)) * (-.4) + MathHelper.cos((float) (player.rotationYawHead * 0.0174532925)) * (-.1));
CoreRegistry.proxy().renderBeam(player.worldObj, new Vector3(p).translate(new Vector3(x, -.25, z)), new Vector3(playerViewOffset), Color.ORANGE, 1);
CoreRegistry.proxy().renderBeam(player.worldObj, new Vector3(p).translate(new Vector3(x, -.45, z)), new Vector3(playerViewOffset), Color.ORANGE, 1);
}
}
@Override
public ItemStack onItemRightClick(ItemStack itemStack, World par2World, EntityPlayer player)
{
if (player.capabilities.isCreativeMode || this.getEnergy(itemStack) > this.wattPerShot)
{
player.setItemInUse(itemStack, this.getMaxItemUseDuration(itemStack));
}
return itemStack;
}
@Override
public void onPlayerStoppedUsing(ItemStack par1ItemStack, World par2World, EntityPlayer player, int par4)
{
if (miningMap.containsKey(player))
{
miningMap.remove(player);
}
}
@Override
public ItemStack onEaten(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
return par1ItemStack;
}
@SideOnly(Side.CLIENT)
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4)
{
super.addInformation(stack, player, list, par4);
if (stack.getTagCompound() == null)
{
stack.setTagCompound(new NBTTagCompound());
}
String creator = stack.getTagCompound().getString("Creator");
if (!creator.equalsIgnoreCase("creative") && creator != "")
{
list.add("Created by: " + creator);
}
else if (creator.equalsIgnoreCase("creative"))
{
list.add("Created by Magic Dwarfs");
}
}
@Override
public long getEnergyCapacity(ItemStack theItem)
{
return this.batterySize;
}
@Override
public boolean hasExtraConfigs()
{
return true;
}
@Override
public void loadExtraConfigs(Configuration config)
{
this.blockRange = config.get("Laser", "Range", this.blockRange).getInt(this.blockRange);
this.firingDelay = config.get("Laser", "Delay", this.firingDelay).getInt(this.firingDelay);
this.damageToEntities = (float) config.get("Laser", "Damage", this.damageToEntities).getDouble(this.damageToEntities);
this.batterySize = (long) (config.get("Energy", "BatteryCap", this.batterySize).getInt());
this.wattPerShot = (float) (config.get("Energy", "FiringCost", this.wattPerShot * 1000).getDouble(this.wattPerShot * 1000) / 1000);
this.setFire = config.get("Laser", "SetFire", true, "Set plants, and wood on fire").getBoolean(true);
this.createLava = config.get("Laser", "MakeLava", true, "Turn some blocks into lava like obby").getBoolean(true);
}
@Override
public void loadOreNames()
{
OreDictionary.registerOre("MiningLaserGun", this);
}
}

View file

@ -0,0 +1,33 @@
package com.builtbroken.assemblyline.machine;
import java.util.Set;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import universalelectricity.api.UniversalElectricity;
import com.builtbroken.assemblyline.AssemblyLine;
import com.builtbroken.common.Pair;
import com.builtbroken.minecraft.prefab.BlockMachine;
/** @author Archadia */
public class BlockApertureExcavator extends BlockMachine
{
public BlockApertureExcavator()
{
super(AssemblyLine.CONFIGURATION, "Machine_ApertureExcavator", UniversalElectricity.machine);
}
@Override
public TileEntity createTileEntity(World world, int metadata)
{
return new TileApertureExcavator();
}
@Override
public void getTileEntities(int blockID, Set<Pair<String, Class<? extends TileEntity>>> list)
{
list.add(new Pair<String, Class<? extends TileEntity>>("TileApertureExcavator", TileApertureExcavator.class));
}
}

View file

@ -0,0 +1,44 @@
package com.builtbroken.assemblyline.machine;
import java.util.Set;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import universalelectricity.api.UniversalElectricity;
import com.builtbroken.assemblyline.AssemblyLine;
import com.builtbroken.common.Pair;
import com.builtbroken.minecraft.prefab.BlockMachine;
/** @author Archadia */
public class BlockFracker extends BlockMachine
{
public BlockFracker()
{
super(AssemblyLine.CONFIGURATION, "Machine_Fracker", UniversalElectricity.machine);
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int a, float b, float c, float d)
{
// player.openGui(MechanizedMining.instance, 1, world, x, y, z);
TileFracker tile = (TileFracker) world.getBlockTileEntity(x, y, z);
System.out.println(tile.tank.getFluidAmount());
return true;
}
@Override
public TileEntity createTileEntity(World world, int metadata)
{
return new TileFracker();
}
@Override
public void getTileEntities(int blockID, Set<Pair<String, Class<? extends TileEntity>>> list)
{
list.add(new Pair<String, Class<? extends TileEntity>>("TileFracker", TileFracker.class));
}
}

View file

@ -0,0 +1,53 @@
package com.builtbroken.assemblyline.machine;
import java.util.List;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import com.builtbroken.assemblyline.AssemblyLine;
import com.builtbroken.assemblyline.client.render.BlockRenderHelper;
import com.builtbroken.common.Pair;
import com.builtbroken.minecraft.prefab.BlockMachine;
/** @author Archadia */
public class BlockFrackingPipe extends BlockMachine
{
public BlockFrackingPipe()
{
super(AssemblyLine.CONFIGURATION, "Fracking_Pipe", Material.wood);
}
@Override
public void getClientTileEntityRenderers(List<Pair<Class<? extends TileEntity>, TileEntitySpecialRenderer>> list)
{
}
@Override
public int getRenderType()
{
return BlockRenderHelper.instance.getRenderId();
}
@Override
public boolean isOpaqueCube()
{
return false;
}
@Override
public boolean renderAsNormalBlock()
{
return false;
}
@Override
public TileEntity createTileEntity(World world, int metadata)
{
return new TileFrackingPipe();
}
}

View file

@ -0,0 +1,62 @@
package com.builtbroken.assemblyline.machine;
import java.util.Set;
import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import com.builtbroken.assemblyline.AssemblyLine;
import com.builtbroken.common.Pair;
import com.builtbroken.minecraft.prefab.BlockMachine;
/** @author Archadia */
public class BlockLaserDrill extends BlockMachine
{
public BlockLaserDrill()
{
super(AssemblyLine.CONFIGURATION, "Machine_LaserDrill", Material.iron);
}
@Override
public TileEntity createTileEntity(World world, int metadata)
{
return new TileLaserDrill();
}
@Override
public void getTileEntities(int blockID, Set<Pair<String, Class<? extends TileEntity>>> list)
{
list.add(new Pair<String, Class<? extends TileEntity>>("TileLaserDrill", TileLaserDrill.class));
}
@Override
public boolean onUseWrench(World world, int x, int y, int z, EntityPlayer entityPlayer, int side, float hitX, float hitY, float hitZ)
{
if (!world.isRemote)
{
TileEntity ent = world.getBlockTileEntity(x, y, z);
if (ent instanceof TileLaserSentry)
{
((TileLaserSentry) ent).rotateYaw(-10);
}
}
return false;
}
@Override
public boolean onSneakUseWrench(World world, int x, int y, int z, EntityPlayer entityPlayer, int side, float hitX, float hitY, float hitZ)
{
if (!world.isRemote)
{
TileEntity ent = world.getBlockTileEntity(x, y, z);
if (ent instanceof TileLaserSentry)
{
((TileLaserSentry) ent).rotateYaw(10);
}
}
return false;
}
}

View file

@ -0,0 +1,54 @@
package com.builtbroken.assemblyline.machine;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import net.minecraft.world.World;
import universalelectricity.api.vector.Vector3;
import com.builtbroken.common.Pair;
/** @author DarkGuardsman */
public class BlockMapUtil
{
public static List<Pair<Integer, Integer>> getBlocksInArea(World world, Vector3 start, Vector3 end)
{
Vector3 delta = end.translate(start.invert());
return null;
}
public static HashMap<Vector3, Pair<Integer, Integer>> getBlocksInGrid(World world, Vector3 center, Vector3 size, Pair<Integer, Integer>... pairs)
{
int startX = (int) (center.x - (size.x / 2));
int startY = (int) (center.y - (size.y / 2));
int startZ = (int) (center.z - (size.z / 2));
HashMap<Vector3, Pair<Integer, Integer>> mapping = new HashMap<Vector3, Pair<Integer, Integer>>();
List<Pair<Integer, Integer>> filter = new ArrayList<Pair<Integer, Integer>>();
if (pairs != null)
{
for (int i = 0; i < pairs.length; i++)
{
filter.add(pairs[i]);
}
}
for (int y = startY; y >= startY && y < center.y + (size.y / 2) - 1; y++)
{
for (int x = startX; y >= startX && x < center.x + (size.x / 2) - 1; x++)
{
for (int z = startZ; z >= startZ && z < center.z + (size.z / 2) - 1; z++)
{
Pair<Integer, Integer> block = new Pair<Integer, Integer>(world.getBlockId(x, y, z), world.getBlockMetadata(x, y, z));
if (pairs == null || filter.contains(block))
{
mapping.put(new Vector3(x, y, z), block);
}
}
}
}
return mapping;
}
}

View file

@ -0,0 +1,84 @@
package com.builtbroken.assemblyline.machine;
import java.util.Set;
import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import com.builtbroken.assemblyline.AssemblyLine;
import com.builtbroken.assemblyline.client.render.BlockRenderHelper;
import com.builtbroken.common.Pair;
import com.builtbroken.minecraft.prefab.BlockMachine;
/** Mining laser Prototype mainly used for crafting but can be used in the same way as Excavator.
* Creates four lasers from the side it is pointing in to mine away blocks
*
* @author DarkGuardsman */
public class BlockMiningLaser extends BlockMachine
{
public BlockMiningLaser()
{
super(AssemblyLine.CONFIGURATION, "LaserMiner", Material.iron);
}
@Override
public TileEntity createTileEntity(World world, int metadata)
{
return new TileLaserSentry();
}
@Override
public void getTileEntities(int blockID, Set<Pair<String, Class<? extends TileEntity>>> list)
{
list.add(new Pair<String, Class<? extends TileEntity>>("TileMiningLaser", TileLaserSentry.class));
}
@Override
public boolean onUseWrench(World world, int x, int y, int z, EntityPlayer entityPlayer, int side, float hitX, float hitY, float hitZ)
{
if (!world.isRemote)
{
TileEntity ent = world.getBlockTileEntity(x, y, z);
if (ent instanceof TileLaserSentry)
{
((TileLaserSentry) ent).rotateYaw(-10);
}
}
return false;
}
@Override
public boolean onSneakUseWrench(World world, int x, int y, int z, EntityPlayer entityPlayer, int side, float hitX, float hitY, float hitZ)
{
if (!world.isRemote)
{
TileEntity ent = world.getBlockTileEntity(x, y, z);
if (ent instanceof TileLaserSentry)
{
((TileLaserSentry) ent).rotateYaw(10);
}
}
return false;
}
@Override
public int getRenderType()
{
return BlockRenderHelper.instance.getRenderId();
}
@Override
public boolean isOpaqueCube()
{
return false;
}
@Override
public boolean renderAsNormalBlock()
{
return false;
}
}

View file

@ -0,0 +1,33 @@
package com.builtbroken.assemblyline.machine;
import java.util.Set;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import universalelectricity.api.UniversalElectricity;
import com.builtbroken.assemblyline.AssemblyLine;
import com.builtbroken.common.Pair;
import com.builtbroken.minecraft.prefab.BlockMachine;
/** @author Archadia */
public class BlockScanner extends BlockMachine
{
public BlockScanner()
{
super(AssemblyLine.CONFIGURATION, "Machine_OreScanner", UniversalElectricity.machine);
}
@Override
public TileEntity createTileEntity(World world, int metadata)
{
return new TileScanner();
}
@Override
public void getTileEntities(int blockID, Set<Pair<String, Class<? extends TileEntity>>> list)
{
list.add(new Pair<String, Class<? extends TileEntity>>("TileOreScanner", TileScanner.class));
}
}

View file

@ -0,0 +1,52 @@
package com.builtbroken.assemblyline.machine;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
/** @author Archadia */
public class ContainerScanner extends Container
{
private TileScanner tileEnt;
public ContainerScanner(InventoryPlayer par1InventoryPlayer, TileScanner tile)
{
bindPlayerInventory(par1InventoryPlayer);
this.tileEnt = tile;
}
public void bindPlayerInventory(InventoryPlayer inv)
{
int i;
for (i = 0; i < 3; ++i)
{
for (int j = 0; j < 9; ++j)
{
this.addSlotToContainer(new Slot(inv, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
}
}
for (i = 0; i < 9; ++i)
{
this.addSlotToContainer(new Slot(inv, i, 8 + i * 18, 142));
}
}
@Override
public boolean canInteractWith(EntityPlayer par1EntityPlayer)
{
return true;
}
@Override
public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2)
{
return null;
}
}

View file

@ -0,0 +1,107 @@
package com.builtbroken.assemblyline.machine;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.ForgeDirection;
import universalelectricity.api.vector.Vector3;
import com.builtbroken.assemblyline.api.MachineMiningEvent;
import com.builtbroken.minecraft.helpers.InvInteractionHelper;
import com.builtbroken.minecraft.prefab.TileEntityEnergyMachine;
/** @author Archadia */
public class TileApertureExcavator extends TileEntityEnergyMachine
{
private InvInteractionHelper invExtractionHelper;
private int lastY = -1;
public TileApertureExcavator()
{
super(0, 3);
}
public InvInteractionHelper invHelper()
{
if (invExtractionHelper == null || invExtractionHelper.world != this.worldObj)
{
this.invExtractionHelper = new InvInteractionHelper(this.worldObj, new Vector3(this), new ArrayList<ItemStack>(), false);
}
return invExtractionHelper;
}
@Override
public void updateEntity()
{
//TODO catch player place events and prevent them from placing blocks in the path of the drill head. This will save us time in coding blocks to represent the drill shafts
super.updateEntity();
if (!worldObj.isRemote && this.isFunctioning())
{
if (this.ticks % 20 == 0)
{
excavate();
}
}
}
@Override
public boolean canFunction()
{
return super.canFunction() && this.worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord);
}
public void excavate()
{
if (lastY == -1)
{
lastY = this.yCoord - 1;
}
for (int y = this.yCoord - 1; y > 0 && y < this.yCoord; y--)
{
Vector3 target = new Vector3(this.xCoord, y, this.zCoord);
if (this.consumePower(150, false))
{
Block block = Block.blocksList[target.getBlockID(this.worldObj)];
if (MachineMiningEvent.doMachineMiningCheck(this.worldObj, target, this))
{
List<ItemStack> items = MachineMiningEvent.getItemsMined(this.worldObj, target, this);
if (items != null)
{
for (ItemStack stack : items)
{
this.dropItems(stack);
}
}
worldObj.setBlockToAir(target.intX(), target.intY(), target.intZ());
this.consumePower(150, true);
}
else if (block != null)
{
break;
}
if (y < this.lastY)
{
this.lastY = y;
break;
}
}
}
}
private void dropItems(ItemStack item)
{
if (item != null)
{
item = this.invHelper().storeItem(item, ForgeDirection.UP, ForgeDirection.NORTH, ForgeDirection.SOUTH, ForgeDirection.EAST, ForgeDirection.WEST);
if (item != null)
{
this.invHelper().throwItem(new Vector3(this).modifyPositionFromSide(ForgeDirection.UP), item);
item = null;
}
}
}
}

View file

@ -0,0 +1,133 @@
package com.builtbroken.assemblyline.machine;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTankInfo;
import net.minecraftforge.fluids.IFluidBlock;
import net.minecraftforge.fluids.IFluidHandler;
import universalelectricity.api.vector.Vector3;
import com.builtbroken.assemblyline.ALRecipeLoader;
import com.builtbroken.minecraft.fluid.EnumGas;
import com.builtbroken.minecraft.fluid.FluidHelper;
import com.builtbroken.minecraft.fluid.GasTank;
import com.builtbroken.minecraft.interfaces.IBlockActivated;
import com.builtbroken.minecraft.prefab.TileEntityEnergyMachine;
/** @author Archadia */
public class TileFracker extends TileEntityEnergyMachine implements IFluidHandler, IBlockActivated
{
public GasTank tank = new GasTank(10000);
boolean autoEmpty = false;
private Vector3 target;
public TileFracker()
{
super(0, 5);
}
@Override
public void updateEntity()
{
super.updateEntity();
if (!worldObj.isRemote)
{
if (this.ticks % 20 == 0)
{
frack();
System.out.println("Amt: " + tank.getFluidAmount());
}
}
if (!this.worldObj.isRemote && autoEmpty && this.tank != null && this.tank.getFluid() != null)
{
FluidHelper.fillTanksAllSides(this.worldObj, new Vector3(this), FluidHelper.getStack(this.tank.getFluid(), 600), true);
}
}
public void frack()
{
if (target == null)
{
target = new Vector3(xCoord, yCoord, zCoord);
}
if (target.intY() > 0)
{
if (this.getEnergyStored() >= 4)
{
target.translate(Vector3.DOWN());
int blockID = target.getBlockID(this.worldObj);
Block block = Block.blocksList[blockID];
if (block != null)
{
if (block instanceof IFluidBlock)
{
FluidStack stack = ((IFluidBlock) block).drain(this.worldObj, target.intX(), target.intY(), target.intZ(), false);
if (stack != null && stack.getFluid().getID() == EnumGas.NATURAL_GAS.getGas().getID())
{
tank.fill(new FluidStack(EnumGas.NATURAL_GAS.getGas(), 1000), true);
}
}
worldObj.setBlockToAir(target.intX(), target.intY(), target.intZ());
this.consumePower(2, true);
}
worldObj.setBlock(target.intX(), target.intY(), target.intZ(), ALRecipeLoader.frackingPipe.blockID);
this.consumePower(500, true);
}
}
}
public boolean onActivated(EntityPlayer entityPlayer)
{
entityPlayer.addChatMessage("Gas: " + tank.getFluidAmount());
return true;
}
@Override
public int fill(ForgeDirection from, FluidStack resource, boolean doFill)
{
return 0;
}
@Override
public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain)
{
if (resource != null)
{
if (tank != null && tank.getFluid() != null && tank.getFluid().containsFluid(resource))
{
return tank.drain(resource.amount, true);
}
}
return null;
}
@Override
public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain)
{
return this.tank != null && this.tank.getFluid() != null ? this.drain(from, FluidHelper.getStack(this.tank.getFluid(), maxDrain), doDrain) : null;
}
@Override
public boolean canFill(ForgeDirection from, Fluid fluid)
{
return false;
}
@Override
public boolean canDrain(ForgeDirection from, Fluid fluid)
{
return fluid != null && this.tank != null && this.tank.getFluid() != null && this.tank.getFluid().getFluid().equals(fluid);
}
@Override
public FluidTankInfo[] getTankInfo(ForgeDirection from)
{
return new FluidTankInfo[] { this.tank.getInfo() };
}
}

View file

@ -0,0 +1,8 @@
package com.builtbroken.assemblyline.machine;
import net.minecraft.tileentity.TileEntity;
/** @author Archadia */
public class TileFrackingPipe extends TileEntity {
}

View file

@ -0,0 +1,59 @@
package com.builtbroken.assemblyline.machine;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTankInfo;
import net.minecraftforge.fluids.IFluidHandler;
import com.builtbroken.minecraft.fluid.GasTank;
import com.builtbroken.minecraft.prefab.TileEntityMachine;
/**
* @author Archadia
*
*/
public class TileGasBurner extends TileEntityMachine implements IFluidHandler {
GasTank tank = new GasTank(5000);
public TileGasBurner() {
}
@Override
public int fill(ForgeDirection from, FluidStack resource, boolean doFill) {
if(resource != null) {
if(resource.getFluid().isGaseous()) {
return tank.fill(resource, doFill);
}
}
return 0;
}
@Override
public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) {
return null;
}
@Override
public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) {
return null;
}
@Override
public boolean canFill(ForgeDirection from, Fluid fluid) {
return true;
}
@Override
public boolean canDrain(ForgeDirection from, Fluid fluid) {
return false;
}
@Override
public FluidTankInfo[] getTankInfo(ForgeDirection from) {
return null;
}
}

View file

@ -0,0 +1,147 @@
package com.builtbroken.assemblyline.machine;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTank;
import net.minecraftforge.fluids.FluidTankInfo;
import net.minecraftforge.fluids.IFluidHandler;
import com.builtbroken.minecraft.fluid.EnumGas;
import com.builtbroken.minecraft.fluid.GasTank;
import com.builtbroken.minecraft.prefab.TileEntityAdvanced;
import com.builtbroken.minecraft.tilenetwork.ITileConnector.Connection;
/** Combustion engine that runs off of gas fluid such as methain, propain, and butane
*
* @author DarkGuardsman, Archadia */
public class TileGasCombustionEngine extends TileEntityAdvanced implements IFluidHandler
{
/** Tank which fuel is stored. */
protected GasTank fuelTank = new GasTank(1000);
/** Oil that that is used to keep the engine parts moving smoothly */
protected FluidTank oilTank = new FluidTank(1000);
/** Direction in which the engine is facing */
protected ForgeDirection face = ForgeDirection.UP;
float speed = 0.0f, spinUpSpeed = 20f, spinDownSpeed = 10f, maxSpeed = 1000f;
float force = 0.0f, appliedForce;
int animation = 0;
//TODO balance
int mbFuelPerTick = 10, tickPerOilDrain = 1000;
int damage = 0, maxDamage = 10;
@Override
public void updateEntity()
{
super.updateEntity();
if (damage >= maxDamage)
{
//TODO go boom
}
if (this.ticks % tickPerOilDrain == 0)
{
if (this.oilTank.drain(1, false) != null)
{
this.oilTank.drain(1, true);
}
else
{
damage += 1;
}
}
if (fuelTank.getFluid() != null && this.isValidFuel(fuelTank.getFluid()) && fuelTank.getFluidAmount() > mbFuelPerTick)
{
fuelTank.drain(mbFuelPerTick, true);
speed += spinUpSpeed;
}
else if (speed > 0)
{
this.speed -= spinDownSpeed;
if (speed < 0)
{
speed = 0;
}
}
}
public boolean isValidFuel(FluidStack stack)
{
return stack != null && stack.fluidID == FluidRegistry.getFluidID(EnumGas.METHANE.getGas().getName());
}
public boolean canTileConnect(Connection type, ForgeDirection dir)
{
if (type == Connection.FLUIDS && dir != face)
{
return true;
}
if (type == Connection.FORCE && (dir == face || dir == face.getOpposite()))
{
return true;
}
return false;
}
/* 8888888888888888888888888888888888888888888888888888888888888
* Force calculation stuff
* 888888888888888888888888888888888888888888888888888888888888 */
//TODO re-add
/* 8888888888888888888888888888888888888888888888888888888888888
*Fluid Tank Stuff
* 888888888888888888888888888888888888888888888888888888888888 */
@Override
public int fill(ForgeDirection from, FluidStack resource, boolean doFill)
{
if (from != face)
{
return fuelTank.fill(resource, doFill);
}
return 0;
}
@Override
public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain)
{
if (from != face && fuelTank.getFluid() != null && resource != null && fuelTank.getFluid().isFluidEqual(resource))
{
return fuelTank.drain(resource.amount, doDrain);
}
return null;
}
@Override
public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain)
{
if (from != face)
{
return fuelTank.drain(maxDrain, doDrain);
}
return null;
}
@Override
public boolean canFill(ForgeDirection from, Fluid fluid)
{
return from != face;
}
@Override
public boolean canDrain(ForgeDirection from, Fluid fluid)
{
return from != face;
}
@Override
public FluidTankInfo[] getTankInfo(ForgeDirection from)
{
if (from != face)
{
return new FluidTankInfo[] { fuelTank.getInfo() };
}
return null;
}
}

View file

@ -0,0 +1,171 @@
package com.builtbroken.assemblyline.machine;
import java.awt.Color;
import net.minecraft.network.packet.Packet;
import net.minecraft.util.DamageSource;
import net.minecraft.util.EnumMovingObjectType;
import net.minecraft.util.MovingObjectPosition;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.common.MinecraftForge;
import universalelectricity.api.vector.Vector3;
import com.builtbroken.minecraft.CoreRegistry;
import com.builtbroken.minecraft.LaserEvent;
import com.builtbroken.minecraft.helpers.RayTraceHelper;
import com.builtbroken.minecraft.network.PacketHandler;
import com.builtbroken.minecraft.prefab.TileEntityEnergyMachine;
import com.google.common.io.ByteArrayDataInput;
import cpw.mods.fml.common.network.Player;
/** @author Archadia */
public class TileLaserDrill extends TileEntityEnergyMachine
{
private Vector3 target;
private Vector3 hit;
private int hitTicks = 0;
private float yaw = 0;
private float pitch = 90;
private float range = 20;
public TileLaserDrill()
{
super(0, 4);
}
@Override
public boolean canFunction()
{
return super.canFunction();
}
@Override
public void updateEntity()
{
super.updateEntity();
if (this.ticks % 3 == 0 && this.isFunctioning())
{
if (this.consumePower(3, false))
{
this.fireLaser();
this.consumePower(2500, true);
}
}
}
public void rotateYaw(float by)
{
this.yaw += by;
if (!this.worldObj.isRemote)
{
PacketHandler.instance().sendPacketToClients(this.getDescriptionPacket(), this.worldObj, new Vector3(this), 64);
}
}
public float getYaw()
{
return this.yaw;
}
public void rotatePitch(float by)
{
this.pitch += by;
if (!this.worldObj.isRemote)
{
PacketHandler.instance().sendPacketToClients(this.getDescriptionPacket(), this.worldObj, new Vector3(this), 64);
}
}
@Override
public boolean simplePacket(String id, ByteArrayDataInput dis, Player player)
{
try
{
if (!super.simplePacket(id, dis, player) && this.worldObj.isRemote)
{
if (id.equalsIgnoreCase("Desc"))
{
this.functioning = dis.readBoolean();
this.yaw = dis.readFloat();
this.pitch = dis.readFloat();
return true;
}
}
}
catch (Exception e)
{
e.printStackTrace();
}
return false;
}
@Override
public Packet getDescriptionPacket()
{
return PacketHandler.instance().getTilePacket(this.getChannel(), "Desc", this, this.functioning, this.yaw, this.pitch);
}
public void fireLaser()
{
Vector3 start = RayTraceHelper.getPosFromRotation(new Vector3(this).translate(new Vector3(0.5, 0.7, 0.5)), .7f, yaw, pitch);
Vector3 hitSpot = RayTraceHelper.getPosFromRotation(start, range, yaw, pitch);
MovingObjectPosition hitPos = RayTraceHelper.ray_trace_do(this.worldObj, start.toVec3(), hitSpot.toVec3(), range, false);
if (hitPos != null)
{
LaserEvent event = new LaserEvent.LaserFireEvent(this, hitPos);
MinecraftForge.EVENT_BUS.post(event);
if (!worldObj.isRemote && !event.isCanceled() && this.worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord))
{
if (hitPos.typeOfHit == EnumMovingObjectType.ENTITY && hitPos.entityHit != null)
{
System.out.println("Entity hit by laser");
DamageSource damageSource = DamageSource.onFire;
hitPos.entityHit.attackEntityFrom(damageSource, 7);
hitPos.entityHit.setFire(8);
}
else if (hitPos.typeOfHit == EnumMovingObjectType.TILE)
{
if (this.hit != null && this.hit.equals(new Vector3(hitPos)) && !this.hit.equals(new Vector3(this)))
{
this.hitTicks++;
if (hitTicks >= 6)
{
LaserEvent.onBlockMinedByLaser(this.worldObj, this, this.hit);
this.hit = null;
this.hitTicks = 0;
}
}
else
{
this.hitTicks = 1;
this.hit = new Vector3(hitPos);
LaserEvent.onLaserHitBlock(this.worldObj, this, this.hit, ForgeDirection.UP);
}
}
}
hitSpot = new Vector3(hitPos.hitVec);
}
CoreRegistry.proxy().renderBeam(this.worldObj, start, hitSpot, Color.ORANGE, 3);
}
public Vector3 getTarget()
{
return this.target;
}
public void setTarget(Vector3 vec)
{
if (!this.worldObj.isRemote)
{
this.sendPowerUpdate();
}
}
}

View file

@ -0,0 +1,168 @@
package com.builtbroken.assemblyline.machine;
import java.awt.Color;
import net.minecraft.network.packet.Packet;
import net.minecraft.util.DamageSource;
import net.minecraft.util.EnumMovingObjectType;
import net.minecraft.util.MovingObjectPosition;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.common.MinecraftForge;
import universalelectricity.api.vector.Vector3;
import com.builtbroken.minecraft.CoreRegistry;
import com.builtbroken.minecraft.LaserEvent;
import com.builtbroken.minecraft.helpers.RayTraceHelper;
import com.builtbroken.minecraft.network.PacketHandler;
import com.builtbroken.minecraft.prefab.TileEntityEnergyMachine;
import com.google.common.io.ByteArrayDataInput;
import cpw.mods.fml.common.network.Player;
/** @author DarkGuardsman */
public class TileLaserSentry extends TileEntityEnergyMachine
{
private Vector3 target;
private Vector3 hit;
private int hitTicks = 0;
private float yaw = 0;
private float pitch = 0;
private float range = 20;
private float powerDrain = .1f;
@Override
public boolean canFunction()
{
return super.canFunction();
}
@Override
public void updateEntity()
{
super.updateEntity();
if (this.ticks % 3 == 0 && this.isFunctioning())
{
this.fireLaser();
}
}
public void rotateYaw(float by)
{
this.yaw += by;
if (!this.worldObj.isRemote)
{
PacketHandler.instance().sendPacketToClients(this.getDescriptionPacket(), this.worldObj, new Vector3(this), 64);
}
}
public float getYaw()
{
return this.yaw;
}
public void rotatePitch(float by)
{
this.pitch += by;
if (!this.worldObj.isRemote)
{
PacketHandler.instance().sendPacketToClients(this.getDescriptionPacket(), this.worldObj, new Vector3(this), 64);
}
}
@Override
public boolean simplePacket(String id, ByteArrayDataInput dis, Player player)
{
try
{
if (!super.simplePacket(id, dis, player) && this.worldObj.isRemote)
{
if (id.equalsIgnoreCase("Desc"))
{
this.functioning = dis.readBoolean();
this.yaw = dis.readFloat();
this.pitch = dis.readFloat();
return true;
}
}
}
catch (Exception e)
{
e.printStackTrace();
}
return false;
}
@Override
public Packet getDescriptionPacket()
{
return PacketHandler.instance().getTilePacket(this.getChannel(), "Desc", this, this.functioning, this.yaw, this.pitch);
}
public void fireLaser()
{
final Vector3 start = RayTraceHelper.getPosFromRotation(new Vector3(this.xCoord + 0.5, this.yCoord + 0.7, this.zCoord + 0.5), .7f, yaw, pitch);
Vector3 hitSpot = RayTraceHelper.getPosFromRotation(new Vector3(this.xCoord + 0.5, this.yCoord + 0.7, this.zCoord + 0.5), range, yaw, pitch);
MovingObjectPosition hitPos = RayTraceHelper.ray_trace_do(this.worldObj, start.toVec3(), hitSpot.toVec3(), range, false);
if (hitPos != null)
{
LaserEvent event = new LaserEvent.LaserFireEvent(this, hitPos);
MinecraftForge.EVENT_BUS.post(event);
if (!worldObj.isRemote && !event.isCanceled())
{
if (hitPos.typeOfHit == EnumMovingObjectType.ENTITY && hitPos.entityHit != null)
{
if (this.worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord))
{
DamageSource damageSource = DamageSource.onFire;
hitPos.entityHit.attackEntityFrom(damageSource, 7);
hitPos.entityHit.setFire(8);
}
}
else if (hitPos.typeOfHit == EnumMovingObjectType.TILE)
{
if (this.worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord))
{
if (this.hit != null && this.hit.equals(new Vector3(hitPos)) && !this.hit.equals(new Vector3(this)))
{
this.hitTicks++;
if (hitTicks >= 6)
{
LaserEvent.onBlockMinedByLaser(this.worldObj, this, this.hit);
this.hit = null;
this.hitTicks = 0;
}
}
else
{
this.hitTicks = 1;
this.hit = new Vector3(hitPos);
LaserEvent.onLaserHitBlock(this.worldObj, this, this.hit, ForgeDirection.UP);
}
}
}
}
hitSpot = new Vector3(hitPos.hitVec);
}
CoreRegistry.proxy().renderBeam(this.worldObj, start, hitSpot, this.worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord) ? Color.ORANGE : Color.blue, 3);
}
public Vector3 getTarget()
{
return this.target;
}
public void setTarget(Vector3 vec)
{
if (!this.worldObj.isRemote)
{
this.sendPowerUpdate();
}
}
}

View file

@ -0,0 +1,84 @@
package com.builtbroken.assemblyline.machine;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map.Entry;
import net.minecraftforge.common.ForgeDirection;
import universalelectricity.api.vector.Vector3;
import com.builtbroken.common.Pair;
import com.builtbroken.minecraft.prefab.TileEntityEnergyMachine;
/** @author Archadia, DarkCow */
public class TileScanner extends TileEntityEnergyMachine
{
private ArrayList<Integer> validTarget = new ArrayList<Integer>();
private Vector3 coord;
private Vector3 coordDown;
private Vector3 scanSize = new Vector3(15, 1, 15);
private Vector3 scanLocation;
public boolean enabled = true;
public TileScanner()
{
super(500); //500W
}
@Override
public void updateEntity()
{
super.updateEntity();
if (coord == null || this.xCoord != coord.intX() || this.yCoord != coord.intY() || this.zCoord != coord.intZ())
{
coord = new Vector3(this);
coordDown = coord.clone().translate(new Vector3(0, -1, 0));
}
if (!worldObj.isRemote)
{
for (byte i = 0; i < 5 && this.canFunction(); i++)
{
scanArea();
}
}
}
@Override
public boolean canFunction()
{
return super.canFunction() && this.enabled;
}
/** Scans the area for valid blocks */
protected void scanArea()
{
if (scanLocation == null)
{
this.scanLocation = this.coordDown.clone();
}
@SuppressWarnings("unchecked")
HashMap<Vector3, Pair<Integer, Integer>> blocks = BlockMapUtil.getBlocksInGrid(this.worldObj, this.coordDown, this.scanSize);
for (Entry<Vector3, Pair<Integer, Integer>> entry : blocks.entrySet())
{
int blockID = entry.getValue().left();
int meta = entry.getValue().right();
}
//Update pos logic
this.scanLocation.translate(new Vector3(0, -1, 0));
if (this.scanLocation.intY() == 0)
{
this.scanLocation = this.coordDown.clone();
}
//Do logic here to sort out the returned blocks with what you want
}
@Override
public boolean canConnect(ForgeDirection dir)
{
return true;
}
}