Lasers now have fancy sound effects!
|
@ -127,5 +127,4 @@ public class CTMData
|
|||
|
||||
return !valid;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -114,8 +114,6 @@ public class TileEntityChemicalCrystallizer extends TileEntityNoisyElectricBlock
|
|||
|
||||
if(!worldObj.isRemote)
|
||||
{
|
||||
CrystallizerRecipe recipe = getRecipe();
|
||||
|
||||
if(updateDelay > 0)
|
||||
{
|
||||
updateDelay--;
|
||||
|
@ -133,6 +131,8 @@ public class TileEntityChemicalCrystallizer extends TileEntityNoisyElectricBlock
|
|||
inputTank.receive(GasTransmission.removeGas(inventory[0], inputTank.getGasType(), inputTank.getNeeded()), true);
|
||||
}
|
||||
|
||||
CrystallizerRecipe recipe = getRecipe();
|
||||
|
||||
if(canOperate(recipe) && MekanismUtils.canFunction(this) && getEnergy() >= energyUsage)
|
||||
{
|
||||
setActive(true);
|
||||
|
|
|
@ -95,8 +95,6 @@ public class TileEntityChemicalDissolutionChamber extends TileEntityNoisyElectri
|
|||
|
||||
if(!worldObj.isRemote)
|
||||
{
|
||||
DissolutionRecipe recipe = getRecipe();
|
||||
|
||||
if(updateDelay > 0)
|
||||
{
|
||||
updateDelay--;
|
||||
|
@ -121,6 +119,8 @@ public class TileEntityChemicalDissolutionChamber extends TileEntityNoisyElectri
|
|||
|
||||
boolean changed = false;
|
||||
|
||||
DissolutionRecipe recipe = getRecipe();
|
||||
|
||||
if(canOperate(recipe) && getEnergy() >= energyUsage && injectTank.getStored() >= injectUsage && MekanismUtils.canFunction(this))
|
||||
{
|
||||
setActive(true);
|
||||
|
|
|
@ -90,8 +90,6 @@ public class TileEntityChemicalInfuser extends TileEntityNoisyElectricBlock impl
|
|||
|
||||
if(!worldObj.isRemote)
|
||||
{
|
||||
ChemicalInfuserRecipe recipe = getRecipe();
|
||||
|
||||
if(updateDelay > 0)
|
||||
{
|
||||
updateDelay--;
|
||||
|
@ -119,6 +117,8 @@ public class TileEntityChemicalInfuser extends TileEntityNoisyElectricBlock impl
|
|||
centerTank.draw(GasTransmission.addGas(inventory[2], centerTank.getGas()), true);
|
||||
}
|
||||
|
||||
ChemicalInfuserRecipe recipe = getRecipe();
|
||||
|
||||
if(canOperate(recipe) && getEnergy() >= BASE_ENERGY_USAGE && MekanismUtils.canFunction(this))
|
||||
{
|
||||
setActive(true);
|
||||
|
|
|
@ -90,7 +90,6 @@ public class TileEntityChemicalOxidizer extends TileEntityNoisyElectricBlock imp
|
|||
|
||||
if(!worldObj.isRemote)
|
||||
{
|
||||
OxidationRecipe recipe = getRecipe();
|
||||
if(updateDelay > 0)
|
||||
{
|
||||
updateDelay--;
|
||||
|
@ -108,6 +107,8 @@ public class TileEntityChemicalOxidizer extends TileEntityNoisyElectricBlock imp
|
|||
gasTank.draw(GasTransmission.addGas(inventory[2], gasTank.getGas()), true);
|
||||
}
|
||||
|
||||
OxidationRecipe recipe = getRecipe();
|
||||
|
||||
if(canOperate(recipe) && getEnergy() >= energyUsage && MekanismUtils.canFunction(this))
|
||||
{
|
||||
setActive(true);
|
||||
|
|
|
@ -103,8 +103,6 @@ public class TileEntityChemicalWasher extends TileEntityNoisyElectricBlock imple
|
|||
|
||||
if(!worldObj.isRemote)
|
||||
{
|
||||
WasherRecipe recipe = getRecipe();
|
||||
|
||||
if(updateDelay > 0)
|
||||
{
|
||||
updateDelay--;
|
||||
|
@ -123,6 +121,8 @@ public class TileEntityChemicalWasher extends TileEntityNoisyElectricBlock imple
|
|||
outputTank.draw(GasTransmission.addGas(inventory[2], outputTank.getGas()), true);
|
||||
}
|
||||
|
||||
WasherRecipe recipe = getRecipe();
|
||||
|
||||
if(canOperate(recipe) && getEnergy() >= BASE_ENERGY_USAGE && MekanismUtils.canFunction(this))
|
||||
{
|
||||
setActive(true);
|
||||
|
|
|
@ -97,8 +97,6 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp
|
|||
{
|
||||
ChargeUtils.discharge(3, this);
|
||||
|
||||
SeparatorRecipe recipe = getRecipe();
|
||||
|
||||
if(inventory[0] != null)
|
||||
{
|
||||
if(RecipeHandler.Recipe.ELECTROLYTIC_SEPARATOR.containsRecipe(inventory[0]))
|
||||
|
@ -143,6 +141,8 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp
|
|||
MekanismUtils.saveChunk(this);
|
||||
}
|
||||
|
||||
SeparatorRecipe recipe = getRecipe();
|
||||
|
||||
if(canOperate(recipe) && getEnergy() >= recipe.extraEnergy)
|
||||
{
|
||||
setActive(true);
|
||||
|
|
|
@ -1,33 +1,39 @@
|
|||
package mekanism.common.tile;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import mekanism.api.Coord4D;
|
||||
import mekanism.api.MekanismConfig.general;
|
||||
import mekanism.api.MekanismConfig.usage;
|
||||
import mekanism.api.Range4D;
|
||||
import mekanism.api.lasers.ILaserReceptor;
|
||||
import mekanism.common.LaserManager;
|
||||
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;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
public class TileEntityLaser extends TileEntityElectricBlock
|
||||
public class TileEntityLaser extends TileEntityNoisyElectricBlock implements IActiveState
|
||||
{
|
||||
public boolean on;
|
||||
public Coord4D digging;
|
||||
public double diggingProgress;
|
||||
|
||||
public boolean isActive;
|
||||
|
||||
public boolean clientActive;
|
||||
|
||||
public TileEntityLaser()
|
||||
{
|
||||
super("Laser", 2* usage.laserUsage);
|
||||
super("machine.laser", "Laser", 2*usage.laserUsage);
|
||||
inventory = new ItemStack[0];
|
||||
}
|
||||
|
||||
|
@ -38,7 +44,7 @@ public class TileEntityLaser extends TileEntityElectricBlock
|
|||
|
||||
if(worldObj.isRemote)
|
||||
{
|
||||
if(on)
|
||||
if(isActive)
|
||||
{
|
||||
LaserManager.fireLaserClient(this, ForgeDirection.getOrientation(facing), usage.laserUsage, worldObj);
|
||||
}
|
||||
|
@ -46,11 +52,7 @@ public class TileEntityLaser extends TileEntityElectricBlock
|
|||
else {
|
||||
if(getEnergy() >= usage.laserUsage)
|
||||
{
|
||||
if(!on)
|
||||
{
|
||||
on = true;
|
||||
Mekanism.packetHandler.sendToAllAround(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())), Coord4D.get(this).getTargetPoint(50D));
|
||||
}
|
||||
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);
|
||||
|
@ -71,7 +73,7 @@ public class TileEntityLaser extends TileEntityElectricBlock
|
|||
{
|
||||
diggingProgress += usage.laserUsage;
|
||||
|
||||
if(diggingProgress >= hardness * general.laserEnergyNeededPerHardness)
|
||||
if(diggingProgress >= hardness*general.laserEnergyNeededPerHardness)
|
||||
{
|
||||
LaserManager.breakBlock(hitCoord, true, worldObj);
|
||||
diggingProgress = 0;
|
||||
|
@ -84,21 +86,49 @@ public class TileEntityLaser extends TileEntityElectricBlock
|
|||
|
||||
setEnergy(getEnergy() - usage.laserUsage);
|
||||
}
|
||||
else if(on)
|
||||
{
|
||||
on = false;
|
||||
else {
|
||||
setActive(false);
|
||||
diggingProgress = 0;
|
||||
Mekanism.packetHandler.sendToAllAround(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())), Coord4D.get(this).getTargetPoint(50D));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setActive(boolean active)
|
||||
{
|
||||
isActive = active;
|
||||
|
||||
if(clientActive != active)
|
||||
{
|
||||
Mekanism.packetHandler.sendToReceivers(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())), new Range4D(Coord4D.get(this)));
|
||||
clientActive = active;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getActive()
|
||||
{
|
||||
return isActive;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderUpdate()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean lightUpdate()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList getNetworkedData(ArrayList data)
|
||||
{
|
||||
super.getNetworkedData(data);
|
||||
|
||||
data.add(on);
|
||||
data.add(isActive);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
@ -108,6 +138,24 @@ public class TileEntityLaser extends TileEntityElectricBlock
|
|||
{
|
||||
super.handlePacketData(dataStream);
|
||||
|
||||
on = dataStream.readBoolean();
|
||||
isActive = dataStream.readBoolean();
|
||||
|
||||
MekanismUtils.updateBlock(worldObj, xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbtTags)
|
||||
{
|
||||
super.readFromNBT(nbtTags);
|
||||
|
||||
isActive = nbtTags.getBoolean("isActive");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbtTags)
|
||||
{
|
||||
super.writeToNBT(nbtTags);
|
||||
|
||||
nbtTags.setBoolean("isActive", isActive);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -70,8 +70,6 @@ public class TileEntitySolarNeutronActivator extends TileEntityContainerBlock im
|
|||
|
||||
if(!worldObj.isRemote)
|
||||
{
|
||||
SolarNeutronRecipe recipe = getRecipe();
|
||||
|
||||
if(updateDelay > 0)
|
||||
{
|
||||
updateDelay--;
|
||||
|
@ -84,6 +82,8 @@ public class TileEntitySolarNeutronActivator extends TileEntityContainerBlock im
|
|||
|
||||
//Buckets
|
||||
|
||||
SolarNeutronRecipe recipe = getRecipe();
|
||||
|
||||
if(canOperate(recipe) && MekanismUtils.canFunction(this))
|
||||
{
|
||||
setActive(true);
|
||||
|
@ -143,6 +143,7 @@ public class TileEntitySolarNeutronActivator extends TileEntityContainerBlock im
|
|||
{
|
||||
super.handlePacketData(dataStream);
|
||||
|
||||
isActive = dataStream.readBoolean();
|
||||
controlType = RedstoneControl.values()[dataStream.readInt()];
|
||||
|
||||
if(dataStream.readBoolean())
|
||||
|
@ -169,6 +170,7 @@ public class TileEntitySolarNeutronActivator extends TileEntityContainerBlock im
|
|||
{
|
||||
super.getNetworkedData(data);
|
||||
|
||||
data.add(isActive);
|
||||
data.add(controlType.ordinal());
|
||||
|
||||
if(inputTank.getGas() != null)
|
||||
|
@ -199,6 +201,7 @@ public class TileEntitySolarNeutronActivator extends TileEntityContainerBlock im
|
|||
{
|
||||
super.readFromNBT(nbtTags);
|
||||
|
||||
isActive = nbtTags.getBoolean("isActive");
|
||||
controlType = RedstoneControl.values()[nbtTags.getInteger("controlType")];
|
||||
|
||||
inputTank.read(nbtTags.getCompoundTag("inputTank"));
|
||||
|
@ -210,6 +213,7 @@ public class TileEntitySolarNeutronActivator extends TileEntityContainerBlock im
|
|||
{
|
||||
super.writeToNBT(nbtTags);
|
||||
|
||||
nbtTags.setBoolean("isActive", isActive);
|
||||
nbtTags.setInteger("controlType", controlType.ordinal());
|
||||
|
||||
nbtTags.setTag("inputTank", inputTank.write(new NBTTagCompound()));
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
"tile.machine.prc": {"category": "block", "sounds": [{"name": "PressurizedReactionChamber", "stream": false}]},
|
||||
"tile.machine.purification": {"category": "block", "sounds": [{"name": "PurificationChamber", "stream": false}]},
|
||||
"tile.machine.smelter": {"category": "block", "sounds": [{"name": "Smelter", "stream": false}]},
|
||||
"tile.machine.laser": {"category": "block", "sounds": [{"name": "Laser", "stream": false}]},
|
||||
|
||||
"tile.gen.bio": {"category": "block", "sounds": [{"name": "BioGenerator", "stream": false}]},
|
||||
"tile.gen.gas": {"category": "block", "sounds": [{"name": "GasGenerator", "stream": false}]},
|
||||
|
|
BIN
src/main/resources/assets/mekanism/sounds/Laser.ogg
Normal file
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.5 KiB |