More Laser and Reactor work. Lasers work now, and Heat Generators generate energy from incident lasers, in order to test lasers. This is probably only temporary.
This commit is contained in:
parent
cdeb25803c
commit
cb2188580e
15 changed files with 202 additions and 7 deletions
|
@ -15,8 +15,9 @@ public class LaserManager
|
|||
|
||||
public static void fireLaser(Coord4D from, ForgeDirection direction, double energy, World world)
|
||||
{
|
||||
Coord4D rangeFrom = from.getFromSide(direction, 1);
|
||||
Coord4D to = from.getFromSide(direction, range);
|
||||
MovingObjectPosition mop = world.rayTraceBlocks(Vec3.createVectorHelper(from.xCoord, from.yCoord, from.zCoord), Vec3.createVectorHelper(to.xCoord, to.yCoord, to.zCoord));
|
||||
MovingObjectPosition mop = world.rayTraceBlocks(Vec3.createVectorHelper(rangeFrom.xCoord, rangeFrom.yCoord, rangeFrom.zCoord), Vec3.createVectorHelper(to.xCoord, to.yCoord, to.zCoord));
|
||||
|
||||
if(mop != null)
|
||||
{
|
||||
|
|
|
@ -191,7 +191,8 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IPer
|
|||
icons[5][2] = register.registerIcon("mekanism:SteelCasing");
|
||||
icons[9][0] = register.registerIcon("mekanism:SteelBlock");
|
||||
icons[9][1] = register.registerIcon("mekanism:SeismicVibrator");
|
||||
icons[13][0] = register.registerIcon("Mekanism:Laser");
|
||||
icons[13][0] = register.registerIcon("Mekanism:SteelCasing");
|
||||
icons[13][1] = register.registerIcon("Mekanism:Laser");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -467,6 +468,16 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IPer
|
|||
return icons[meta][0];
|
||||
}
|
||||
}
|
||||
else if(meta == 13)
|
||||
{
|
||||
if(side == 3)
|
||||
{
|
||||
return icons[meta][0];
|
||||
}
|
||||
else {
|
||||
return icons[meta][1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
|
@ -600,7 +611,7 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IPer
|
|||
return icons[metadata][2];
|
||||
}
|
||||
}
|
||||
else if(metadata == 9)
|
||||
else if(metadata == 9 || metadata == 13)
|
||||
{
|
||||
if(side == tileEntity.facing)
|
||||
{
|
||||
|
@ -834,7 +845,7 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IPer
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z)
|
||||
public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z, boolean willHarvest)
|
||||
{
|
||||
if(!player.capabilities.isCreativeMode && !world.isRemote && canHarvestBlock(player, world.getBlockMetadata(x, y, z)))
|
||||
{
|
||||
|
|
|
@ -3,6 +3,7 @@ package mekanism.common.tile;
|
|||
import mekanism.api.Coord4D;
|
||||
import mekanism.api.lasers.LaserManager;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityLaser extends TileEntityElectricBlock
|
||||
|
@ -12,14 +13,18 @@ public class TileEntityLaser extends TileEntityElectricBlock
|
|||
public TileEntityLaser()
|
||||
{
|
||||
super("Laser", 100000);
|
||||
inventory = new ItemStack[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate()
|
||||
{
|
||||
super.onUpdate();
|
||||
|
||||
if(getEnergy() >= LASER_ENERGY)
|
||||
{
|
||||
LaserManager.fireLaser(Coord4D.get(this), ForgeDirection.getOrientation(facing), LASER_ENERGY, worldObj);
|
||||
setEnergy(getEnergy()-LASER_ENERGY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,6 +12,13 @@ import mekanism.generators.common.tile.TileEntityHeatGenerator;
|
|||
import mekanism.generators.common.tile.TileEntityGasGenerator;
|
||||
import mekanism.generators.common.tile.TileEntitySolarGenerator;
|
||||
import mekanism.generators.common.tile.TileEntityWindTurbine;
|
||||
import mekanism.generators.common.tile.reactor.TileEntityReactorController;
|
||||
import mekanism.generators.common.tile.reactor.TileEntityReactorFrame;
|
||||
import mekanism.generators.common.tile.reactor.TileEntityReactorGlass;
|
||||
import mekanism.generators.common.tile.reactor.TileEntityReactorLaserFocusMatrix;
|
||||
import mekanism.generators.common.tile.reactor.TileEntityReactorNeutronCapture;
|
||||
import mekanism.generators.common.tile.reactor.TileEntityReactorPort;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
@ -25,6 +32,19 @@ import cpw.mods.fml.common.registry.GameRegistry;
|
|||
*/
|
||||
public class GeneratorsCommonProxy
|
||||
{
|
||||
/**
|
||||
* Register normal tile entities
|
||||
*/
|
||||
public void registerRegularTileEntities()
|
||||
{
|
||||
GameRegistry.registerTileEntity(TileEntityReactorController.class, "ReactorController");
|
||||
GameRegistry.registerTileEntity(TileEntityReactorFrame.class, "ReactorFrame");
|
||||
GameRegistry.registerTileEntity(TileEntityReactorGlass.class, "ReactorGlass");
|
||||
GameRegistry.registerTileEntity(TileEntityReactorLaserFocusMatrix.class, "ReactorLaserFocus");
|
||||
GameRegistry.registerTileEntity(TileEntityReactorNeutronCapture.class, "ReactorNeutronCapture");
|
||||
GameRegistry.registerTileEntity(TileEntityReactorPort.class, "ReactorPort");
|
||||
}
|
||||
|
||||
/**
|
||||
* Register tile entities that have special models. Overwritten in client to register TESRs.
|
||||
*/
|
||||
|
|
|
@ -15,6 +15,8 @@ import mekanism.common.recipe.MekanismRecipe;
|
|||
import mekanism.generators.common.block.BlockGenerator;
|
||||
import mekanism.generators.common.block.BlockReactor;
|
||||
import mekanism.generators.common.item.ItemBlockGenerator;
|
||||
import mekanism.generators.common.item.ItemBlockReactor;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
|
@ -96,6 +98,7 @@ public class MekanismGenerators implements IModule
|
|||
|
||||
//Load the proxy
|
||||
proxy.loadConfiguration();
|
||||
proxy.registerRegularTileEntities();
|
||||
proxy.registerSpecialTileEntities();
|
||||
proxy.registerRenderInformation();
|
||||
|
||||
|
@ -143,7 +146,7 @@ public class MekanismGenerators implements IModule
|
|||
Reactor = new BlockReactor().setBlockName("Reactor");
|
||||
|
||||
GameRegistry.registerBlock(Generator, ItemBlockGenerator.class, "Generator");
|
||||
GameRegistry.registerBlock(Reactor, "Reactor");
|
||||
GameRegistry.registerBlock(Reactor, ItemBlockReactor.class, "Reactor");
|
||||
}
|
||||
|
||||
public void addItems()
|
||||
|
|
|
@ -16,6 +16,7 @@ import mekanism.common.util.MekanismUtils;
|
|||
import mekanism.generators.client.GeneratorsClientProxy;
|
||||
import mekanism.generators.common.MekanismGenerators;
|
||||
import mekanism.generators.common.tile.TileEntitySolarGenerator;
|
||||
import mekanism.generators.common.tile.reactor.TileEntityReactorBlock;
|
||||
import mekanism.generators.common.tile.reactor.TileEntityReactorController;
|
||||
import mekanism.generators.common.tile.reactor.TileEntityReactorFrame;
|
||||
import mekanism.generators.common.tile.reactor.TileEntityReactorGlass;
|
||||
|
@ -34,6 +35,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
|||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
@ -47,6 +49,8 @@ import buildcraft.api.tools.IToolWrench;
|
|||
|
||||
public class BlockReactor extends BlockContainer
|
||||
{
|
||||
public IIcon[][] icons = new IIcon[16][16];
|
||||
|
||||
public BlockReactor()
|
||||
{
|
||||
super(Material.iron);
|
||||
|
@ -55,6 +59,70 @@ public class BlockReactor extends BlockContainer
|
|||
setCreativeTab(Mekanism.tabMekanism);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister register)
|
||||
{
|
||||
if(this == MekanismGenerators.Reactor)
|
||||
{
|
||||
icons[0][0] = register.registerIcon("mekanism:ReactorControllerOff");
|
||||
icons[0][1] = register.registerIcon("mekanism:ReactorControllerOn");
|
||||
icons[0][2] = register.registerIcon("mekanism:ReactorFrame");
|
||||
icons[1][0] = register.registerIcon("mekanism:ReactorFrame");
|
||||
icons[2][0] = register.registerIcon("mekanism:ReactorGlass");
|
||||
icons[3][0] = register.registerIcon("mekanism:ReactorLaserFocus");
|
||||
icons[4][0] = register.registerIcon("mekanism:ReactorNeutronCapture");
|
||||
icons[5][0] = register.registerIcon("mekanism:ReactorPort");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta)
|
||||
{
|
||||
if(this == MekanismGenerators.Reactor)
|
||||
{
|
||||
if(meta == 0)
|
||||
{
|
||||
return icons[0][side == 6 ? 0 : 2];
|
||||
}
|
||||
else
|
||||
{
|
||||
return icons[meta][0];
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side)
|
||||
{
|
||||
int metadata = world.getBlockMetadata(x, y, z);
|
||||
TileEntityReactorBlock tileEntity = (TileEntityReactorBlock)world.getTileEntity(x, y, z);
|
||||
|
||||
if(this == MekanismGenerators.Reactor)
|
||||
{
|
||||
if(metadata == 0)
|
||||
{
|
||||
if(side == 1)
|
||||
{
|
||||
return MekanismUtils.isActive(world, x, y, z) ? icons[0][1] : icons[0][0];
|
||||
}
|
||||
else {
|
||||
return icons[0][2];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return icons[metadata][0];
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int i)
|
||||
{
|
||||
|
|
|
@ -0,0 +1,61 @@
|
|||
package mekanism.generators.common.item;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import mekanism.api.EnumColor;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import mekanism.generators.common.block.BlockReactor.ReactorBlockType;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
public class ItemBlockReactor extends ItemBlock
|
||||
{
|
||||
public Block metaBlock;
|
||||
|
||||
public ItemBlockReactor(Block block)
|
||||
{
|
||||
super(block);
|
||||
metaBlock = block;
|
||||
setHasSubtypes(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetadata(int i)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIconFromDamage(int i)
|
||||
{
|
||||
return metaBlock.getIcon(2, i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack itemstack)
|
||||
{
|
||||
return getUnlocalizedName() + "." + ReactorBlockType.getFromMetadata(itemstack.getItemDamage()).name;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack itemstack, EntityPlayer entityplayer, List list, boolean flag)
|
||||
{
|
||||
ReactorBlockType type = ReactorBlockType.getFromMetadata(itemstack.getItemDamage());
|
||||
|
||||
if(!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
|
||||
{
|
||||
list.add(MekanismUtils.localize("tooltip.hold") + " " + EnumColor.INDIGO + "shift" + EnumColor.GREY + " " + MekanismUtils.localize("tooltip.forDetails") + ".");
|
||||
}
|
||||
else {
|
||||
list.addAll(MekanismUtils.splitLines(type.getDescription()));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -4,6 +4,7 @@ import io.netty.buffer.ByteBuf;
|
|||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import mekanism.api.lasers.ILaserReceptor;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.util.ChargeUtils;
|
||||
import mekanism.common.util.FluidContainerUtils;
|
||||
|
@ -27,7 +28,7 @@ import cpw.mods.fml.common.Optional.Method;
|
|||
import dan200.computercraft.api.lua.ILuaContext;
|
||||
import dan200.computercraft.api.peripheral.IComputerAccess;
|
||||
|
||||
public class TileEntityHeatGenerator extends TileEntityGenerator implements IFluidHandler
|
||||
public class TileEntityHeatGenerator extends TileEntityGenerator implements IFluidHandler, ILaserReceptor
|
||||
{
|
||||
/** The FluidTank for this generator. */
|
||||
public FluidTank lavaTank = new FluidTank(24000);
|
||||
|
@ -335,4 +336,22 @@ public class TileEntityHeatGenerator extends TileEntityGenerator implements IFlu
|
|||
{
|
||||
return new FluidTankInfo[] {lavaTank.getInfo()};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveLaserEnergy(double energy, ForgeDirection side)
|
||||
{
|
||||
setEnergy(getEnergy()+energy);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canLasersDig()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double energyToDig()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import mekanism.api.gas.Gas;
|
|||
import mekanism.api.gas.GasRegistry;
|
||||
import mekanism.api.gas.GasStack;
|
||||
import mekanism.api.gas.IGasHandler;
|
||||
import mekanism.api.gas.ITubeConnection;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
|
@ -12,7 +13,7 @@ import net.minecraftforge.fluids.FluidStack;
|
|||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
|
||||
public class TileEntityReactorPort extends TileEntityReactorBlock implements IFluidHandler, IGasHandler
|
||||
public class TileEntityReactorPort extends TileEntityReactorBlock implements IFluidHandler, IGasHandler, ITubeConnection
|
||||
{
|
||||
@Override
|
||||
public boolean isFrame()
|
||||
|
@ -118,4 +119,10 @@ public class TileEntityReactorPort extends TileEntityReactorBlock implements IFl
|
|||
{
|
||||
return (type == GasRegistry.getGas("steam"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canTubeConnect(ForgeDirection side)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
Loading…
Reference in a new issue