mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-27 23:33:08 +00:00
Merge branch 'development' into 1.9.4
* development: Better Structural Glass recipe Fixed Portable Teleporter issue, fixed compounded Factory localization, add upgrades support to Solar Neutron Activator Conflicts: src/main/java/mekanism/common/Mekanism.java src/main/java/mekanism/common/network/PacketPortableTeleporter.java src/main/java/mekanism/common/tile/TileEntityFactory.java src/main/java/mekanism/common/tile/TileEntitySolarNeutronActivator.java
This commit is contained in:
commit
6e0a63c3ee
6 files changed
+78
-49
No files matched your search
@@ -3,6 +3,7 @@ package mekanism.common.tile;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import mekanism.api.Coord4D;
|
||||
import mekanism.api.MekanismConfig.general;
|
||||
@@ -15,11 +16,14 @@ import mekanism.api.gas.GasTransmission;
|
||||
import mekanism.api.gas.IGasHandler;
|
||||
import mekanism.api.gas.ITubeConnection;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.Upgrade;
|
||||
import mekanism.common.Upgrade.IUpgradeInfoHandler;
|
||||
import mekanism.common.base.IActiveState;
|
||||
import mekanism.common.base.IBoundingBlock;
|
||||
import mekanism.common.base.IRedstoneControl;
|
||||
import mekanism.common.base.ISustainedData;
|
||||
import mekanism.common.base.ITankManager;
|
||||
import mekanism.common.base.IUpgradeTile;
|
||||
import mekanism.common.capabilities.Capabilities;
|
||||
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
|
||||
import mekanism.common.recipe.RecipeHandler;
|
||||
@@ -27,6 +31,7 @@ import mekanism.common.recipe.inputs.GasInput;
|
||||
import mekanism.common.recipe.machines.SolarNeutronRecipe;
|
||||
import mekanism.common.security.ISecurityTile;
|
||||
import mekanism.common.tile.component.TileComponentSecurity;
|
||||
import mekanism.common.tile.component.TileComponentUpgrade;
|
||||
import mekanism.common.util.ItemDataUtils;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -40,13 +45,12 @@ import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class TileEntitySolarNeutronActivator extends TileEntityContainerBlock implements IRedstoneControl, IBoundingBlock, IGasHandler, ITubeConnection, IActiveState, ISustainedData, ITankManager, ISecurityTile
|
||||
public class TileEntitySolarNeutronActivator extends TileEntityContainerBlock implements IRedstoneControl, IBoundingBlock, IGasHandler, ITubeConnection, IActiveState, ISustainedData, ITankManager, ISecurityTile, IUpgradeTile, IUpgradeInfoHandler
|
||||
{
|
||||
public GasTank inputTank = new GasTank(MAX_GAS);
|
||||
public GasTank outputTank = new GasTank(MAX_GAS);
|
||||
|
||||
public static final int MAX_GAS = 10000;
|
||||
public static final int TICKS_REQUIRED = 5;
|
||||
|
||||
public int updateDelay;
|
||||
|
||||
@@ -56,19 +60,19 @@ public class TileEntitySolarNeutronActivator extends TileEntityContainerBlock im
|
||||
|
||||
public int gasOutput = 256;
|
||||
|
||||
public int recipeTicks = 0;
|
||||
|
||||
public SolarNeutronRecipe cachedRecipe;
|
||||
|
||||
/** This machine's current RedstoneControl type. */
|
||||
public RedstoneControl controlType = RedstoneControl.DISABLED;
|
||||
|
||||
public TileComponentUpgrade upgradeComponent = new TileComponentUpgrade(this, 3);
|
||||
public TileComponentSecurity securityComponent = new TileComponentSecurity(this);
|
||||
|
||||
public TileEntitySolarNeutronActivator()
|
||||
{
|
||||
super("SolarNeutronActivator");
|
||||
inventory = new ItemStack[3];
|
||||
upgradeComponent.setSupported(Upgrade.ENERGY, false);
|
||||
inventory = new ItemStack[4];
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -115,18 +119,10 @@ public class TileEntitySolarNeutronActivator extends TileEntityContainerBlock im
|
||||
{
|
||||
setActive(true);
|
||||
|
||||
if(recipeTicks == TICKS_REQUIRED)
|
||||
{
|
||||
operate(recipe);
|
||||
recipeTicks = 0;
|
||||
}
|
||||
else {
|
||||
recipeTicks++;
|
||||
}
|
||||
int operations = operate(recipe);
|
||||
}
|
||||
else {
|
||||
setActive(false);
|
||||
recipeTicks = 0;
|
||||
}
|
||||
|
||||
if(outputTank.getGas() != null)
|
||||
@@ -146,6 +142,14 @@ public class TileEntitySolarNeutronActivator extends TileEntityContainerBlock im
|
||||
}
|
||||
}
|
||||
|
||||
public int getUpgradedUsage()
|
||||
{
|
||||
int possibleProcess = (int)Math.pow(2, upgradeComponent.getUpgrades(Upgrade.SPEED));
|
||||
possibleProcess = Math.min(Math.min(inputTank.getStored(), outputTank.getNeeded()), possibleProcess);
|
||||
|
||||
return possibleProcess;
|
||||
}
|
||||
|
||||
public boolean isDesert()
|
||||
{
|
||||
return worldObj.provider.getBiomeForCoords(getPos()) instanceof BiomeDesert;
|
||||
@@ -173,9 +177,13 @@ public class TileEntitySolarNeutronActivator extends TileEntityContainerBlock im
|
||||
return recipe != null && recipe.canOperate(inputTank, outputTank);
|
||||
}
|
||||
|
||||
public void operate(SolarNeutronRecipe recipe)
|
||||
public int operate(SolarNeutronRecipe recipe)
|
||||
{
|
||||
recipe.operate(inputTank, outputTank);
|
||||
int operations = getUpgradedUsage();
|
||||
|
||||
recipe.operate(inputTank, outputTank, operations);
|
||||
|
||||
return operations;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -186,7 +194,6 @@ public class TileEntitySolarNeutronActivator extends TileEntityContainerBlock im
|
||||
if(FMLCommonHandler.instance().getEffectiveSide().isClient())
|
||||
{
|
||||
isActive = dataStream.readBoolean();
|
||||
recipeTicks = dataStream.readInt();
|
||||
controlType = RedstoneControl.values()[dataStream.readInt()];
|
||||
|
||||
if(dataStream.readBoolean())
|
||||
@@ -220,7 +227,6 @@ public class TileEntitySolarNeutronActivator extends TileEntityContainerBlock im
|
||||
super.getNetworkedData(data);
|
||||
|
||||
data.add(isActive);
|
||||
data.add(recipeTicks);
|
||||
data.add(controlType.ordinal());
|
||||
|
||||
if(inputTank.getGas() != null)
|
||||
@@ -252,7 +258,6 @@ public class TileEntitySolarNeutronActivator extends TileEntityContainerBlock im
|
||||
super.readFromNBT(nbtTags);
|
||||
|
||||
isActive = nbtTags.getBoolean("isActive");
|
||||
recipeTicks = nbtTags.getInteger("recipeTicks");
|
||||
controlType = RedstoneControl.values()[nbtTags.getInteger("controlType")];
|
||||
|
||||
inputTank.read(nbtTags.getCompoundTag("inputTank"));
|
||||
@@ -265,7 +270,6 @@ public class TileEntitySolarNeutronActivator extends TileEntityContainerBlock im
|
||||
super.writeToNBT(nbtTags);
|
||||
|
||||
nbtTags.setBoolean("isActive", isActive);
|
||||
nbtTags.setInteger("recipeTicks", recipeTicks);
|
||||
nbtTags.setInteger("controlType", controlType.ordinal());
|
||||
|
||||
nbtTags.setTag("inputTank", inputTank.write(new NBTTagCompound()));
|
||||
@@ -435,6 +439,18 @@ public class TileEntitySolarNeutronActivator extends TileEntityContainerBlock im
|
||||
return securityComponent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileComponentUpgrade getComponent()
|
||||
{
|
||||
return upgradeComponent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getInfo(Upgrade upgrade)
|
||||
{
|
||||
return upgrade == Upgrade.SPEED ? upgrade.getExpScaledInfo(this) : upgrade.getMultScaledInfo(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public AxisAlignedBB getRenderBoundingBox()
|
||||
|
||||
Reference in new issue
Block a user