Entity Detection mode for Laser Amplifier
This commit is contained in:
parent
e4d624d8ab
commit
c85bdcd8ab
36 changed files with 205 additions and 29 deletions
|
@ -8,6 +8,7 @@ import mekanism.client.gui.element.GuiEnergyInfo;
|
|||
import mekanism.client.gui.element.GuiEnergyInfo.IInfoHandler;
|
||||
import mekanism.client.gui.element.GuiPowerBar;
|
||||
import mekanism.client.gui.element.GuiProgress;
|
||||
import mekanism.client.gui.element.GuiRedstoneControl;
|
||||
import mekanism.client.gui.element.GuiProgress.IProgressInfoHandler;
|
||||
import mekanism.client.gui.element.GuiProgress.ProgressBar;
|
||||
import mekanism.client.gui.element.GuiSideConfigurationTab;
|
||||
|
|
|
@ -7,6 +7,7 @@ import mekanism.client.gui.element.GuiEnergyInfo;
|
|||
import mekanism.client.gui.element.GuiEnergyInfo.IInfoHandler;
|
||||
import mekanism.client.gui.element.GuiPowerBar;
|
||||
import mekanism.client.gui.element.GuiProgress;
|
||||
import mekanism.client.gui.element.GuiRedstoneControl;
|
||||
import mekanism.client.gui.element.GuiProgress.IProgressInfoHandler;
|
||||
import mekanism.client.gui.element.GuiProgress.ProgressBar;
|
||||
import mekanism.client.gui.element.GuiSideConfigurationTab;
|
||||
|
|
|
@ -15,6 +15,7 @@ import mekanism.client.gui.element.GuiGasGauge.IGasInfoHandler;
|
|||
import mekanism.client.gui.element.GuiGauge;
|
||||
import mekanism.client.gui.element.GuiPowerBar;
|
||||
import mekanism.client.gui.element.GuiProgress;
|
||||
import mekanism.client.gui.element.GuiRedstoneControl;
|
||||
import mekanism.client.gui.element.GuiProgress.IProgressInfoHandler;
|
||||
import mekanism.client.gui.element.GuiProgress.ProgressBar;
|
||||
import mekanism.client.gui.element.GuiSideConfigurationTab;
|
||||
|
|
|
@ -8,6 +8,7 @@ import mekanism.client.gui.element.GuiEnergyInfo;
|
|||
import mekanism.client.gui.element.GuiGasGauge;
|
||||
import mekanism.client.gui.element.GuiGauge;
|
||||
import mekanism.client.gui.element.GuiProgress;
|
||||
import mekanism.client.gui.element.GuiRedstoneControl;
|
||||
import mekanism.client.gui.element.GuiSlot;
|
||||
import mekanism.client.gui.element.GuiUpgradeTab;
|
||||
import mekanism.client.gui.element.GuiEnergyInfo.IInfoHandler;
|
||||
|
|
|
@ -10,6 +10,7 @@ import mekanism.client.gui.element.GuiEnergyInfo;
|
|||
import mekanism.client.gui.element.GuiGasGauge;
|
||||
import mekanism.client.gui.element.GuiGauge;
|
||||
import mekanism.client.gui.element.GuiProgress;
|
||||
import mekanism.client.gui.element.GuiRedstoneControl;
|
||||
import mekanism.client.gui.element.GuiSlot;
|
||||
import mekanism.client.gui.element.GuiUpgradeTab;
|
||||
import mekanism.client.gui.element.GuiEnergyInfo.IInfoHandler;
|
||||
|
|
|
@ -8,6 +8,7 @@ import mekanism.client.gui.element.GuiEnergyInfo;
|
|||
import mekanism.client.gui.element.GuiGasGauge;
|
||||
import mekanism.client.gui.element.GuiGauge;
|
||||
import mekanism.client.gui.element.GuiProgress;
|
||||
import mekanism.client.gui.element.GuiRedstoneControl;
|
||||
import mekanism.client.gui.element.GuiSlot;
|
||||
import mekanism.client.gui.element.GuiUpgradeTab;
|
||||
import mekanism.client.gui.element.GuiEnergyInfo.IInfoHandler;
|
||||
|
|
|
@ -12,6 +12,7 @@ import mekanism.client.gui.element.GuiFluidGauge;
|
|||
import mekanism.client.gui.element.GuiGasGauge;
|
||||
import mekanism.client.gui.element.GuiGauge;
|
||||
import mekanism.client.gui.element.GuiProgress;
|
||||
import mekanism.client.gui.element.GuiRedstoneControl;
|
||||
import mekanism.client.gui.element.GuiSlot;
|
||||
import mekanism.client.gui.element.GuiUpgradeTab;
|
||||
import mekanism.client.gui.element.GuiEnergyInfo.IInfoHandler;
|
||||
|
|
|
@ -8,6 +8,7 @@ import mekanism.api.EnumColor;
|
|||
import mekanism.api.util.ListUtils;
|
||||
import mekanism.client.gui.element.GuiEnergyInfo;
|
||||
import mekanism.client.gui.element.GuiPowerBar;
|
||||
import mekanism.client.gui.element.GuiRedstoneControl;
|
||||
import mekanism.client.gui.element.GuiSlot;
|
||||
import mekanism.client.gui.element.GuiUpgradeTab;
|
||||
import mekanism.client.gui.element.GuiVisualsTab;
|
||||
|
|
|
@ -3,6 +3,7 @@ package mekanism.client.gui;
|
|||
import java.util.List;
|
||||
|
||||
import mekanism.api.util.ListUtils;
|
||||
import mekanism.client.gui.element.GuiRedstoneControl;
|
||||
import mekanism.client.gui.element.GuiSideConfigurationTab;
|
||||
import mekanism.client.gui.element.GuiEnergyInfo;
|
||||
import mekanism.client.gui.element.GuiEnergyInfo.IInfoHandler;
|
||||
|
|
|
@ -3,6 +3,7 @@ package mekanism.client.gui;
|
|||
import mekanism.client.gui.element.GuiFluidGauge;
|
||||
import mekanism.client.gui.element.GuiGauge;
|
||||
import mekanism.client.gui.element.GuiPowerBar;
|
||||
import mekanism.client.gui.element.GuiRedstoneControl;
|
||||
import mekanism.client.gui.element.GuiSlot;
|
||||
import mekanism.client.gui.element.GuiUpgradeTab;
|
||||
import mekanism.client.gui.element.GuiFluidGauge.IFluidInfoHandler;
|
||||
|
|
|
@ -6,6 +6,7 @@ import mekanism.api.energy.IStrictEnergyStorage;
|
|||
import mekanism.api.util.ListUtils;
|
||||
import mekanism.client.gui.element.GuiEnergyGauge;
|
||||
import mekanism.client.gui.element.GuiEnergyInfo;
|
||||
import mekanism.client.gui.element.GuiRedstoneControl;
|
||||
import mekanism.client.gui.element.GuiSlot;
|
||||
import mekanism.client.gui.element.GuiEnergyGauge.IEnergyInfoHandler;
|
||||
import mekanism.client.gui.element.GuiEnergyInfo.IInfoHandler;
|
||||
|
|
|
@ -7,6 +7,7 @@ import mekanism.api.util.ListUtils;
|
|||
import mekanism.client.gui.element.GuiEnergyInfo;
|
||||
import mekanism.client.gui.element.GuiEnergyInfo.IInfoHandler;
|
||||
import mekanism.client.gui.element.GuiRecipeType;
|
||||
import mekanism.client.gui.element.GuiRedstoneControl;
|
||||
import mekanism.client.gui.element.GuiSideConfigurationTab;
|
||||
import mekanism.client.gui.element.GuiSortingTab;
|
||||
import mekanism.client.gui.element.GuiTransporterConfigTab;
|
||||
|
|
|
@ -3,6 +3,7 @@ package mekanism.client.gui;
|
|||
import java.util.ArrayList;
|
||||
|
||||
import mekanism.api.Coord4D;
|
||||
import mekanism.client.gui.element.GuiRedstoneControl;
|
||||
import mekanism.client.sound.SoundHandler;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.inventory.container.ContainerGasTank;
|
||||
|
|
|
@ -3,9 +3,11 @@ package mekanism.client.gui;
|
|||
import java.util.ArrayList;
|
||||
|
||||
import mekanism.api.Coord4D;
|
||||
import mekanism.client.gui.element.GuiNumberGauge;
|
||||
import mekanism.client.gui.element.GuiDetectionTab;
|
||||
import mekanism.client.gui.element.GuiGauge.Type;
|
||||
import mekanism.client.gui.element.GuiNumberGauge;
|
||||
import mekanism.client.gui.element.GuiNumberGauge.INumberInfoHandler;
|
||||
import mekanism.client.gui.element.GuiRedstoneControl;
|
||||
import mekanism.client.render.MekanismRenderer;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.inventory.container.ContainerLaserAmplifier;
|
||||
|
@ -16,12 +18,13 @@ import mekanism.common.util.MekanismUtils.ResourceType;
|
|||
import net.minecraft.client.gui.GuiTextField;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.IIcon;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiLaserAmplifier extends GuiMekanism
|
||||
{
|
||||
|
@ -63,6 +66,7 @@ public class GuiLaserAmplifier extends GuiMekanism
|
|||
}
|
||||
}, Type.STANDARD, this, MekanismUtils.getResource(ResourceType.GUI, "GuiBlank.png"), 6, 10));
|
||||
guiElements.add(new GuiRedstoneControl(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiBlank.png")));
|
||||
guiElements.add(new GuiDetectionTab(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiBlank.png")));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -9,6 +9,7 @@ import java.util.Set;
|
|||
|
||||
import mekanism.api.Coord4D;
|
||||
import mekanism.api.EnumColor;
|
||||
import mekanism.client.gui.element.GuiRedstoneControl;
|
||||
import mekanism.client.render.MekanismRenderer;
|
||||
import mekanism.client.sound.SoundHandler;
|
||||
import mekanism.common.Mekanism;
|
||||
|
@ -25,7 +26,6 @@ import mekanism.common.network.PacketTileEntity.TileEntityMessage;
|
|||
import mekanism.common.tile.TileEntityLogisticalSorter;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import mekanism.common.util.MekanismUtils.ResourceType;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
|
|
@ -9,6 +9,7 @@ import mekanism.client.gui.element.GuiEnergyInfo;
|
|||
import mekanism.client.gui.element.GuiEnergyInfo.IInfoHandler;
|
||||
import mekanism.client.gui.element.GuiPowerBar;
|
||||
import mekanism.client.gui.element.GuiProgress;
|
||||
import mekanism.client.gui.element.GuiRedstoneControl;
|
||||
import mekanism.client.gui.element.GuiProgress.IProgressInfoHandler;
|
||||
import mekanism.client.gui.element.GuiProgress.ProgressBar;
|
||||
import mekanism.client.gui.element.GuiSideConfigurationTab;
|
||||
|
|
|
@ -13,6 +13,7 @@ import mekanism.client.gui.element.GuiGasGauge.IGasInfoHandler;
|
|||
import mekanism.client.gui.element.GuiGauge;
|
||||
import mekanism.client.gui.element.GuiPowerBar;
|
||||
import mekanism.client.gui.element.GuiProgress;
|
||||
import mekanism.client.gui.element.GuiRedstoneControl;
|
||||
import mekanism.client.gui.element.GuiProgress.IProgressInfoHandler;
|
||||
import mekanism.client.gui.element.GuiProgress.ProgressBar;
|
||||
import mekanism.client.gui.element.GuiSideConfigurationTab;
|
||||
|
|
|
@ -11,6 +11,7 @@ import mekanism.client.gui.element.GuiFluidGauge;
|
|||
import mekanism.client.gui.element.GuiGasGauge;
|
||||
import mekanism.client.gui.element.GuiGauge;
|
||||
import mekanism.client.gui.element.GuiProgress;
|
||||
import mekanism.client.gui.element.GuiRedstoneControl;
|
||||
import mekanism.client.gui.element.GuiSlot;
|
||||
import mekanism.client.gui.element.GuiUpgradeTab;
|
||||
import mekanism.client.gui.element.GuiEnergyInfo.IInfoHandler;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package mekanism.client.gui;
|
||||
|
||||
import mekanism.client.gui.element.GuiPowerBar;
|
||||
import mekanism.client.gui.element.GuiRedstoneControl;
|
||||
import mekanism.client.gui.element.GuiSlot;
|
||||
import mekanism.client.gui.element.GuiSlot.SlotOverlay;
|
||||
import mekanism.client.gui.element.GuiSlot.SlotType;
|
||||
|
|
|
@ -4,6 +4,7 @@ import mekanism.api.gas.GasTank;
|
|||
import mekanism.client.gui.element.GuiGasGauge;
|
||||
import mekanism.client.gui.element.GuiGauge;
|
||||
import mekanism.client.gui.element.GuiProgress;
|
||||
import mekanism.client.gui.element.GuiRedstoneControl;
|
||||
import mekanism.client.gui.element.GuiSlot;
|
||||
import mekanism.client.gui.element.GuiGasGauge.IGasInfoHandler;
|
||||
import mekanism.client.gui.element.GuiProgress.IProgressInfoHandler;
|
||||
|
|
|
@ -0,0 +1,88 @@
|
|||
package mekanism.client.gui.element;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import mekanism.api.Coord4D;
|
||||
import mekanism.client.gui.IGuiWrapper;
|
||||
import mekanism.client.sound.SoundHandler;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
|
||||
import mekanism.common.tile.TileEntityLaserAmplifier;
|
||||
import mekanism.common.util.LangUtils;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import mekanism.common.util.MekanismUtils.ResourceType;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import codechicken.lib.vec.Rectangle4i;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiDetectionTab extends GuiElement
|
||||
{
|
||||
public TileEntity tileEntity;
|
||||
|
||||
public GuiDetectionTab(IGuiWrapper gui, TileEntity tile, ResourceLocation def)
|
||||
{
|
||||
super(MekanismUtils.getResource(ResourceType.GUI_ELEMENT, "GuiDetectionTab.png"), gui, def);
|
||||
|
||||
tileEntity = tile;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Rectangle4i getBounds(int guiWidth, int guiHeight)
|
||||
{
|
||||
return new Rectangle4i(guiWidth - 26, guiHeight + 138, 26, 26);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderBackground(int xAxis, int yAxis, int guiWidth, int guiHeight)
|
||||
{
|
||||
mc.renderEngine.bindTexture(RESOURCE);
|
||||
|
||||
guiObj.drawTexturedRect(guiWidth - 26, guiHeight + 138, 0, 0, 26, 26);
|
||||
|
||||
if(xAxis >= -21 && xAxis <= -3 && yAxis >= 142 && yAxis <= 160)
|
||||
{
|
||||
guiObj.drawTexturedRect(guiWidth - 21, guiHeight + 142, 26, 0, 18, 18);
|
||||
}
|
||||
else {
|
||||
guiObj.drawTexturedRect(guiWidth - 21, guiHeight + 142, 26, 18, 18, 18);
|
||||
}
|
||||
|
||||
mc.renderEngine.bindTexture(defaultLocation);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderForeground(int xAxis, int yAxis)
|
||||
{
|
||||
mc.renderEngine.bindTexture(RESOURCE);
|
||||
|
||||
if(xAxis >= -21 && xAxis <= -3 && yAxis >= 142 && yAxis <= 160)
|
||||
{
|
||||
String text = LangUtils.transOnOff(((TileEntityLaserAmplifier)tileEntity).entityDetection);
|
||||
displayTooltip(MekanismUtils.localize("gui.entityDetection") + ": " + text, xAxis, yAxis);
|
||||
}
|
||||
|
||||
mc.renderEngine.bindTexture(defaultLocation);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preMouseClicked(int xAxis, int yAxis, int button) {}
|
||||
|
||||
@Override
|
||||
public void mouseClicked(int xAxis, int yAxis, int button)
|
||||
{
|
||||
if(button == 0)
|
||||
{
|
||||
if(xAxis >= -21 && xAxis <= -3 && yAxis >= 142 && yAxis <= 160)
|
||||
{
|
||||
ArrayList data = new ArrayList();
|
||||
data.add(3);
|
||||
|
||||
Mekanism.packetHandler.sendToServer(new TileEntityMessage(Coord4D.get(tileEntity), data));
|
||||
SoundHandler.playSound("gui.button.press");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
package mekanism.client.gui;
|
||||
package mekanism.client.gui.element;
|
||||
|
||||
import mekanism.api.Coord4D;
|
||||
import mekanism.client.gui.element.GuiElement;
|
||||
import mekanism.client.gui.IGuiWrapper;
|
||||
import mekanism.client.sound.SoundHandler;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.base.IRedstoneControl;
|
|
@ -2,6 +2,8 @@ package mekanism.common;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import com.mojang.realmsclient.util.Pair;
|
||||
|
||||
import mekanism.api.Coord4D;
|
||||
import mekanism.api.MekanismConfig.general;
|
||||
import mekanism.api.Pos3D;
|
||||
|
@ -18,12 +20,12 @@ import net.minecraftforge.common.util.ForgeDirection;
|
|||
|
||||
public class LaserManager
|
||||
{
|
||||
public static MovingObjectPosition fireLaser(TileEntity from, ForgeDirection direction, double energy, World world)
|
||||
public static LaserInfo fireLaser(TileEntity from, ForgeDirection direction, double energy, World world)
|
||||
{
|
||||
return fireLaser(new Pos3D(from).centre().translate(direction, 0.501), direction, energy, world);
|
||||
}
|
||||
|
||||
public static MovingObjectPosition fireLaser(Pos3D from, ForgeDirection direction, double energy, World world)
|
||||
public static LaserInfo fireLaser(Pos3D from, ForgeDirection direction, double energy, World world)
|
||||
{
|
||||
Pos3D to = from.clone().translate(direction, general.laserRange - 0.002);
|
||||
|
||||
|
@ -47,16 +49,24 @@ public class LaserManager
|
|||
from.translateExcludingSide(direction, -0.1);
|
||||
to.translateExcludingSide(direction, 0.1);
|
||||
|
||||
boolean foundEntity = false;
|
||||
|
||||
for(Entity e : (List<Entity>)world.getEntitiesWithinAABB(Entity.class, Pos3D.getAABB(from, to)))
|
||||
{
|
||||
foundEntity = true;
|
||||
|
||||
if(!e.isImmuneToFire())
|
||||
{
|
||||
e.setFire((int)(energy / 1000));
|
||||
|
||||
if(energy > 256)
|
||||
{
|
||||
e.attackEntityFrom(DamageSource.onFire, (float)energy/1000F);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return mop;
|
||||
return new LaserInfo(mop, foundEntity);
|
||||
}
|
||||
|
||||
public static List<ItemStack> breakBlock(Coord4D blockCoord, boolean dropAtBlock, World world)
|
||||
|
@ -96,6 +106,20 @@ public class LaserManager
|
|||
|
||||
from.translate(direction, -0.501);
|
||||
Mekanism.proxy.renderLaser(world, from, to, direction, energy);
|
||||
|
||||
return mop;
|
||||
}
|
||||
|
||||
public static class LaserInfo
|
||||
{
|
||||
public MovingObjectPosition movingPos;
|
||||
|
||||
public boolean foundEntity;
|
||||
|
||||
public LaserInfo(MovingObjectPosition mop, boolean b)
|
||||
{
|
||||
movingPos = mop;
|
||||
foundEntity = b;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -488,7 +488,7 @@ public class Mekanism
|
|||
"RE ", "RCD", "RE ", Character.valueOf('R'), "alloyElite", Character.valueOf('E'), MekanismItems.EnergyTablet.getUnchargedItem(), Character.valueOf('C'), new ItemStack(MekanismBlocks.BasicBlock, 1, 8), Character.valueOf('D'), "gemDiamond"
|
||||
}));
|
||||
MachineType.LASER_AMPLIFIER.addRecipe(new MekanismRecipe(new ItemStack(MekanismBlocks.MachineBlock2, 1, 14), new Object[] {
|
||||
"SSS", "SED", "SSS", Character.valueOf('S'), "ingotSteel", Character.valueOf('E'), MekanismUtils.getInductionCell(InductionCellTier.ADVANCED), Character.valueOf('D'), "gemDiamond"
|
||||
"SSS", "SED", "SSS", Character.valueOf('S'), "ingotSteel", Character.valueOf('E'), MekanismUtils.getEnergyCube(EnergyCubeTier.BASIC), Character.valueOf('D'), "gemDiamond"
|
||||
}));
|
||||
MachineType.LASER_TRACTOR_BEAM.addRecipe(new MekanismRecipe(new ItemStack(MekanismBlocks.MachineBlock2, 1, 15), new Object[] {
|
||||
"C", "F", Character.valueOf('C'), new ItemStack(MekanismBlocks.MachineBlock, 1, 13), Character.valueOf('F'), new ItemStack(MekanismBlocks.MachineBlock2, 1, 14)
|
||||
|
|
|
@ -1390,6 +1390,19 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IPer
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int isProvidingWeakPower(IBlockAccess world, int x, int y, int z, int side)
|
||||
{
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
|
||||
if(tile instanceof TileEntityLaserAmplifier)
|
||||
{
|
||||
return ((TileEntityLaserAmplifier)tile).emittingRedstone ? 15 : 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CTMData getCTMData(IBlockAccess world, int x, int y, int z, int meta)
|
||||
{
|
||||
|
|
|
@ -11,12 +11,12 @@ import mekanism.api.MekanismConfig.usage;
|
|||
import mekanism.api.Range4D;
|
||||
import mekanism.api.lasers.ILaserReceptor;
|
||||
import mekanism.common.LaserManager;
|
||||
import mekanism.common.LaserManager.LaserInfo;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.base.IActiveState;
|
||||
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
@ -79,8 +79,8 @@ public class TileEntityLaser extends TileEntityNoisyElectricBlock implements IAc
|
|||
{
|
||||
setActive(true);
|
||||
|
||||
MovingObjectPosition mop = LaserManager.fireLaser(this, ForgeDirection.getOrientation(facing), usage.laserUsage, worldObj);
|
||||
Coord4D hitCoord = mop == null ? null : new Coord4D(mop.blockX, mop.blockY, mop.blockZ);
|
||||
LaserInfo info = LaserManager.fireLaser(this, ForgeDirection.getOrientation(facing), usage.laserUsage, worldObj);
|
||||
Coord4D hitCoord = info.movingPos == null ? null : new Coord4D(info.movingPos.blockX, info.movingPos.blockY, info.movingPos.blockZ);
|
||||
|
||||
if(hitCoord == null || !hitCoord.equals(digging))
|
||||
{
|
||||
|
|
|
@ -10,6 +10,7 @@ import mekanism.api.energy.ICableOutputter;
|
|||
import mekanism.api.energy.IStrictEnergyStorage;
|
||||
import mekanism.api.lasers.ILaserReceptor;
|
||||
import mekanism.common.LaserManager;
|
||||
import mekanism.common.LaserManager.LaserInfo;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.base.IRedstoneControl;
|
||||
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
|
||||
|
@ -39,6 +40,9 @@ public class TileEntityLaserAmplifier extends TileEntityContainerBlock implement
|
|||
public Coord4D digging;
|
||||
public double diggingProgress;
|
||||
|
||||
public boolean emittingRedstone;
|
||||
public boolean entityDetection;
|
||||
|
||||
public TileEntityLaserAmplifier()
|
||||
{
|
||||
super("LaserAmplifier");
|
||||
|
@ -93,6 +97,10 @@ public class TileEntityLaserAmplifier extends TileEntityContainerBlock implement
|
|||
}
|
||||
}
|
||||
else {
|
||||
boolean prevRedstone = emittingRedstone;
|
||||
|
||||
emittingRedstone = false;
|
||||
|
||||
if(ticks < time)
|
||||
{
|
||||
ticks++;
|
||||
|
@ -112,8 +120,8 @@ public class TileEntityLaserAmplifier extends TileEntityContainerBlock implement
|
|||
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);
|
||||
LaserInfo info = LaserManager.fireLaser(this, ForgeDirection.getOrientation(facing), firing, worldObj);
|
||||
Coord4D hitCoord = info.movingPos == null ? null : new Coord4D(info.movingPos.blockX, info.movingPos.blockY, info.movingPos.blockZ);
|
||||
|
||||
if(hitCoord == null || !hitCoord.equals(digging))
|
||||
{
|
||||
|
@ -139,6 +147,8 @@ public class TileEntityLaserAmplifier extends TileEntityContainerBlock implement
|
|||
}
|
||||
}
|
||||
|
||||
emittingRedstone = info.foundEntity;
|
||||
|
||||
setEnergy(getEnergy() - firing);
|
||||
}
|
||||
else if(on)
|
||||
|
@ -147,6 +157,16 @@ public class TileEntityLaserAmplifier extends TileEntityContainerBlock implement
|
|||
diggingProgress = 0;
|
||||
Mekanism.packetHandler.sendToAllAround(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())), Coord4D.get(this).getTargetPoint(50D));
|
||||
}
|
||||
|
||||
if(!entityDetection)
|
||||
{
|
||||
emittingRedstone = false;
|
||||
}
|
||||
|
||||
if(emittingRedstone != prevRedstone)
|
||||
{
|
||||
worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord, getBlockType());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -184,6 +204,8 @@ public class TileEntityLaserAmplifier extends TileEntityContainerBlock implement
|
|||
data.add(collectedEnergy);
|
||||
data.add(lastFired);
|
||||
data.add(controlType.ordinal());
|
||||
data.add(emittingRedstone);
|
||||
data.add(entityDetection);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
@ -203,6 +225,8 @@ public class TileEntityLaserAmplifier extends TileEntityContainerBlock implement
|
|||
collectedEnergy = dataStream.readDouble();
|
||||
lastFired = dataStream.readDouble();
|
||||
controlType = RedstoneControl.values()[dataStream.readInt()];
|
||||
emittingRedstone = dataStream.readBoolean();
|
||||
entityDetection = dataStream.readBoolean();
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -218,6 +242,9 @@ public class TileEntityLaserAmplifier extends TileEntityContainerBlock implement
|
|||
case 2:
|
||||
time = dataStream.readInt();
|
||||
break;
|
||||
case 3:
|
||||
entityDetection = !entityDetection;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -234,6 +261,7 @@ public class TileEntityLaserAmplifier extends TileEntityContainerBlock implement
|
|||
collectedEnergy = nbtTags.getDouble("collectedEnergy");
|
||||
lastFired = nbtTags.getDouble("lastFired");
|
||||
controlType = RedstoneControl.values()[nbtTags.getInteger("controlType")];
|
||||
entityDetection = nbtTags.getBoolean("entityDetection");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -249,6 +277,7 @@ public class TileEntityLaserAmplifier extends TileEntityContainerBlock implement
|
|||
nbtTags.setDouble("collectedEnergy", collectedEnergy);
|
||||
nbtTags.setDouble("lastFired", lastFired);
|
||||
nbtTags.setInteger("controlType", controlType.ordinal());
|
||||
nbtTags.setBoolean("entityDetection", entityDetection);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package mekanism.common.tile;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -8,20 +10,17 @@ import mekanism.api.MekanismConfig.general;
|
|||
import mekanism.api.lasers.ILaserReceptor;
|
||||
import mekanism.api.util.StackUtils;
|
||||
import mekanism.common.LaserManager;
|
||||
import mekanism.common.LaserManager.LaserInfo;
|
||||
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;
|
||||
|
@ -100,8 +99,8 @@ public class TileEntityLaserTractorBeam extends TileEntityContainerBlock impleme
|
|||
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);
|
||||
LaserInfo info = LaserManager.fireLaser(this, ForgeDirection.getOrientation(facing), firing, worldObj);
|
||||
Coord4D hitCoord = info.movingPos == null ? null : new Coord4D(info.movingPos.blockX, info.movingPos.blockY, info.movingPos.blockZ);
|
||||
|
||||
if(hitCoord == null || !hitCoord.equals(digging))
|
||||
{
|
||||
|
|
|
@ -5,9 +5,9 @@ import java.util.List;
|
|||
import mekanism.api.MekanismConfig.generators;
|
||||
import mekanism.api.util.ListUtils;
|
||||
import mekanism.client.gui.GuiMekanism;
|
||||
import mekanism.client.gui.GuiRedstoneControl;
|
||||
import mekanism.client.gui.element.GuiEnergyInfo;
|
||||
import mekanism.client.gui.element.GuiPowerBar;
|
||||
import mekanism.client.gui.element.GuiRedstoneControl;
|
||||
import mekanism.client.gui.element.GuiSlot;
|
||||
import mekanism.client.gui.element.GuiEnergyInfo.IInfoHandler;
|
||||
import mekanism.client.gui.element.GuiSlot.SlotOverlay;
|
||||
|
|
|
@ -5,10 +5,10 @@ import java.util.List;
|
|||
import mekanism.api.gas.GasTank;
|
||||
import mekanism.api.util.ListUtils;
|
||||
import mekanism.client.gui.GuiMekanism;
|
||||
import mekanism.client.gui.GuiRedstoneControl;
|
||||
import mekanism.client.gui.element.GuiEnergyInfo;
|
||||
import mekanism.client.gui.element.GuiGasGauge;
|
||||
import mekanism.client.gui.element.GuiPowerBar;
|
||||
import mekanism.client.gui.element.GuiRedstoneControl;
|
||||
import mekanism.client.gui.element.GuiSlot;
|
||||
import mekanism.client.gui.element.GuiEnergyInfo.IInfoHandler;
|
||||
import mekanism.client.gui.element.GuiGasGauge.IGasInfoHandler;
|
||||
|
|
|
@ -5,10 +5,10 @@ import java.util.List;
|
|||
import mekanism.api.MekanismConfig.generators;
|
||||
import mekanism.api.util.ListUtils;
|
||||
import mekanism.client.gui.GuiMekanism;
|
||||
import mekanism.client.gui.GuiRedstoneControl;
|
||||
import mekanism.client.gui.element.GuiEnergyInfo;
|
||||
import mekanism.client.gui.element.GuiFluidGauge;
|
||||
import mekanism.client.gui.element.GuiPowerBar;
|
||||
import mekanism.client.gui.element.GuiRedstoneControl;
|
||||
import mekanism.client.gui.element.GuiSlot;
|
||||
import mekanism.client.gui.element.GuiEnergyInfo.IInfoHandler;
|
||||
import mekanism.client.gui.element.GuiFluidGauge.IFluidInfoHandler;
|
||||
|
|
|
@ -4,9 +4,9 @@ import java.util.List;
|
|||
|
||||
import mekanism.api.util.ListUtils;
|
||||
import mekanism.client.gui.GuiMekanism;
|
||||
import mekanism.client.gui.GuiRedstoneControl;
|
||||
import mekanism.client.gui.element.GuiEnergyInfo;
|
||||
import mekanism.client.gui.element.GuiPowerBar;
|
||||
import mekanism.client.gui.element.GuiRedstoneControl;
|
||||
import mekanism.client.gui.element.GuiSlot;
|
||||
import mekanism.client.gui.element.GuiEnergyInfo.IInfoHandler;
|
||||
import mekanism.client.gui.element.GuiSlot.SlotOverlay;
|
||||
|
|
|
@ -4,9 +4,9 @@ import java.util.List;
|
|||
|
||||
import mekanism.api.util.ListUtils;
|
||||
import mekanism.client.gui.GuiMekanism;
|
||||
import mekanism.client.gui.GuiRedstoneControl;
|
||||
import mekanism.client.gui.element.GuiEnergyInfo;
|
||||
import mekanism.client.gui.element.GuiPowerBar;
|
||||
import mekanism.client.gui.element.GuiRedstoneControl;
|
||||
import mekanism.client.gui.element.GuiSlot;
|
||||
import mekanism.client.gui.element.GuiEnergyInfo.IInfoHandler;
|
||||
import mekanism.client.gui.element.GuiSlot.SlotOverlay;
|
||||
|
|
|
@ -7,9 +7,9 @@ import mekanism.api.EnumColor;
|
|||
import mekanism.api.MekanismConfig.generators;
|
||||
import mekanism.api.util.ListUtils;
|
||||
import mekanism.client.gui.GuiMekanism;
|
||||
import mekanism.client.gui.GuiRedstoneControl;
|
||||
import mekanism.client.gui.element.GuiEnergyInfo;
|
||||
import mekanism.client.gui.element.GuiPowerBar;
|
||||
import mekanism.client.gui.element.GuiRedstoneControl;
|
||||
import mekanism.client.gui.element.GuiSlot;
|
||||
import mekanism.client.gui.element.GuiEnergyInfo.IInfoHandler;
|
||||
import mekanism.client.gui.element.GuiSlot.SlotOverlay;
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 3.4 KiB |
|
@ -468,6 +468,7 @@ gui.oreDictCompat=Compatible OreDict Key
|
|||
gui.toggleCooling=Toggle Cooling Measurements
|
||||
gui.coolingMeasurements=Active cooling
|
||||
gui.redstoneOutputMode=Redstone mode
|
||||
gui.entityDetection=Entity Detection
|
||||
|
||||
gui.reactor.injectionRate=Injection Rate
|
||||
|
||||
|
|
Loading…
Reference in a new issue