I accidentally a linear autominer.
Might make a really basic laser redirection block next - none of the refined controls of the Amplifier, none of the collection abilities of the Tractor Beam.
This commit is contained in:
parent
90f2086990
commit
44d852ee9b
18 changed files with 437 additions and 30 deletions
|
@ -32,6 +32,7 @@ import mekanism.client.gui.GuiFactory;
|
|||
import mekanism.client.gui.GuiFluidicPlenisher;
|
||||
import mekanism.client.gui.GuiGasTank;
|
||||
import mekanism.client.gui.GuiLaserAmplifier;
|
||||
import mekanism.client.gui.GuiLaserTractorBeam;
|
||||
import mekanism.client.gui.GuiMetallurgicInfuser;
|
||||
import mekanism.client.gui.GuiOsmiumCompressor;
|
||||
import mekanism.client.gui.GuiPRC;
|
||||
|
@ -82,6 +83,7 @@ import mekanism.client.render.tileentity.RenderFluidicPlenisher;
|
|||
import mekanism.client.render.tileentity.RenderGasTank;
|
||||
import mekanism.client.render.tileentity.RenderLaser;
|
||||
import mekanism.client.render.tileentity.RenderLaserAmplifier;
|
||||
import mekanism.client.render.tileentity.RenderLaserTractorBeam;
|
||||
import mekanism.client.render.tileentity.RenderLogisticalSorter;
|
||||
import mekanism.client.render.tileentity.RenderMetallurgicInfuser;
|
||||
import mekanism.client.render.tileentity.RenderObsidianTNT;
|
||||
|
@ -137,6 +139,7 @@ import mekanism.common.tile.TileEntityFluidicPlenisher;
|
|||
import mekanism.common.tile.TileEntityGasTank;
|
||||
import mekanism.common.tile.TileEntityLaser;
|
||||
import mekanism.common.tile.TileEntityLaserAmplifier;
|
||||
import mekanism.common.tile.TileEntityLaserTractorBeam;
|
||||
import mekanism.common.tile.TileEntityLogisticalSorter;
|
||||
import mekanism.common.tile.TileEntityMetallurgicInfuser;
|
||||
import mekanism.common.tile.TileEntityMultiblock;
|
||||
|
@ -304,6 +307,7 @@ public class ClientProxy extends CommonProxy
|
|||
ClientRegistry.registerTileEntity(TileEntityFluidicPlenisher.class, "FluidicPlenisher", new RenderFluidicPlenisher());
|
||||
ClientRegistry.registerTileEntity(TileEntityLaser.class, "Laser", new RenderLaser());
|
||||
ClientRegistry.registerTileEntity(TileEntityLaserAmplifier.class, "LaserAmplifier", new RenderLaserAmplifier());
|
||||
ClientRegistry.registerTileEntity(TileEntityLaserTractorBeam.class, "LaserTractorBeam", new RenderLaserTractorBeam());
|
||||
GameRegistry.registerTileEntity(TileEntityAmbientAccumulator.class, "AmbientAccumulator");
|
||||
}
|
||||
|
||||
|
@ -467,9 +471,11 @@ public class ClientProxy extends CommonProxy
|
|||
case 44:
|
||||
return new GuiLaserAmplifier(player.inventory, (TileEntityLaserAmplifier)tileEntity);
|
||||
case 45:
|
||||
return new GuiEntangledBlock(player.inventory, (TileEntityEntangledBlock)tileEntity);
|
||||
return new GuiLaserTractorBeam(player.inventory, (TileEntityLaserTractorBeam)tileEntity);
|
||||
case 46:
|
||||
return new GuiAmbientAccumulator(player, (TileEntityAmbientAccumulator)tileEntity);
|
||||
case 47:
|
||||
return new GuiEntangledBlock(player.inventory, (TileEntityEntangledBlock)tileEntity);
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
|
@ -60,7 +60,7 @@ public class GuiLaserAmplifier extends GuiMekanism
|
|||
{
|
||||
return "Stored: " + MekanismUtils.getEnergyDisplay(level);
|
||||
}
|
||||
}, Type.STANDARD, this, MekanismUtils.getResource(ResourceType.GUI, "GuiBlank.png"), 6, 16));
|
||||
}, Type.STANDARD, this, MekanismUtils.getResource(ResourceType.GUI, "GuiBlank.png"), 6, 10));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
42
src/main/java/mekanism/client/gui/GuiLaserTractorBeam.java
Normal file
42
src/main/java/mekanism/client/gui/GuiLaserTractorBeam.java
Normal file
|
@ -0,0 +1,42 @@
|
|||
package mekanism.client.gui;
|
||||
|
||||
import mekanism.common.inventory.container.ContainerLaserTractorBeam;
|
||||
import mekanism.common.tile.TileEntityLaserTractorBeam;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import mekanism.common.util.MekanismUtils.ResourceType;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class GuiLaserTractorBeam extends GuiMekanism
|
||||
{
|
||||
public TileEntityLaserTractorBeam tileEntity;
|
||||
|
||||
public GuiLaserTractorBeam(InventoryPlayer inventory, TileEntityLaserTractorBeam tentity)
|
||||
{
|
||||
super(tentity, new ContainerLaserTractorBeam(inventory, tentity));
|
||||
tileEntity = tentity;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
|
||||
{
|
||||
fontRendererObj.drawString(tileEntity.getInventoryName(), (xSize/2)-(fontRendererObj.getStringWidth(tileEntity.getInventoryName())/2), 6, 0x404040);
|
||||
fontRendererObj.drawString(MekanismUtils.localize("container.inventory"), 8, (ySize - 96) + 2, 0x404040);
|
||||
|
||||
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float partialTick, int mouseX, int mouseY)
|
||||
{
|
||||
mc.renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.GUI, "GuiFullInv.png"));
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
int guiWidth = (width - xSize) / 2;
|
||||
int guiHeight = (height - ySize) / 2;
|
||||
drawTexturedModalRect(guiWidth, guiHeight, 0, 0, xSize, ySize);
|
||||
|
||||
super.drawGuiContainerBackgroundLayer(partialTick, mouseX, mouseY);
|
||||
}
|
||||
}
|
|
@ -203,6 +203,14 @@ public class MachineRenderingHandler implements ISimpleBlockRenderingHandler
|
|||
Minecraft.getMinecraft().renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "LaserAmplifier.png"));
|
||||
laserAmplifier.render(0.0560F);
|
||||
}
|
||||
else if(type == MachineType.LASER_TRACTOR_BEAM)
|
||||
{
|
||||
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
|
||||
GL11.glRotatef(90F, 0.0F, -1.0F, 0.0F);
|
||||
GL11.glTranslatef(0.0F, -0.85F, 0.0F);
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "LaserTractorBeam.png"));
|
||||
laserAmplifier.render(0.0560F);
|
||||
}
|
||||
else {
|
||||
MekanismRenderer.renderItem(renderer, metadata, block);
|
||||
}
|
||||
|
|
|
@ -33,29 +33,29 @@ public class RenderLaserAmplifier extends TileEntitySpecialRenderer
|
|||
|
||||
switch(tileEntity.facing)
|
||||
{
|
||||
case 0:
|
||||
case 0:
|
||||
GL11.glTranslatef(0.0F, -2.0F, 0.0F);
|
||||
GL11.glRotatef(180F, 1.0F, 0.0F, 0.0F);
|
||||
GL11.glRotatef(180F, 1.0F, 0.0F, 0.0F);
|
||||
break;
|
||||
case 5:
|
||||
case 5:
|
||||
GL11.glTranslatef(0.0F, -1.0F, 0.0F);
|
||||
GL11.glTranslatef(1.0F, 0.0F, 0.0F);
|
||||
GL11.glRotatef(90, 0.0F, 0.0F, -1.0F);
|
||||
GL11.glRotatef(90, 0.0F, 0.0F, -1.0F);
|
||||
break;
|
||||
case 4:
|
||||
case 4:
|
||||
GL11.glTranslatef(0.0F, -1.0F, 0.0F);
|
||||
GL11.glTranslatef(-1.0F, 0.0F, 0.0F);
|
||||
GL11.glRotatef(90, 0.0F, 0.0F, 1.0F);
|
||||
GL11.glRotatef(90, 0.0F, 0.0F, 1.0F);
|
||||
break;
|
||||
case 2:
|
||||
case 2:
|
||||
GL11.glTranslatef(0.0F, -1.0F, 0.0F);
|
||||
GL11.glTranslatef(0.0F, 0.0F, -1.0F);
|
||||
GL11.glRotatef(90, -1.0F, 0.0F, 0.0F);
|
||||
GL11.glRotatef(90, -1.0F, 0.0F, 0.0F);
|
||||
break;
|
||||
case 3:
|
||||
case 3:
|
||||
GL11.glTranslatef(0.0F, -1.0F, 0.0F);
|
||||
GL11.glTranslatef(0.0F, 0.0F, 1.0F);
|
||||
GL11.glRotatef(90, 1.0F, 0.0F, 0.0F);
|
||||
GL11.glRotatef(90, 1.0F, 0.0F, 0.0F);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,65 @@
|
|||
package mekanism.client.render.tileentity;
|
||||
|
||||
import mekanism.client.model.ModelLaserAmplifier;
|
||||
import mekanism.client.render.MekanismRenderer;
|
||||
import mekanism.common.tile.TileEntityLaserTractorBeam;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import mekanism.common.util.MekanismUtils.ResourceType;
|
||||
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class RenderLaserTractorBeam extends TileEntitySpecialRenderer
|
||||
{
|
||||
private ModelLaserAmplifier model = new ModelLaserAmplifier();
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float partialTick)
|
||||
{
|
||||
renderAModelAt((TileEntityLaserTractorBeam)tileEntity, x, y, z, partialTick);
|
||||
}
|
||||
|
||||
private void renderAModelAt(TileEntityLaserTractorBeam tileEntity, double x, double y, double z, float partialTick)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float)x + 0.5F, (float)y + 1.5F, (float)z + 0.5F);
|
||||
|
||||
bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "LaserTractorBeam.png"));
|
||||
|
||||
switch(tileEntity.facing)
|
||||
{
|
||||
case 0:
|
||||
GL11.glTranslatef(0.0F, -2.0F, 0.0F);
|
||||
GL11.glRotatef(180F, 1.0F, 0.0F, 0.0F);
|
||||
break;
|
||||
case 5:
|
||||
GL11.glTranslatef(0.0F, -1.0F, 0.0F);
|
||||
GL11.glTranslatef(1.0F, 0.0F, 0.0F);
|
||||
GL11.glRotatef(90, 0.0F, 0.0F, -1.0F);
|
||||
break;
|
||||
case 4:
|
||||
GL11.glTranslatef(0.0F, -1.0F, 0.0F);
|
||||
GL11.glTranslatef(-1.0F, 0.0F, 0.0F);
|
||||
GL11.glRotatef(90, 0.0F, 0.0F, 1.0F);
|
||||
break;
|
||||
case 2:
|
||||
GL11.glTranslatef(0.0F, -1.0F, 0.0F);
|
||||
GL11.glTranslatef(0.0F, 0.0F, -1.0F);
|
||||
GL11.glRotatef(90, -1.0F, 0.0F, 0.0F);
|
||||
break;
|
||||
case 3:
|
||||
GL11.glTranslatef(0.0F, -1.0F, 0.0F);
|
||||
GL11.glTranslatef(0.0F, 0.0F, 1.0F);
|
||||
GL11.glRotatef(90, 1.0F, 0.0F, 0.0F);
|
||||
break;
|
||||
}
|
||||
|
||||
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
|
||||
MekanismRenderer.blendOn();
|
||||
model.render(0.0625F);
|
||||
MekanismRenderer.blendOff();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
|
@ -28,6 +28,8 @@ import mekanism.common.inventory.container.ContainerFactory;
|
|||
import mekanism.common.inventory.container.ContainerFilter;
|
||||
import mekanism.common.inventory.container.ContainerFluidicPlenisher;
|
||||
import mekanism.common.inventory.container.ContainerGasTank;
|
||||
import mekanism.common.inventory.container.ContainerLaserAmplifier;
|
||||
import mekanism.common.inventory.container.ContainerLaserTractorBeam;
|
||||
import mekanism.common.inventory.container.ContainerMetallurgicInfuser;
|
||||
import mekanism.common.inventory.container.ContainerNull;
|
||||
import mekanism.common.inventory.container.ContainerPRC;
|
||||
|
@ -73,6 +75,7 @@ import mekanism.common.tile.TileEntityFluidicPlenisher;
|
|||
import mekanism.common.tile.TileEntityGasTank;
|
||||
import mekanism.common.tile.TileEntityLaser;
|
||||
import mekanism.common.tile.TileEntityLaserAmplifier;
|
||||
import mekanism.common.tile.TileEntityLaserTractorBeam;
|
||||
import mekanism.common.tile.TileEntityLogisticalSorter;
|
||||
import mekanism.common.tile.TileEntityMetallurgicInfuser;
|
||||
import mekanism.common.tile.TileEntityMultiblock;
|
||||
|
@ -150,7 +153,8 @@ public class CommonProxy
|
|||
GameRegistry.registerTileEntity(TileEntityFluidicPlenisher.class, "FluidicPlenisher");
|
||||
GameRegistry.registerTileEntity(TileEntityLaser.class, "Laser");
|
||||
GameRegistry.registerTileEntity(TileEntityLaserAmplifier.class, "LaserAmplifier");
|
||||
GameRegistry.registerTileEntityWithAlternatives(TileEntityAmbientAccumulator.class, "AmbientAccumulator");
|
||||
GameRegistry.registerTileEntity(TileEntityLaserTractorBeam.class, "LaserTractorBeam");
|
||||
GameRegistry.registerTileEntity(TileEntityAmbientAccumulator.class, "AmbientAccumulator");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -415,8 +419,11 @@ public class CommonProxy
|
|||
case 43:
|
||||
return new ContainerUpgradeManagement(player.inventory, (IUpgradeTile)tileEntity);
|
||||
case 44:
|
||||
return new ContainerLaserAmplifier(player.inventory, (TileEntityLaserAmplifier)tileEntity);
|
||||
case 45:
|
||||
return new ContainerLaserTractorBeam(player.inventory, (TileEntityLaserTractorBeam)tileEntity);
|
||||
case 46:
|
||||
case 47:
|
||||
return new ContainerNull(player, (TileEntityContainerBlock)tileEntity);
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@ import mekanism.api.MekanismConfig.general;
|
|||
import mekanism.api.Pos3D;
|
||||
import mekanism.api.lasers.ILaserReceptor;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
|
|
|
@ -55,6 +55,7 @@ import mekanism.common.tile.TileEntityFactory;
|
|||
import mekanism.common.tile.TileEntityFluidicPlenisher;
|
||||
import mekanism.common.tile.TileEntityLaser;
|
||||
import mekanism.common.tile.TileEntityLaserAmplifier;
|
||||
import mekanism.common.tile.TileEntityLaserTractorBeam;
|
||||
import mekanism.common.tile.TileEntityLogisticalSorter;
|
||||
import mekanism.common.tile.TileEntityMetallurgicInfuser;
|
||||
import mekanism.common.tile.TileEntityOsmiumCompressor;
|
||||
|
@ -135,8 +136,9 @@ import dan200.computercraft.api.peripheral.IPeripheralProvider;
|
|||
* 1:12: Fluidic Plenisher
|
||||
* 1:13: Laser
|
||||
* 1:14: Laser Amplifier
|
||||
* 1:15: Entangled Block
|
||||
* 2:0: Ambient Accumulator
|
||||
* 1:15: Laser Tractor Beam
|
||||
* 2:0: Entangled Block
|
||||
* 2:1: Ambient Accumulator
|
||||
* @author AidanBrady
|
||||
*
|
||||
*/
|
||||
|
@ -199,10 +201,10 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IPer
|
|||
icons[5][0] = register.registerIcon("mekanism:PrecisionSawmillFrontOff");
|
||||
icons[5][1] = register.registerIcon("mekanism:PrecisionSawmillFrontOn");
|
||||
icons[5][2] = register.registerIcon("mekanism:SteelCasing");
|
||||
icons[15][0] = register.registerIcon("mekanism:SteelCasing");
|
||||
break;
|
||||
case MACHINE_BLOCK_3:
|
||||
icons[0][0] = register.registerIcon("mekanism:AmbientAccumulator");
|
||||
icons[1][0] = register.registerIcon("mekanism:SteelCasing");
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1065,8 +1067,9 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IPer
|
|||
FLUIDIC_PLENISHER(MachineBlock.MACHINE_BLOCK_2, 12, "FluidicPlenisher", 42, TileEntityFluidicPlenisher.class, true, true, false),
|
||||
LASER(MachineBlock.MACHINE_BLOCK_2, 13, "Laser", -1, TileEntityLaser.class, true, true, false),
|
||||
LASER_AMPLIFIER(MachineBlock.MACHINE_BLOCK_2, 14, "LaserAmplifier", 44, TileEntityLaserAmplifier.class, false, true, false),
|
||||
ENTANGLED_BLOCK(MachineBlock.MACHINE_BLOCK_2, 15, "EntangledBlock", 45, TileEntityEntangledBlock.class, true, false, false),
|
||||
AMBIENT_ACCUMULATOR(MachineBlock.MACHINE_BLOCK_3, 0, "AmbientAccumulator", 46, TileEntityAmbientAccumulator.class, true, false, false);
|
||||
LASER_TRACTOR_BEAM(MachineBlock.MACHINE_BLOCK_2, 15, "LaserTractorBeam", 45, TileEntityLaserTractorBeam.class, false, true, false),
|
||||
AMBIENT_ACCUMULATOR(MachineBlock.MACHINE_BLOCK_3, 0, "AmbientAccumulator", 46, TileEntityAmbientAccumulator.class, true, false, false),
|
||||
ENTANGLED_BLOCK(MachineBlock.MACHINE_BLOCK_3, 1, "EntangledBlock", 47, TileEntityEntangledBlock.class, true, false, false);
|
||||
|
||||
public MachineBlock typeBlock;
|
||||
public int meta;
|
||||
|
@ -1191,10 +1194,12 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IPer
|
|||
return usage.laserUsage;
|
||||
case LASER_AMPLIFIER:
|
||||
return 0;
|
||||
case ENTANGLED_BLOCK:
|
||||
case LASER_TRACTOR_BEAM:
|
||||
return 0;
|
||||
case AMBIENT_ACCUMULATOR:
|
||||
return 0;
|
||||
case ENTANGLED_BLOCK:
|
||||
return 0;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,58 @@
|
|||
package mekanism.common.inventory.container;
|
||||
|
||||
import mekanism.common.tile.TileEntityLaserTractorBeam;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.Slot;
|
||||
|
||||
public class ContainerLaserTractorBeam extends Container
|
||||
{
|
||||
private TileEntityLaserTractorBeam tileEntity;
|
||||
|
||||
public ContainerLaserTractorBeam(InventoryPlayer inventory, TileEntityLaserTractorBeam tentity)
|
||||
{
|
||||
tileEntity = tentity;
|
||||
int slotX;
|
||||
|
||||
for (slotX = 0; slotX < 9; slotX++)
|
||||
{
|
||||
for (int slotY = 0; slotY < 3; slotY++)
|
||||
{
|
||||
addSlotToContainer(new Slot(tentity, slotX + slotY * 9, 8 + slotX * 18, 16 + slotY * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for(slotX = 0; slotX < 9; slotX++)
|
||||
{
|
||||
for(int slotY = 0; slotY < 3; slotY++)
|
||||
{
|
||||
addSlotToContainer(new Slot(inventory, slotX + slotY * 9 + 9, 8 + slotX * 18, 84 + slotY * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for(slotX = 0; slotX < 9; slotX++)
|
||||
{
|
||||
addSlotToContainer(new Slot(inventory, slotX, 8 + slotX * 18, 142));
|
||||
}
|
||||
|
||||
tileEntity.open(inventory.player);
|
||||
tileEntity.openInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onContainerClosed(EntityPlayer entityplayer)
|
||||
{
|
||||
super.onContainerClosed(entityplayer);
|
||||
|
||||
tileEntity.close(entityplayer);
|
||||
tileEntity.closeInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer entityplayer)
|
||||
{
|
||||
return tileEntity.isUseableByPlayer(entityplayer);
|
||||
}
|
||||
}
|
|
@ -12,8 +12,6 @@ import mekanism.common.network.PacketTileEntity.TileEntityMessage;
|
|||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.particle.EffectRenderer;
|
||||
import net.minecraft.client.renderer.EntityRenderer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
|
|
|
@ -4,7 +4,6 @@ import java.util.ArrayList;
|
|||
|
||||
import mekanism.api.Coord4D;
|
||||
import mekanism.api.MekanismConfig.general;
|
||||
import mekanism.api.MekanismConfig.usage;
|
||||
import mekanism.api.lasers.ILaserReceptor;
|
||||
import mekanism.common.LaserManager;
|
||||
import mekanism.common.Mekanism;
|
||||
|
@ -62,7 +61,7 @@ public class TileEntityLaserAmplifier extends TileEntityContainerBlock implement
|
|||
{
|
||||
if(on)
|
||||
{
|
||||
LaserManager.fireLaserClient(this, ForgeDirection.getOrientation(facing), toFire(), worldObj);
|
||||
LaserManager.fireLaserClient(this, ForgeDirection.getOrientation(facing), lastFired, worldObj);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -80,14 +79,15 @@ public class TileEntityLaserAmplifier extends TileEntityContainerBlock implement
|
|||
|
||||
if(shouldFire() && toFire() > 0)
|
||||
{
|
||||
if(!on || toFire() != lastFired)
|
||||
double firing = toFire();
|
||||
|
||||
if(!on || firing != lastFired)
|
||||
{
|
||||
on = true;
|
||||
lastFired = firing;
|
||||
Mekanism.packetHandler.sendToAllAround(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())), Coord4D.get(this).getTargetPoint(50D));
|
||||
}
|
||||
|
||||
double firing = toFire();
|
||||
|
||||
MovingObjectPosition mop =LaserManager.fireLaser(this, ForgeDirection.getOrientation(facing), firing, worldObj);
|
||||
Coord4D hitCoord = mop == null ? null : new Coord4D(mop.blockX, mop.blockY, mop.blockZ);
|
||||
|
||||
|
@ -122,7 +122,6 @@ public class TileEntityLaserAmplifier extends TileEntityContainerBlock implement
|
|||
}
|
||||
|
||||
setEnergy(getEnergy() - firing);
|
||||
lastFired = firing;
|
||||
}
|
||||
else if(on)
|
||||
{
|
||||
|
@ -186,6 +185,7 @@ public class TileEntityLaserAmplifier extends TileEntityContainerBlock implement
|
|||
data.add(threshold);
|
||||
data.add(time);
|
||||
data.add(collectedEnergy);
|
||||
data.add(lastFired);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
@ -204,6 +204,7 @@ public class TileEntityLaserAmplifier extends TileEntityContainerBlock implement
|
|||
threshold = dataStream.readDouble();
|
||||
time = dataStream.readInt();
|
||||
collectedEnergy = dataStream.readDouble();
|
||||
lastFired = dataStream.readDouble();
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,204 @@
|
|||
package mekanism.common.tile;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import mekanism.api.Coord4D;
|
||||
import mekanism.api.MekanismConfig.general;
|
||||
import mekanism.api.lasers.ILaserReceptor;
|
||||
import mekanism.api.util.StackUtils;
|
||||
import mekanism.common.LaserManager;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
|
||||
import mekanism.common.util.InventoryUtils;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
public class TileEntityLaserTractorBeam extends TileEntityContainerBlock implements ILaserReceptor
|
||||
{
|
||||
public static final double MAX_ENERGY = 5E9;
|
||||
public double collectedEnergy = 0;
|
||||
public double lastFired = 0;
|
||||
|
||||
public boolean on = false;
|
||||
|
||||
public Coord4D digging;
|
||||
public double diggingProgress;
|
||||
|
||||
public static int[] availableSlotIDs = InventoryUtils.getIntRange(0, 26);
|
||||
|
||||
public TileEntityLaserTractorBeam()
|
||||
{
|
||||
super("LaserTractorBeam");
|
||||
inventory = new ItemStack[27];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveLaserEnergy(double energy, ForgeDirection side)
|
||||
{
|
||||
setEnergy(getEnergy() + energy);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canLasersDig()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate()
|
||||
{
|
||||
if(worldObj.isRemote)
|
||||
{
|
||||
if(on)
|
||||
{
|
||||
LaserManager.fireLaserClient(this, ForgeDirection.getOrientation(facing), lastFired, worldObj);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(collectedEnergy > 0)
|
||||
{
|
||||
double firing = collectedEnergy;
|
||||
|
||||
if(!on || firing != lastFired)
|
||||
{
|
||||
on = true;
|
||||
lastFired = firing;
|
||||
Mekanism.packetHandler.sendToAllAround(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())), Coord4D.get(this).getTargetPoint(50D));
|
||||
}
|
||||
|
||||
MovingObjectPosition mop = LaserManager.fireLaser(this, ForgeDirection.getOrientation(facing), firing, worldObj);
|
||||
Coord4D hitCoord = mop == null ? null : new Coord4D(mop.blockX, mop.blockY, mop.blockZ);
|
||||
|
||||
if(hitCoord == null || !hitCoord.equals(digging))
|
||||
{
|
||||
digging = hitCoord;
|
||||
diggingProgress = 0;
|
||||
}
|
||||
|
||||
if(hitCoord != null)
|
||||
{
|
||||
Block blockHit = hitCoord.getBlock(worldObj);
|
||||
TileEntity tileHit = hitCoord.getTileEntity(worldObj);
|
||||
float hardness = blockHit.getBlockHardness(worldObj, hitCoord.xCoord, hitCoord.yCoord, hitCoord.zCoord);
|
||||
if(!(hardness < 0 || (tileHit instanceof ILaserReceptor && !((ILaserReceptor)tileHit).canLasersDig())))
|
||||
{
|
||||
diggingProgress += firing;
|
||||
|
||||
if(diggingProgress >= hardness * general.laserEnergyNeededPerHardness)
|
||||
{
|
||||
List<ItemStack> drops = blockHit.getDrops(worldObj, hitCoord.xCoord, hitCoord.yCoord, hitCoord.zCoord, hitCoord.getMetadata(worldObj), 0);
|
||||
if(drops != null) receiveDrops(drops);
|
||||
blockHit.breakBlock(worldObj, hitCoord.xCoord, hitCoord.yCoord, hitCoord.zCoord, blockHit, hitCoord.getMetadata(worldObj));
|
||||
worldObj.setBlockToAir(hitCoord.xCoord, hitCoord.yCoord, hitCoord.zCoord);
|
||||
diggingProgress = 0;
|
||||
Minecraft.getMinecraft().effectRenderer.addBlockDestroyEffects(hitCoord.xCoord, hitCoord.yCoord, hitCoord.zCoord, blockHit, hitCoord.getMetadata(worldObj));
|
||||
}
|
||||
else
|
||||
{
|
||||
Minecraft.getMinecraft().effectRenderer.addBlockHitEffects(hitCoord.xCoord, hitCoord.yCoord, hitCoord.zCoord, mop);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
setEnergy(getEnergy() - firing);
|
||||
}
|
||||
else if(on)
|
||||
{
|
||||
on = false;
|
||||
Mekanism.packetHandler.sendToAllAround(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())), Coord4D.get(this).getTargetPoint(50D));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setEnergy(double energy)
|
||||
{
|
||||
collectedEnergy = Math.max(0, Math.min(energy, MAX_ENERGY));
|
||||
}
|
||||
|
||||
public double getEnergy()
|
||||
{
|
||||
return collectedEnergy;
|
||||
}
|
||||
|
||||
public void receiveDrops(List<ItemStack> drops)
|
||||
{
|
||||
outer:
|
||||
for(ItemStack drop : drops)
|
||||
{
|
||||
for(int i = 0; i < inventory.length; i++)
|
||||
{
|
||||
if(inventory[i] == null)
|
||||
{
|
||||
inventory[i] = drop;
|
||||
continue outer;
|
||||
}
|
||||
ItemStack slot = inventory[i];
|
||||
if(StackUtils.equalsWildcardWithNBT(slot, drop))
|
||||
{
|
||||
int change = Math.min(drop.stackSize, slot.getMaxStackSize() - slot.stackSize);
|
||||
slot.stackSize += change;
|
||||
drop.stackSize -= change;
|
||||
if(drop.stackSize <= 0) continue outer;
|
||||
}
|
||||
}
|
||||
dropItem(drop);
|
||||
}
|
||||
}
|
||||
|
||||
public void dropItem(ItemStack stack)
|
||||
{
|
||||
EntityItem item = new EntityItem(worldObj, xCoord + 0.5, yCoord + 1, zCoord + 0.5, stack);
|
||||
item.motionX = worldObj.rand.nextGaussian() * 0.05;
|
||||
item.motionY = worldObj.rand.nextGaussian() * 0.05 + 0.2;
|
||||
item.motionZ = worldObj.rand.nextGaussian() * 0.05;
|
||||
item.delayBeforeCanPickup = 10;
|
||||
worldObj.spawnEntityInWorld(item);
|
||||
}
|
||||
|
||||
public boolean canInsertItem(int p_102007_1_, ItemStack p_102007_2_, int p_102007_3_)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public int[] getAccessibleSlotsFromSide(int p_94128_1_)
|
||||
{
|
||||
return availableSlotIDs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList getNetworkedData(ArrayList data)
|
||||
{
|
||||
super.getNetworkedData(data);
|
||||
|
||||
data.add(on);
|
||||
data.add(collectedEnergy);
|
||||
data.add(lastFired);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handlePacketData(ByteBuf dataStream)
|
||||
{
|
||||
if(worldObj.isRemote)
|
||||
{
|
||||
super.handlePacketData(dataStream);
|
||||
|
||||
on = dataStream.readBoolean();
|
||||
collectedEnergy = dataStream.readDouble();
|
||||
lastFired = dataStream.readDouble();
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -20,6 +20,18 @@ public final class InventoryUtils
|
|||
{
|
||||
public static final int[] EMPTY = new int[] {};
|
||||
|
||||
public static int[] getIntRange(int start, int end)
|
||||
{
|
||||
int[] ret = new int[1 + end - start];
|
||||
|
||||
for(int i = start; i <= end; i++)
|
||||
{
|
||||
ret[i - start] = i;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
public static IInventory checkChestInv(IInventory inv)
|
||||
{
|
||||
if(inv instanceof TileEntityChest)
|
||||
|
|
BIN
src/main/resources/assets/mekanism/gui/GuiFullInv.png
Normal file
BIN
src/main/resources/assets/mekanism/gui/GuiFullInv.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2 KiB |
|
@ -117,6 +117,7 @@ tile.MachineBlock2.PortableTank.name=Portable Tank
|
|||
tile.MachineBlock2.FluidicPlenisher.name=Fluidic Plenisher
|
||||
tile.MachineBlock2.Laser.name=Laser
|
||||
tile.MachineBlock2.LaserAmplifier.name=Laser Amplifier
|
||||
tile.MachineBlock2.LaserTractorBeam.name=Laser Tractor Beam
|
||||
|
||||
//Plastic
|
||||
tile.PlasticBlock.name=Plastic Block
|
||||
|
@ -574,8 +575,9 @@ tooltip.SeismicVibrator=A machine that uses seismic vibrations to !nprovide info
|
|||
tooltip.PressurizedReactionChamber=An advanced machine that processes a !nsolid, liquid and gaseous mixture and !ncreates both a gaseous and solid product.
|
||||
tooltip.PortableTank=A handy, portable tank that lets you !ncarry 14 buckets of fluid wherever you !nplease. Also doubles as a bucket!
|
||||
tooltip.FluidicPlenisher=A machine that is capable of creating entire !nlakes by filling ravines with fluids.
|
||||
tooltip.Laser=An advanced form of linear energy transfer that utilizes !nan extremely compressed beam of !nlight.
|
||||
tooltip.LaserAmplifier=A block that can be used to both merge !nand amplify laser beams.
|
||||
tooltip.Laser=An advanced form of linear energy!ntransfer that utilizes an extremely!ncollimated beam of light.
|
||||
tooltip.LaserAmplifier=A block that can be used to merge,!nredirect and amplify laser beams,!nwith fine controls over when to fire
|
||||
tooltip.LaserTractorBeam=A block used to merge and!nredirect laser beams. Collects!ndrops from blocks it has broken.
|
||||
|
||||
tooltip.HeatGenerator=A generator that uses the heat of lava or !nother burnable resources to produce energy.
|
||||
tooltip.SolarGenerator=A generator that uses the power !nof the sun to produce energy.
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 3.4 KiB |
BIN
src/main/resources/assets/mekanism/render/LaserTractorBeam.png
Normal file
BIN
src/main/resources/assets/mekanism/render/LaserTractorBeam.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.4 KiB |
Loading…
Add table
Reference in a new issue