Merge pull request #5 from aidancbrady/master

Sync with original repo
This commit is contained in:
Ezer'Arch 2016-07-03 19:51:28 -03:00 committed by GitHub
commit 7b37a3d413
79 changed files with 1595 additions and 99 deletions

View file

@ -4,4 +4,4 @@ FMP_version=1.1.2.331
CCLIB_version=1.1.3.136
NEI_version=1.0.4.101
CCC_version=1.0.6.39
mod_version=9.0.2
mod_version=9.0.3

Binary file not shown.

View file

@ -1,5 +1,8 @@
package ic2.api;
import java.util.EnumSet;
import java.util.Set;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
@ -36,6 +39,15 @@ public enum Direction {
*/
ZP;
private Direction() {
int side = ordinal() / 2;
int sign = getSign();
xOffset = side == 0 ? sign : 0;
yOffset = side == 1 ? sign : 0;
zOffset = side == 2 ? sign : 0;
}
public static Direction fromSideValue(int side) {
return directions[(side + 2) % 6];
}
@ -83,7 +95,7 @@ public enum Direction {
/**
* Get the inverse of this direction (XN -> XP, XP -> XN, etc.)
*
*
* @return Inverse direction
*/
public Direction getInverse() {
@ -92,7 +104,7 @@ public enum Direction {
/**
* Convert this direction to a Minecraft side value.
*
*
* @return Minecraft side value
*/
public int toSideValue() {
@ -112,6 +124,12 @@ public enum Direction {
return ForgeDirection.getOrientation(toSideValue());
}
public final int xOffset;
public final int yOffset;
public final int zOffset;
public static final Direction[] directions = Direction.values();
public static final Set<Direction> noDirections = EnumSet.noneOf(Direction.class);
public static final Set<Direction> allDirections = EnumSet.allOf(Direction.class);
}

View file

@ -37,13 +37,16 @@ public abstract class CropCard {
/**
* Determine the mod id owning this crop.
*
* It's recommended to hard code this to your mod id.
* The owner serves as a name space. With every mod using a different owner, a mod only has to
* make sure it doesn't have conflicts with name() in itself.
* It's recommended to hard code this to your mod id as specified in the @Mod annotation.
* Do not use IC2's mod id here.
*
* @note changing name or owner will cause existing crops in users' worlds to disappear.
*
* @return Mod id.
*/
public String owner() {
public String owner() { // TODO: make abstract
return modId;
}
@ -100,7 +103,7 @@ public abstract class CropCard {
* @param crop reference to ICropTile
* @return roots lengt use in isBlockBelow
*/
public int getrootslength(ICropTile crop) {
public int getrootslength(ICropTile crop) { // TODO: camel case
return 1;
}
@ -126,7 +129,7 @@ public abstract class CropCard {
* @param n index of the requested stat
* @return The requested value of the stats
*/
public abstract int stat(int n);
public abstract int stat(int n); // TODO: change to fixed property object or builder with other attributes like tier
/**
* Additional attributes of the plant, also influencing breeding.
@ -134,7 +137,7 @@ public abstract class CropCard {
*
* @return Attributes as an array of strings
*/
public abstract String[] attributes();
public abstract String[] attributes(); // TODO: default to none
/**
* Determine the max crop size.
@ -212,7 +215,7 @@ public abstract class CropCard {
* @return 0-30
*/
public int weightInfluences(ICropTile crop, float humidity, float nutrients, float air) {
return (int) (humidity+nutrients+air);
return (int) (humidity + nutrients + air);
}
/**
@ -247,7 +250,7 @@ public abstract class CropCard {
* @return need crop size for best output.
*/
public abstract int getOptimalHavestSize(ICropTile crop);
public abstract int getOptimalHavestSize(ICropTile crop); // TODO: default to maxSize
/**
* Check whether the crop can be harvested.
@ -255,7 +258,7 @@ public abstract class CropCard {
* @param crop reference to ICropTile
* @return Whether the crop can be harvested in its current state.
*/
public abstract boolean canBeHarvested(ICropTile crop);
public abstract boolean canBeHarvested(ICropTile crop); // TODO: default to maxSize check
/**
* Base chance for dropping the plant's gains, specify values greater than 1 for multiple drops.
@ -263,10 +266,8 @@ public abstract class CropCard {
*
* @return Chance to drop the gains
*/
public float dropGainChance() {
float base = 1F;
for (int i = 0; i < tier(); i++) {base*=0.95;}
return base;
public float dropGainChance() { // TODO: change to double
return (float) Math.pow(0.95, tier());
}
/**
@ -284,20 +285,20 @@ public abstract class CropCard {
* @param crop reference to ICropTile
* @return Plant size after harvesting
*/
public byte getSizeAfterHarvest(ICropTile crop) {return 1;}
public byte getSizeAfterHarvest(ICropTile crop) {return 1;} // TODO: change to int
/**
* Called when the plant is leftclicked by a player.
* Called when the plant is left clicked by a player.
* Default action is picking the plant.
*
* Only called Serverside.
* Only called server side.
*
* @param crop reference to ICropTile
* @param player player leftclicked the crop
* @param player player left clicked the crop
* @return Whether the plant has changed
*/
public boolean leftclick(ICropTile crop, EntityPlayer player) {
public boolean leftclick(ICropTile crop, EntityPlayer player) { // TODO: camel case
return crop.pick(true);
}
@ -398,7 +399,7 @@ public abstract class CropCard {
*/
public boolean isWeed(ICropTile crop) {
return crop.getSize() >= 2 &&
(crop == Crops.weed || crop.getGrowth() >= 24);
(crop.getCrop() == Crops.weed || crop.getGrowth() >= 24);
}
@ -430,4 +431,5 @@ public abstract class CropCard {
protected IIcon textures[];
private final String modId; // TODO: make owner abstract, remove modId auto detection
// TODO: add a clean way to obtain world reference and position
}

View file

@ -260,6 +260,15 @@ public interface ICropTile {
*/
public boolean isBlockBelow(Block block);
/**
* Check if a block is under the farmland containing the crop.
* Searches up to 2 blocks below the farmland or an air space, whichever appears first.
*
* @param oreDictionaryName blocks to search
* @return Whether the blocks were found
*/
public boolean isBlockBelow(String oreDictionaryName);
/**
* Generate plant seeds with the given parameters.
*

Binary file not shown.

View file

@ -1,5 +1,6 @@
package ic2.api.info;
import net.minecraft.potion.Potion;
import net.minecraft.util.DamageSource;
import cpw.mods.fml.common.Loader;
@ -16,6 +17,12 @@ public class Info {
*/
public static DamageSource DMG_ELECTRIC, DMG_NUKE_EXPLOSION, DMG_RADIATION;
/**
* Potions used by IC2.
* Getting assigned in preload.
*/
public static Potion POTION_RADIATION;
public static boolean isIc2Available() {
if (ic2Available != null) return ic2Available;

View file

@ -39,7 +39,9 @@ public interface IElectricItem {
/**
* Get the item's tier, lower tiers can't send energy to higher ones.
* Batteries are Tier 1, Energy Crystals are Tier 2, Lapotron Crystals are Tier 3.
*
* Batteries are Tier 1, Advanced Batteries are Tier 2, Energy Crystals are Tier 3, Lapotron
* Crystals are Tier 4.
*
* @return Item's tier
*/

Binary file not shown.

View file

@ -3,7 +3,7 @@ package ic2.api.item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
public interface IKineticWindRotor {
public interface IKineticRotor {
int getDiameter(ItemStack stack);
ResourceLocation getRotorRenderTexture(ItemStack stack);
@ -13,4 +13,11 @@ public interface IKineticWindRotor {
int getMinWindStrength(ItemStack stack);
int getMaxWindStrength(ItemStack stack);
boolean isAcceptedType(ItemStack stack, GearboxType type);
public static enum GearboxType {
WATER,
WIND,
}
}

Binary file not shown.

View file

@ -6,6 +6,9 @@ import net.minecraft.util.ResourceLocation;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
/**
* Interface used for Items that can be processed in the Turning Table
*/
public interface ILatheItem {
/**
@ -44,4 +47,24 @@ public interface ILatheItem {
@SideOnly(Side.CLIENT)
ResourceLocation getTexture(ItemStack stack);
/**
* This is similar to the Block HarvestLevel. Requires a different tool for a different hardness
* for ex. the Iron Turning Blank has a Hardness of 2 (Like Iron Ore (Harvest Level)).
* In this case however it requires a Tool hardness of one above (3)
*/
int getHardness(ItemStack stack);
/**
* Interface used for Tools that can be used to modify {@link ILatheItem}
*/
public static interface ILatheTool extends ICustomDamageItem {
/**
* This is similar to the Tool HarvestLevel. Requires a different tool for a different hardness
* for ex. the Iron Turning Blank has a Hardness of 2 (Like Iron Ore (Harvest Level)).
* The tool requires a hardness of one level above (in this case 3)
*/
int getHardness(ItemStack stack);
}
}

View file

@ -178,7 +178,7 @@ public final class NetworkHelper {
*/
private static Object getInstance() {
try {
return Class.forName(getPackage() + ".core.IC2").getDeclaredField("network").get(null);
return Class.forName(getPackage() + ".core.util.SideGateway").getMethod("get").invoke(Class.forName(getPackage() + ".core.IC2").getDeclaredField("network").get(null));
} catch (Throwable e) {
throw new RuntimeException(e);
}

View file

@ -0,0 +1,39 @@
package ic2.api.recipe;
import java.util.Map;
import net.minecraftforge.fluids.Fluid;
public interface ILiquidHeatExchangerManager extends ILiquidAcceptManager {
/**
* Add a new fluid heatup/cooldown recipe.
*
* @param fluidName the fluid to heat up/cool down
* @param fluidOutput the fluid the above fluid turns into
* @param huPerMB the Thermal Energy difference in hU for the conversion of one mB fluid
*/
void addFluid(String fluidName, String fluidOutput, int huPerMB);
HeatExchangeProperty getHeatExchangeProperty(Fluid fluid);
Map<String, HeatExchangeProperty> getHeatExchangeProperties();
/**
* This returns an ILiquidAcceptManager that only accepts fluids, that can be heated up / cooled down, but not both.
* You can basically use this to check if the liquid resulting from this conversion can be reprocessed into the first one.
* @return Returns the SingleDirectionManager.
*/
ILiquidAcceptManager getSingleDirectionLiquidManager();
public static class HeatExchangeProperty {
public HeatExchangeProperty(Fluid outputFluid, int huPerMB) {
this.outputFluid = outputFluid;
this.huPerMB = huPerMB;
}
public final Fluid outputFluid;
public final int huPerMB;
}
}

View file

@ -25,8 +25,7 @@ public final class RecipeOutput {
RecipeOutput ro = (RecipeOutput) obj;
if (items.size() == ro.items.size() &&
(metadata == null && ro.metadata == null || metadata != null && ro.metadata != null) &&
metadata.equals(ro.metadata)) {
(metadata == null && ro.metadata == null || metadata != null && ro.metadata != null && metadata.equals(ro.metadata))) {
Iterator<ItemStack> itA = items.iterator();
Iterator<ItemStack> itB = ro.items.iterator();

View file

@ -3,7 +3,7 @@ package ic2.api.recipe;
/**
* General recipe registry.
*
*
* @author Richard
*/
public class Recipes {
@ -23,12 +23,12 @@ public class Recipes {
/**
* Reference amplifier values:
*
*
* 5000: Scrap
* 45000: Scrapbox
*
*
* As Parameter for the Amplification Value you have to use the NBTTagCompound
*
*
* NBTTagCompound nbt = new NBTTagCompound();
* nbt.setInteger("amplification", aValue);
* matterAmplifier.addRecipe(yourStack, nbt);
@ -57,4 +57,12 @@ public class Recipes {
public static ISemiFluidFuelManager semiFluidGenerator;
public static IFluidHeatManager FluidHeatGenerator;
/**
* Used by the Liquid Heat Exchanger to cool down liquids and determine the amount of hu generated for every mb.
*/
public static ILiquidHeatExchangerManager liquidCooldownManager;
/**
* Opposite of {@link #liquidCooldownManager}. This is for Liquids that can be heated up again.
*/
public static ILiquidHeatExchangerManager liquidHeatupManager;
}

View file

@ -65,6 +65,7 @@ public class MekanismConfig
public static double maxEnergyPerSteam = 100;
public static double superheatingHeatTransfer = 10000;
public static double heatPerFuelTick = 4;
public static boolean allowTransmitterAlloyUpgrade;
}
public static class client

View file

@ -43,7 +43,7 @@ public class GuiBoilerStats extends GuiMekanism
public List<String> getInfo()
{
TemperatureUnit unit = TemperatureUnit.values()[general.tempUnit.ordinal()];
String environment = UnitDisplayUtils.getDisplayShort(tileEntity.structure.lastEnvironmentLoss*unit.intervalSize, unit);
String environment = UnitDisplayUtils.getDisplayShort(tileEntity.structure.lastEnvironmentLoss*unit.intervalSize, false, unit);
return ListUtils.asList(LangUtils.localize("gui.dissipated") + ": " + environment + "/t");
}
}, this, MekanismUtils.getResource(ResourceType.GUI, "GuiBoilerStats.png")));

View file

@ -40,7 +40,7 @@ public class GuiFuelwoodHeater extends GuiMekanism
public List<String> getInfo()
{
TemperatureUnit unit = TemperatureUnit.values()[general.tempUnit.ordinal()];
String environment = UnitDisplayUtils.getDisplayShort(tileEntity.lastEnvironmentLoss*unit.intervalSize, unit);
String environment = UnitDisplayUtils.getDisplayShort(tileEntity.lastEnvironmentLoss*unit.intervalSize, false, unit);
return ListUtils.asList(LangUtils.localize("gui.dissipated") + ": " + environment + "/t");
}
}, this, MekanismUtils.getResource(ResourceType.GUI, "GuiFuelwoodHeater.png")));

View file

@ -62,7 +62,6 @@ public class GuiResistiveHeater extends GuiMekanism
@Override
public List<String> getInfo()
{
System.out.println(tileEntity.lastEnvironmentLoss);
TemperatureUnit unit = TemperatureUnit.values()[general.tempUnit.ordinal()];
String environment = UnitDisplayUtils.getDisplayShort(tileEntity.lastEnvironmentLoss*unit.intervalSize, false, unit);
return ListUtils.asList(LangUtils.localize("gui.dissipated") + ": " + environment + "/t");

View file

@ -53,7 +53,7 @@ public class GuiThermalEvaporationController extends GuiMekanism
public List<String> getInfo()
{
TemperatureUnit unit = TemperatureUnit.values()[general.tempUnit.ordinal()];
String environment = UnitDisplayUtils.getDisplayShort(tileEntity.totalLoss*unit.intervalSize, unit);
String environment = UnitDisplayUtils.getDisplayShort(tileEntity.totalLoss*unit.intervalSize, false, unit);
return ListUtils.asList(LangUtils.localize("gui.dissipated") + ": " + environment + "/t");
}
}, this, MekanismUtils.getResource(ResourceType.GUI, "GuiThermalEvaporationController.png")));

View file

@ -71,7 +71,7 @@ public class GuiThermoelectricBoiler extends GuiMekanism
public List<String> getInfo()
{
TemperatureUnit unit = TemperatureUnit.values()[general.tempUnit.ordinal()];
String environment = UnitDisplayUtils.getDisplayShort(tileEntity.structure.lastEnvironmentLoss*unit.intervalSize, unit);
String environment = UnitDisplayUtils.getDisplayShort(tileEntity.structure.lastEnvironmentLoss*unit.intervalSize, false, unit);
return ListUtils.asList(LangUtils.localize("gui.dissipated") + ": " + environment + "/t");
}
}, this, MekanismUtils.getResource(ResourceType.GUI, "GuiThermoelectricBoiler.png")));

View file

@ -630,6 +630,11 @@ public class RenderPartTransmitter implements IIconSelfRegister
public void renderTransparency(IIcon icon, CCModel cc, Colour color)
{
if(icon == null)
{
return;
}
if(color != null)
{
cc.render(new IconTransformation(icon), new ColourMultiplier(color.rgba()));

View file

@ -90,7 +90,7 @@ public class RenderBin extends TileEntitySpecialRenderer
if(amount != "")
{
renderText(amount, ForgeDirection.getOrientation(tileEntity.facing), 0.02F, x, y - 0.31F, z);
renderText(amount, ForgeDirection.getOrientation(tileEntity.facing), 0.02F, x, y - 0.3725F, z);
}
MekanismRenderer.glowOff();

View file

@ -281,7 +281,7 @@ public class CommonProxy implements IGuiProvider
general.armoredJetpackDamageRatio = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "ArmoredJetpackDamageRatio", 0.8).getDouble();
general.armoredJetpackDamageMax = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "ArmoredJepackDamageMax", 115).getInt();
general.aestheticWorldDamage = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "AestheticWorldDamage", true).getBoolean();
general.opsBypassRestrictions = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "OpsBypassRestrictions", true).getBoolean();
general.opsBypassRestrictions = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "OpsBypassRestrictions", false).getBoolean();
general.thermalEvaporationSpeed = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "ThermalEvaporationSpeed", 1.0D).getDouble();
general.maxJetpackGas = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "MaxJetpackGas", 24000).getInt();
general.maxScubaGas = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "MaxScubaGas", 24000).getInt();
@ -297,6 +297,7 @@ public class CommonProxy implements IGuiProvider
general.maxEnergyPerSteam = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "MaxEnergyPerSteam", 100D).getDouble();
general.superheatingHeatTransfer = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "SuperheatingHeatTransfer", 10000D).getDouble();
general.heatPerFuelTick = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "HeatPerFuelTick", 4D).getDouble();
general.allowTransmitterAlloyUpgrade = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "AllowTransmitterAlloyUpgrade", true).getBoolean();
general.blacklistIC2 = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "BlacklistIC2Power", false).getBoolean();
general.blacklistRF = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "BlacklistRFPower", false).getBoolean();

View file

@ -12,6 +12,7 @@ import mekanism.api.Coord4D;
import mekanism.api.transmitters.DynamicNetwork;
import mekanism.api.transmitters.IGridTransmitter;
import mekanism.common.util.LangUtils;
import mekanism.common.util.PipeUtils;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.util.ForgeDirection;
@ -164,7 +165,7 @@ public class FluidNetwork extends DynamicNetwork<IFluidHandler, FluidNetwork>
if(acceptor != null && fluidToSend != null)
{
fluidSent += acceptor.fill(side, new FluidStack(fluidToSend.getFluidID(), currentSending), doTransfer);
fluidSent += acceptor.fill(side, PipeUtils.copy(fluidToSend, currentSending), doTransfer);
}
if(fluidSent > prev)

View file

@ -142,7 +142,7 @@ import cpw.mods.fml.common.registry.GameRegistry;
* @author AidanBrady
*
*/
@Mod(modid = "Mekanism", name = "Mekanism", version = "9.0.2", guiFactory = "mekanism.client.gui.ConfigGuiFactory",
@Mod(modid = "Mekanism", name = "Mekanism", version = "9.0.3", guiFactory = "mekanism.client.gui.ConfigGuiFactory",
dependencies = "after:ForgeMultipart;after:BuildCraft;after:BuildCraftAPI;after:IC2;after:CoFHCore;" +
"after:ComputerCraft;after:Galacticraft API;after:MetallurgyCore")
public class Mekanism
@ -168,7 +168,7 @@ public class Mekanism
public static Configuration configuration;
/** Mekanism version number */
public static Version versionNumber = new Version(9, 0, 2);
public static Version versionNumber = new Version(9, 0, 3);
/** MultiblockManagers for various structrures */
public static MultiblockManager<SynchronizedTankData> tankManager = new MultiblockManager<SynchronizedTankData>("dynamicTank");

View file

@ -103,8 +103,7 @@ public abstract class EnergyAcceptorWrapper implements IStrictEnergyAcceptor
@Override
public double transferEnergyToAcceptor(ForgeDirection side, double amount)
{
int needed = Math.min(acceptor.getMaxEnergyStored(side)-acceptor.getEnergyStored(side), Integer.MAX_VALUE);
int transferred = acceptor.receiveEnergy(side, Math.min(needed, toRF(amount)), false);
int transferred = acceptor.receiveEnergy(side, Math.min(Integer.MAX_VALUE, toRF(amount)), false);
return fromRF(transferred);
}
@ -170,7 +169,9 @@ public abstract class EnergyAcceptorWrapper implements IStrictEnergyAcceptor
public double transferEnergyToAcceptor(ForgeDirection side, double amount)
{
double toTransfer = Math.min(Math.min(acceptor.getDemandedEnergy(), toEU(amount)), Integer.MAX_VALUE);
return amount - fromEU(acceptor.injectEnergy(side, toTransfer, 0));
double rejects = acceptor.injectEnergy(side, toTransfer, 0);
return fromEU(toTransfer - rejects);
}
@Override

View file

@ -84,6 +84,7 @@ import mekanism.common.tile.TileEntitySolarNeutronActivator;
import mekanism.common.tile.TileEntityTeleporter;
import mekanism.common.util.LangUtils;
import mekanism.common.util.MekanismUtils;
import mekanism.common.util.PipeUtils;
import mekanism.common.util.SecurityUtils;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
@ -687,7 +688,7 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IBlo
{
String owner = ((ISecurityTile)tileEntity).getSecurity().getOwner();
if(owner == null || entityplayer.getCommandSenderName().equals(owner))
if(MekanismUtils.isOp((EntityPlayerMP)entityplayer) || owner == null || entityplayer.getCommandSenderName().equals(owner))
{
entityplayer.openGui(Mekanism.instance, type.guiId, world, x, y, z);
}
@ -801,6 +802,25 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IBlo
return world.setBlockToAir(x, y, z);
}
@Override
public boolean hasComparatorInputOverride()
{
return true;
}
@Override
public int getComparatorInputOverride(World world, int x, int y, int z, int par5)
{
TileEntity tileEntity = world.getTileEntity(x, y, z);
if(tileEntity instanceof TileEntityFluidTank)
{
return ((TileEntityFluidTank)tileEntity).getRedstoneLevel();
}
return 0;
}
private boolean manageInventory(EntityPlayer player, TileEntityFluidTank tileEntity)
{
ItemStack itemStack = player.getCurrentEquippedItem();
@ -899,7 +919,7 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IBlo
if(itemFluid.amount-toFill > 0)
{
tileEntity.pushUp(new FluidStack(itemFluid.getFluid(), itemFluid.amount-toFill), true);
tileEntity.pushUp(PipeUtils.copy(itemFluid, itemFluid.amount-toFill), true);
}
return true;

View file

@ -90,7 +90,7 @@ public class InventoryFrequency extends Frequency
if(nbtTags.hasKey("storedItem"))
{
storedItem.readFromNBT(nbtTags.getCompoundTag("storedItem"));
storedItem = ItemStack.loadItemStackFromNBT(nbtTags.getCompoundTag("storedItem"));
}
temperature = nbtTags.getDouble("temperature");

View file

@ -1,6 +1,7 @@
package mekanism.common.item;
import mekanism.api.IAlloyInteraction;
import mekanism.api.MekanismConfig.general;
import mekanism.common.MekanismItems;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
@ -19,7 +20,7 @@ public class ItemAlloy extends ItemMekanism
{
TileEntity tile = world.getTileEntity(x, y, z);
if(tile instanceof IAlloyInteraction)
if(general.allowTransmitterAlloyUpgrade && tile instanceof IAlloyInteraction)
{
if(!world.isRemote)
{

View file

@ -36,6 +36,7 @@ import mekanism.common.tile.TileEntityFactory;
import mekanism.common.tile.TileEntityFluidTank;
import mekanism.common.util.LangUtils;
import mekanism.common.util.MekanismUtils;
import mekanism.common.util.PipeUtils;
import mekanism.common.util.SecurityUtils;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
@ -852,7 +853,7 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, ISpec
if(doFill)
{
int fillAmount = toFill + (stored == null ? 0 : stored.amount);
setFluidStack(new FluidStack(resource.getFluid(), (stored != null ? stored.amount : 0)+toFill), container);
setFluidStack(PipeUtils.copy(resource, (stored != null ? stored.amount : 0)+toFill), container);
}
return toFill;
@ -870,7 +871,7 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, ISpec
if(stored != null)
{
FluidStack toDrain = new FluidStack(stored.getFluid(), Math.min(stored.amount, maxDrain));
FluidStack toDrain = PipeUtils.copy(stored, Math.min(stored.amount, maxDrain));
if(doDrain)
{

View file

@ -7,6 +7,7 @@ import mekanism.api.gas.GasStack;
import mekanism.api.gas.IGasItem;
import mekanism.common.Mekanism;
import mekanism.common.util.LangUtils;
import mekanism.common.util.PipeUtils;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
@ -164,7 +165,7 @@ public class ItemGaugeDropper extends ItemMekanism implements IGasItem, IFluidCo
if(doFill)
{
int fillAmount = toFill + (stored == null ? 0 : stored.amount);
setFluid(container, new FluidStack(resource.getFluid(), (stored != null ? stored.amount : 0)+toFill));
setFluid(container, PipeUtils.copy(resource, (stored != null ? stored.amount : 0)+toFill));
}
return toFill;
@ -177,7 +178,7 @@ public class ItemGaugeDropper extends ItemMekanism implements IGasItem, IFluidCo
if(stored != null)
{
FluidStack toDrain = new FluidStack(stored.getFluid(), Math.min(stored.amount, maxDrain));
FluidStack toDrain = PipeUtils.copy(stored, Math.min(stored.amount, maxDrain));
if(doDrain)
{

View file

@ -5,10 +5,14 @@ import java.util.List;
import mekanism.api.EnumColor;
import mekanism.common.Upgrade;
import mekanism.common.base.IUpgradeItem;
import mekanism.common.base.IUpgradeTile;
import mekanism.common.tile.component.TileComponentUpgrade;
import mekanism.common.util.LangUtils;
import mekanism.common.util.MekanismUtils;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import org.lwjgl.input.Keyboard;
@ -44,4 +48,37 @@ public class ItemUpgrade extends ItemMekanism implements IUpgradeItem
{
return upgrade;
}
@Override
public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ)
{
if(world.isRemote)
{
return false;
}
if(player.isSneaking())
{
TileEntity tile = world.getTileEntity(x, y, z);
Upgrade type = getUpgradeType(stack);
if(tile instanceof IUpgradeTile)
{
TileComponentUpgrade component = ((IUpgradeTile)tile).getComponent();
if(component.supports(type))
{
if(component.getUpgrades(type) < type.getMax())
{
component.addUpgrade(type);
stack.stackSize--;
}
}
return true;
}
}
return false;
}
}

View file

@ -104,7 +104,7 @@ public class PartMechanicalPipe extends PartTransmitter<IFluidHandler, FluidNetw
toSave += remain;
}
return new FluidStack(getTransmitter().getTransmitterNetwork().buffer.getFluid(), toSave);
return PipeUtils.copy(getTransmitter().getTransmitterNetwork().buffer, toSave);
}
return null;

View file

@ -71,6 +71,7 @@ public class PacketConfigSync implements IMessageHandler<ConfigSyncMessage, IMes
dataStream.writeDouble(general.maxEnergyPerSteam);
dataStream.writeDouble(general.superheatingHeatTransfer);
dataStream.writeDouble(general.heatPerFuelTick);
dataStream.writeBoolean(general.allowTransmitterAlloyUpgrade);
for(MachineType type : MachineType.getValidMachines())
{
@ -158,6 +159,7 @@ public class PacketConfigSync implements IMessageHandler<ConfigSyncMessage, IMes
general.maxEnergyPerSteam = dataStream.readDouble();
general.superheatingHeatTransfer = dataStream.readDouble();
general.heatPerFuelTick = dataStream.readDouble();
general.allowTransmitterAlloyUpgrade = dataStream.readBoolean();
for(MachineType type : MachineType.getValidMachines())
{

View file

@ -22,10 +22,12 @@ import mekanism.common.util.FluidContainerUtils.ContainerEditMode;
import mekanism.common.util.InventoryUtils;
import mekanism.common.util.LangUtils;
import mekanism.common.util.MekanismUtils;
import mekanism.common.util.PipeUtils;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MathHelper;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidContainerRegistry;
@ -59,6 +61,8 @@ public class TileEntityFluidTank extends TileEntityContainerBlock implements IAc
public boolean needsPacket;
public int currentRedstoneLevel;
public TileComponentSecurity securityComponent = new TileComponentSecurity(this);
public TileEntityFluidTank()
@ -138,6 +142,14 @@ public class TileEntityFluidTank extends TileEntityContainerBlock implements IAc
activeEmit();
}
int newRedstoneLevel = getRedstoneLevel();
if(newRedstoneLevel != currentRedstoneLevel)
{
markDirty();
currentRedstoneLevel = newRedstoneLevel;
}
if(needsPacket)
{
Mekanism.packetHandler.sendToAllAround(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())), Coord4D.get(this).getTargetPoint(50));
@ -183,13 +195,13 @@ public class TileEntityFluidTank extends TileEntityContainerBlock implements IAc
if(ret != null)
{
fluidTank.setFluid(new FluidStack(ret.getFluid(), Math.min(fluidTank.getCapacity(), ret.amount)));
fluidTank.setFluid(PipeUtils.copy(ret, Math.min(fluidTank.getCapacity(), ret.amount)));
int rejects = Math.max(0, ret.amount - fluidTank.getCapacity());
if(rejects > 0)
{
pushUp(new FluidStack(ret.getFluid(), rejects), true);
pushUp(PipeUtils.copy(ret, rejects), true);
}
}
}
@ -204,13 +216,13 @@ public class TileEntityFluidTank extends TileEntityContainerBlock implements IAc
if(ret != null)
{
fluidTank.setFluid(new FluidStack(ret.getFluid(), Math.min(fluidTank.getCapacity(), ret.amount)));
fluidTank.setFluid(PipeUtils.copy(ret, Math.min(fluidTank.getCapacity(), ret.amount)));
int rejects = Math.max(0, ret.amount - fluidTank.getCapacity());
if(rejects > 0)
{
pushUp(new FluidStack(ret.getFluid(), rejects), true);
pushUp(PipeUtils.copy(ret, rejects), true);
}
}
}
@ -352,6 +364,12 @@ public class TileEntityFluidTank extends TileEntityContainerBlock implements IAc
}
}
public int getRedstoneLevel()
{
double fractionFull = (float)fluidTank.getFluidAmount()/(float)fluidTank.getCapacity();
return MathHelper.floor_float((float)(fractionFull * 14.0F)) + (fractionFull > 0 ? 1 : 0);
}
public int getCurrentNeeded()
{
int needed = fluidTank.getCapacity()-fluidTank.getFluidAmount();
@ -464,7 +482,7 @@ public class TileEntityFluidTank extends TileEntityContainerBlock implements IAc
if(filled < resource.amount && !isActive)
{
filled += pushUp(new FluidStack(resource.getFluid(), resource.amount-filled), doFill);
filled += pushUp(PipeUtils.copy(resource, resource.amount-filled), doFill);
}
if(filled > 0 && from == ForgeDirection.UP)

View file

@ -52,6 +52,8 @@ public class TileEntityGasTank extends TileEntityContainerBlock implements IGasH
public GasMode dumping;
public int currentGasAmount;
public int currentRedstoneLevel;
/** This machine's current RedstoneControl type. */
public RedstoneControl controlType;
@ -127,6 +129,14 @@ public class TileEntityGasTank extends TileEntityContainerBlock implements IGasH
}
currentGasAmount = newGasAmount;
int newRedstoneLevel = getRedstoneLevel();
if(newRedstoneLevel != currentRedstoneLevel)
{
markDirty();
currentRedstoneLevel = newRedstoneLevel;
}
}
}

View file

@ -8,6 +8,7 @@ import java.util.EnumSet;
import mekanism.api.Coord4D;
import mekanism.api.EnumColor;
import mekanism.api.IConfigCardAccess.ISpecialConfigData;
import mekanism.api.MekanismConfig.client;
import mekanism.api.Range4D;
import mekanism.common.HashList;
import mekanism.common.Mekanism;
@ -557,7 +558,7 @@ public class TileEntityLogisticalSorter extends TileEntityElectricBlock implemen
{
Mekanism.packetHandler.sendToReceivers(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())), new Range4D(Coord4D.get(this)));
if(active)
if(active && client.enableMachineSounds)
{
worldObj.playSoundEffect(xCoord, yCoord, zCoord, "mekanism:etc.Click", 0.3F, 1);
}

View file

@ -76,6 +76,8 @@ public class TileEntityPRC extends TileEntityBasicMachine<PressurizedInput, Pres
inventory = new ItemStack[4];
upgradeComponent = new TileComponentUpgrade(this, 3);
upgradeComponent.setSupported(Upgrade.MUFFLING);
ejectorComponent = new TileComponentEjector(this);
ejectorComponent.setOutputData(TransmissionType.ITEM, configComponent.getOutputs(TransmissionType.ITEM).get(3));
ejectorComponent.setOutputData(TransmissionType.GAS, configComponent.getOutputs(TransmissionType.GAS).get(2));

View file

@ -65,6 +65,7 @@ public class TileEntityThermalEvaporationController extends TileEntityThermalEva
public boolean structured = false;
public boolean controllerConflict = false;
public boolean isLeftOnFace;
public int renderY;
public boolean updatedThisTick = false;
@ -370,6 +371,8 @@ public class TileEntityThermalEvaporationController extends TileEntityThermalEva
middlePointer = middlePointer.getFromSide(ForgeDirection.DOWN);
}
renderY = middlePointer.yCoord+1;
if(height < 3 || height > MAX_HEIGHT)
{
height = 0;
@ -570,7 +573,7 @@ public class TileEntityThermalEvaporationController extends TileEntityThermalEva
startPoint = isLeftOnFace ? startPoint.getFromSide(right) : startPoint;
startPoint = startPoint.getFromSide(right.getOpposite()).getFromSide(MekanismUtils.getBack(facing));
startPoint.translate(0, -(height-2), 0);
startPoint.yCoord = renderY;
return startPoint;
}
@ -609,6 +612,7 @@ public class TileEntityThermalEvaporationController extends TileEntityThermalEva
isLeftOnFace = dataStream.readBoolean();
lastGain = dataStream.readFloat();
totalLoss = dataStream.readFloat();
renderY = dataStream.readInt();
if(structured != prev)
{
@ -665,6 +669,7 @@ public class TileEntityThermalEvaporationController extends TileEntityThermalEva
data.add(isLeftOnFace);
data.add(lastGain);
data.add(totalLoss);
data.add(renderY);
return data;
}
@ -702,6 +707,12 @@ public class TileEntityThermalEvaporationController extends TileEntityThermalEva
{
return side != 0 && side != 1;
}
@Override
public TileEntityThermalEvaporationController getController()
{
return structured ? this : null;
}
public void clearStructure()
{

View file

@ -138,7 +138,7 @@ public class TileComponentEjector implements ITileComponent
if(tank.getFluidAmount() > 0)
{
FluidStack toEmit = new FluidStack(tank.getFluid().getFluid(), Math.min(FLUID_OUTPUT, tank.getFluidAmount()));
FluidStack toEmit = PipeUtils.copy(tank.getFluid(), Math.min(FLUID_OUTPUT, tank.getFluidAmount()));
int emit = PipeUtils.emit(outputSides, toEmit, tileEntity);
tank.drain(emit, true);
}

View file

@ -1501,8 +1501,15 @@ public final class MekanismUtils
* @param player - player to check
* @return if the player has operator privileges
*/
public static boolean isOp(EntityPlayerMP player)
public static boolean isOp(EntityPlayer p)
{
if(!(p instanceof EntityPlayerMP))
{
return false;
}
EntityPlayerMP player = (EntityPlayerMP)p;
return general.opsBypassRestrictions && player.mcServer.getConfigurationManager().func_152596_g(player.getGameProfile());
}

View file

@ -115,10 +115,18 @@ public final class PipeUtils
}
ForgeDirection dir = ForgeDirection.getOrientation(Arrays.asList(possibleAcceptors).indexOf(acceptor)).getOpposite();
toSend -= acceptor.fill(dir, new FluidStack(stack.getFluid(), currentSending), true);
toSend -= acceptor.fill(dir, copy(stack, currentSending), true);
}
}
return prevSending-toSend;
}
public static FluidStack copy(FluidStack fluid, int amount)
{
FluidStack ret = fluid.copy();
ret.amount = amount;
return ret;
}
}

View file

@ -34,6 +34,11 @@ public final class SecurityUtils
ISecurityItem security = (ISecurityItem)stack.getItem();
if(MekanismUtils.isOp(player))
{
return true;
}
return canAccess(security.getSecurity(stack), player.getCommandSenderName(), security.getOwner(stack));
}
@ -46,6 +51,11 @@ public final class SecurityUtils
ISecurityTile security = (ISecurityTile)tile;
if(MekanismUtils.isOp(player))
{
return true;
}
return canAccess(security.getSecurity().getMode(), player.getCommandSenderName(), security.getSecurity().getOwner());
}

View file

@ -2,6 +2,7 @@ package mekanism.generators.client.gui;
import java.util.List;
import mekanism.api.MekanismConfig.general;
import mekanism.api.util.ListUtils;
import mekanism.api.util.UnitDisplayUtils;
import mekanism.api.util.UnitDisplayUtils.TemperatureUnit;
@ -66,8 +67,9 @@ public class GuiHeatGenerator extends GuiMekanism
@Override
public List<String> getInfo()
{
String transfer = UnitDisplayUtils.getDisplayShort(tileEntity.lastTransferLoss, TemperatureUnit.KELVIN);
String environment = UnitDisplayUtils.getDisplayShort(tileEntity.lastEnvironmentLoss, TemperatureUnit.KELVIN);
TemperatureUnit unit = TemperatureUnit.values()[general.tempUnit.ordinal()];
String transfer = UnitDisplayUtils.getDisplayShort(tileEntity.lastTransferLoss, false, unit);
String environment = UnitDisplayUtils.getDisplayShort(tileEntity.lastEnvironmentLoss, false, unit);
return ListUtils.asList(LangUtils.localize("gui.transferred") + ": " + transfer + "/t", LangUtils.localize("gui.dissipated") + ": " + environment + "/t");
}
}, this, MekanismUtils.getResource(ResourceType.GUI, "GuiHeatGenerator.png")));

View file

@ -1,7 +1,9 @@
package mekanism.generators.client.gui;
import java.util.ArrayList;
import java.util.List;
import mekanism.api.Coord4D;
import mekanism.api.MekanismConfig.general;
import mekanism.api.MekanismConfig.generators;
import mekanism.api.util.ListUtils;
@ -12,7 +14,11 @@ import mekanism.client.gui.element.GuiPowerBar;
import mekanism.client.gui.element.GuiRateBar;
import mekanism.client.gui.element.GuiRateBar.IRateInfoHandler;
import mekanism.client.render.MekanismRenderer;
import mekanism.client.sound.SoundHandler;
import mekanism.common.Mekanism;
import mekanism.common.inventory.container.ContainerFilter;
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
import mekanism.common.tile.TileEntityGasTank;
import mekanism.common.util.LangUtils;
import mekanism.common.util.MekanismUtils;
import mekanism.common.util.MekanismUtils.ResourceType;
@ -53,6 +59,11 @@ public class GuiIndustrialTurbine extends GuiMekanism
double rate = tileEntity.structure.lowerVolume*(tileEntity.structure.clientDispersers*generators.turbineDisperserGasFlow);
rate = Math.min(rate, tileEntity.structure.vents*generators.turbineVentGasFlow);
if(rate == 0)
{
return 0;
}
return (double)tileEntity.structure.lastSteamInput/rate;
}
}, MekanismUtils.getResource(ResourceType.GUI, "GuiIndustrialTurbine.png"), 40, 13));
@ -89,6 +100,9 @@ public class GuiIndustrialTurbine extends GuiMekanism
renderScaledText(LangUtils.localize("gui.capacity") + ": " + tileEntity.structure.getFluidCapacity() + " mB", 53, 44, 0x00CD00, 106);
renderScaledText(LangUtils.localize("gui.maxFlow") + ": " + rate + " mB/t", 53, 53, 0x00CD00, 106);
String name = chooseByMode(tileEntity.structure.dumpMode, LangUtils.localize("gui.idle"), LangUtils.localize("gui.dumping"), LangUtils.localize("gui.dumping_excess"));
renderScaledText(name, 156-(int)(fontRendererObj.getStringWidth(name)*getNeededScale(name, 66)), 73, 0x404040, 66);
if(xAxis >= 7 && xAxis <= 39 && yAxis >= 14 && yAxis <= 72)
{
drawCreativeTabHoveringText(tileEntity.structure.fluidStored != null ? LangUtils.localizeFluidStack(tileEntity.structure.fluidStored) + ": " + tileEntity.structure.fluidStored.amount + "mB" : LangUtils.localize("gui.empty"), xAxis, yAxis);
@ -106,6 +120,9 @@ public class GuiIndustrialTurbine extends GuiMekanism
int guiHeight = (height - ySize) / 2;
drawTexturedModalRect(guiWidth, guiHeight, 0, 0, xSize, ySize);
int displayInt = chooseByMode(tileEntity.structure.dumpMode, 142, 150, 158);
drawTexturedModalRect(guiWidth + 160, guiHeight + 73, 176, displayInt, 8, 8);
if(tileEntity.getScaledFluidLevel(58) > 0)
{
displayGauge(7, 14, tileEntity.getScaledFluidLevel(58), tileEntity.structure.fluidStored, 0);
@ -154,4 +171,40 @@ public class GuiIndustrialTurbine extends GuiMekanism
mc.renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.GUI, "GuiIndustrialTurbine.png"));
drawTexturedModalRect(guiWidth + xPos, guiHeight + yPos, 176, side == 0 ? 0 : 54, 16, 54);
}
@Override
protected void mouseClicked(int x, int y, int button)
{
super.mouseClicked(x, y, button);
int xAxis = (x - (width - xSize) / 2);
int yAxis = (y - (height - ySize) / 2);
if(xAxis > 160 && xAxis < 169 && yAxis > 73 && yAxis < 82)
{
ArrayList data = new ArrayList();
data.add((byte)0);
Mekanism.packetHandler.sendToServer(new TileEntityMessage(Coord4D.get(tileEntity), data));
SoundHandler.playSound("gui.button.press");
}
}
private <T> T chooseByMode(TileEntityGasTank.GasMode dumping, T idleOption, T dumpingOption, T dumpingExcessOption)
{
if(dumping.equals(TileEntityGasTank.GasMode.IDLE))
{
return idleOption;
}
else if(dumping.equals(TileEntityGasTank.GasMode.DUMPING))
{
return dumpingOption;
}
else if(dumping.equals(TileEntityGasTank.GasMode.DUMPING_EXCESS))
{
return dumpingExcessOption;
}
return idleOption; //should not happen;
}
}

View file

@ -43,7 +43,7 @@ import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.network.NetworkRegistry;
@Mod(modid = "MekanismGenerators", name = "MekanismGenerators", version = "9.0.2", dependencies = "required-after:Mekanism", guiFactory = "mekanism.generators.client.gui.GeneratorsGuiFactory")
@Mod(modid = "MekanismGenerators", name = "MekanismGenerators", version = "9.0.3", dependencies = "required-after:Mekanism", guiFactory = "mekanism.generators.client.gui.GeneratorsGuiFactory")
public class MekanismGenerators implements IModule
{
@SidedProxy(clientSide = "mekanism.generators.client.GeneratorsClientProxy", serverSide = "mekanism.generators.common.GeneratorsCommonProxy")
@ -53,7 +53,7 @@ public class MekanismGenerators implements IModule
public static MekanismGenerators instance;
/** MekanismGenerators version number */
public static Version versionNumber = new Version(9, 0, 2);
public static Version versionNumber = new Version(9, 0, 3);
public static MultiblockManager<SynchronizedTurbineData> turbineManager = new MultiblockManager<SynchronizedTurbineData>("industrialTurbine");

View file

@ -5,6 +5,7 @@ import java.util.Map;
import mekanism.api.Coord4D;
import mekanism.common.multiblock.SynchronizedData;
import mekanism.common.tile.TileEntityGasTank.GasMode;
import net.minecraftforge.fluids.FluidStack;
public class SynchronizedTurbineData extends SynchronizedData<SynchronizedTurbineData>
@ -19,6 +20,8 @@ public class SynchronizedTurbineData extends SynchronizedData<SynchronizedTurbin
public double electricityStored;
public GasMode dumpMode = GasMode.IDLE;
public int blades;
public int vents;
public int coils;

View file

@ -1,6 +1,7 @@
package mekanism.generators.common.content.turbine;
import mekanism.common.multiblock.MultiblockCache;
import mekanism.common.tile.TileEntityGasTank.GasMode;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.fluids.FluidStack;
@ -8,12 +9,14 @@ public class TurbineCache extends MultiblockCache<SynchronizedTurbineData>
{
public FluidStack fluid;
public double electricity;
public GasMode dumpMode = GasMode.IDLE;
@Override
public void apply(SynchronizedTurbineData data)
{
data.fluidStored = fluid;
data.electricityStored = electricity;
data.dumpMode = dumpMode;
}
@Override
@ -21,6 +24,7 @@ public class TurbineCache extends MultiblockCache<SynchronizedTurbineData>
{
fluid = data.fluidStored;
electricity = data.electricityStored;
dumpMode = data.dumpMode;
}
@Override
@ -32,6 +36,7 @@ public class TurbineCache extends MultiblockCache<SynchronizedTurbineData>
}
electricity = nbtTags.getDouble("electricity");
dumpMode = GasMode.values()[nbtTags.getInteger("dumpMode")];
}
@Override
@ -43,5 +48,6 @@ public class TurbineCache extends MultiblockCache<SynchronizedTurbineData>
}
nbtTags.setDouble("electricity", electricity);
nbtTags.setInteger("dumpMode", dumpMode.ordinal());
}
}

View file

@ -243,6 +243,7 @@ public class TurbineUpdateProtocol extends UpdateProtocol<SynchronizedTurbineDat
}
((TurbineCache)cache).electricity += ((TurbineCache)merge).electricity;
((TurbineCache)cache).dumpMode = ((TurbineCache)merge).dumpMode;
}
@Override

View file

@ -1,36 +1,66 @@
package mekanism.generators.common.tile.reactor;
import java.util.ArrayList;
import java.util.EnumSet;
import mekanism.api.Coord4D;
import mekanism.api.EnumColor;
import mekanism.api.IConfigurable;
import mekanism.api.IHeatTransfer;
import mekanism.api.Range4D;
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 mekanism.api.reactor.IReactorBlock;
import mekanism.common.Mekanism;
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
import mekanism.common.tile.TileEntityBoilerValve;
import mekanism.common.util.CableUtils;
import mekanism.common.util.HeatUtils;
import mekanism.common.util.InventoryUtils;
import mekanism.common.util.LangUtils;
import mekanism.generators.common.item.ItemHohlraum;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentText;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTankInfo;
import net.minecraftforge.fluids.IFluidHandler;
import net.minecraftforge.fluids.IFluidTank;
public class TileEntityReactorPort extends TileEntityReactorBlock implements IFluidHandler, IGasHandler, ITubeConnection, IHeatTransfer
public class TileEntityReactorPort extends TileEntityReactorBlock implements IFluidHandler, IGasHandler, ITubeConnection, IHeatTransfer, IConfigurable
{
public boolean fluidEject;
public TileEntityReactorPort()
{
super("name", 1);
inventory = new ItemStack[0];
}
@Override
public void readFromNBT(NBTTagCompound nbtTags)
{
super.readFromNBT(nbtTags);
fluidEject = nbtTags.getBoolean("fluidEject");
}
@Override
public void writeToNBT(NBTTagCompound nbtTags)
{
super.writeToNBT(nbtTags);
nbtTags.setBoolean("fluidEject", fluidEject);
}
@Override
public boolean isFrame()
@ -48,13 +78,34 @@ public class TileEntityReactorPort extends TileEntityReactorBlock implements IFl
super.onUpdate();
CableUtils.emit(this);
if(!worldObj.isRemote)
{
CableUtils.emit(this);
if(fluidEject && getReactor() != null && getReactor().getSteamTank().getFluidAmount() > 0)
{
IFluidTank tank = getReactor().getSteamTank();
for(ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)
{
TileEntity tile = Coord4D.get(this).getFromSide(side).getTileEntity(worldObj);
if(tile instanceof IFluidHandler && !(tile instanceof TileEntityBoilerValve))
{
if(((IFluidHandler)tile).canFill(side.getOpposite(), tank.getFluid().getFluid()))
{
tank.drain(((IFluidHandler)tile).fill(side.getOpposite(), tank.getFluid(), true), true);
}
}
}
}
}
}
@Override
public int fill(ForgeDirection from, FluidStack resource, boolean doFill)
{
if(resource.getFluid() == FluidRegistry.WATER && getReactor() != null)
if(resource.getFluid() == FluidRegistry.WATER && getReactor() != null && !fluidEject)
{
return getReactor().getWaterTank().fill(resource, doFill);
}
@ -87,13 +138,13 @@ public class TileEntityReactorPort extends TileEntityReactorBlock implements IFl
@Override
public boolean canFill(ForgeDirection from, Fluid fluid)
{
return (getReactor() != null && fluid == FluidRegistry.WATER);
return (getReactor() != null && fluid == FluidRegistry.WATER && !fluidEject);
}
@Override
public boolean canDrain(ForgeDirection from, Fluid fluid)
{
return (getReactor() != null && fluid == FluidRegistry.WATER);
return (getReactor() != null && fluid == FluidRegistry.getFluid("steam"));
}
@Override
@ -363,4 +414,26 @@ public class TileEntityReactorPort extends TileEntityReactorBlock implements IFl
return false;
}
@Override
public boolean onSneakRightClick(EntityPlayer player, int side)
{
if(!worldObj.isRemote)
{
fluidEject = !fluidEject;
String modeText = " " + (fluidEject ? EnumColor.DARK_RED : EnumColor.DARK_GREEN) + LangUtils.transOutputInput(fluidEject) + ".";
player.addChatMessage(new ChatComponentText(EnumColor.DARK_BLUE + "[Mekanism] " + EnumColor.GREY + LangUtils.localize("tooltip.configurator.reactorPortEject") + modeText));
Mekanism.packetHandler.sendToReceivers(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())), new Range4D(Coord4D.get(this)));
markDirty();
}
return true;
}
@Override
public boolean onRightClick(EntityPlayer player, int side)
{
return false;
}
}

View file

@ -14,6 +14,7 @@ import mekanism.common.multiblock.MultiblockCache;
import mekanism.common.multiblock.MultiblockManager;
import mekanism.common.multiblock.UpdateProtocol;
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
import mekanism.common.tile.TileEntityGasTank.GasMode;
import mekanism.common.tile.TileEntityMultiblock;
import mekanism.common.util.LangUtils;
import mekanism.common.util.MekanismUtils;
@ -86,6 +87,16 @@ public class TileEntityTurbineCasing extends TileEntityMultiblock<SynchronizedTu
structure.clientFlow = 0;
}
if(structure.dumpMode == GasMode.DUMPING && structure.fluidStored != null)
{
structure.fluidStored.amount -= Math.min(structure.fluidStored.amount, Math.max(structure.fluidStored.amount/50, structure.lastSteamInput*2));
if(structure.fluidStored.amount == 0)
{
structure.fluidStored = null;
}
}
float newRotation = (float)flowRate;
boolean needsRotationUpdate = false;
@ -174,6 +185,7 @@ public class TileEntityTurbineCasing extends TileEntityMultiblock<SynchronizedTu
data.add(structure.electricityStored);
data.add(structure.clientFlow);
data.add(structure.lastSteamInput);
data.add(structure.dumpMode.ordinal());
if(structure.fluidStored != null)
{
@ -198,6 +210,21 @@ public class TileEntityTurbineCasing extends TileEntityMultiblock<SynchronizedTu
@Override
public void handlePacketData(ByteBuf dataStream)
{
if(!worldObj.isRemote)
{
if(structure != null)
{
byte type = dataStream.readByte();
if(type == 0)
{
structure.dumpMode = GasMode.values()[structure.dumpMode.ordinal() == GasMode.values().length-1 ? 0 : structure.dumpMode.ordinal()+1];
}
}
return;
}
super.handlePacketData(dataStream);
if(worldObj.isRemote)
@ -213,6 +240,7 @@ public class TileEntityTurbineCasing extends TileEntityMultiblock<SynchronizedTu
structure.electricityStored = dataStream.readDouble();
structure.clientFlow = dataStream.readInt();
structure.lastSteamInput = dataStream.readInt();
structure.dumpMode = GasMode.values()[dataStream.readInt()];
if(dataStream.readInt() == 1)
{

View file

@ -11,6 +11,7 @@ import java.util.EnumSet;
import mekanism.api.Coord4D;
import mekanism.api.MekanismConfig.general;
import mekanism.common.base.IEnergyWrapper;
import mekanism.common.tile.TileEntityGasTank.GasMode;
import mekanism.common.util.CableUtils;
import mekanism.common.util.LangUtils;
import mekanism.common.util.MekanismUtils;
@ -359,31 +360,23 @@ public class TileEntityTurbineValve extends TileEntityTurbineCasing implements I
structure.newSteamInput += filled;
}
if(filled < structure.getFluidCapacity() && structure.dumpMode != GasMode.IDLE)
{
filled = structure.getFluidCapacity();
}
return filled;
}
@Override
public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain)
{
if(structure != null && structure.fluidStored != null)
{
if(resource.getFluid() == structure.fluidStored.getFluid())
{
return fluidTank.drain(resource.amount, doDrain);
}
}
return null;
}
@Override
public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain)
{
if(structure != null)
{
return fluidTank.drain(maxDrain, doDrain);
}
return null;
}
@ -401,7 +394,7 @@ public class TileEntityTurbineValve extends TileEntityTurbineCasing implements I
@Override
public boolean canDrain(ForgeDirection from, Fluid fluid)
{
return ((!worldObj.isRemote && structure != null) || (worldObj.isRemote && clientHasStructure));
return false;
}
@Override

View file

@ -29,7 +29,7 @@ import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
@Mod(modid = "MekanismTools", name = "MekanismTools", version = "9.0.2", dependencies = "required-after:Mekanism", guiFactory = "mekanism.tools.client.gui.ToolsGuiFactory")
@Mod(modid = "MekanismTools", name = "MekanismTools", version = "9.0.3", dependencies = "required-after:Mekanism", guiFactory = "mekanism.tools.client.gui.ToolsGuiFactory")
public class MekanismTools implements IModule
{
@SidedProxy(clientSide = "mekanism.tools.client.ToolsClientProxy", serverSide = "mekanism.tools.common.ToolsCommonProxy")
@ -39,7 +39,7 @@ public class MekanismTools implements IModule
public static MekanismTools instance;
/** MekanismTools version number */
public static Version versionNumber = new Version(9, 0, 2);
public static Version versionNumber = new Version(9, 0, 3);
//Enums: Tools
public static ToolMaterial toolOBSIDIAN;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 4 KiB

File diff suppressed because it is too large Load diff

View file

@ -698,6 +698,7 @@ tooltip.configurator.plenisherReset=Reset Fluidic Plenisher calculation
tooltip.configurator.inductionPortMode=Toggled Induction Port transfer mode to
tooltip.configurator.toggleColor=Color bumped to
tooltip.configurator.viewColor=Current color
tooltip.configurator.reactorPortEject=Toggled Reactor Port eject mode to
tooltip.upgrade.speed=Speed
tooltip.upgrade.energy=Energy

View file

@ -95,11 +95,11 @@ tile.BasicBlock.StructuralGlass.name=構造用ガラス
tile.BasicBlock.DynamicValve.name=ダイナミックバルブ
tile.BasicBlock.CopperBlock.name=銅ブロック
tile.BasicBlock.TinBlock.name=錫ブロック
tile.BasicBlock.ThermalEvaporationController.name=加温採鹹コントローラ
tile.BasicBlock.ThermalEvaporationValve.name=加温採鹹バルブ
tile.BasicBlock.ThermalEvaporationController.name=加温蒸発濃縮コントローラ
tile.BasicBlock.ThermalEvaporationValve.name=加温蒸発濃縮バルブ
//Basic Block 2 (second ID iteration)
tile.BasicBlock2.ThermalEvaporationBlock.name=加温採鹹ブロック
tile.BasicBlock2.ThermalEvaporationBlock.name=加温蒸発濃縮ブロック
tile.BasicBlock2.InductionCasing.name=インダクションケーシング
tile.BasicBlock2.InductionPort.name=インダクションポート
tile.BasicBlock2.InductionCellBasic.name=ベーシックインダクションセル
@ -522,7 +522,7 @@ gui.coils=コイル数
gui.dispersers=圧力分散器
gui.vents=蒸気排出口
gui.maxProduction=最大発電量
gui.limiting=限
gui.limiting=限定的
gui.steamInput=蒸気搬入量
gui.capacity=容量
gui.unit=単位
@ -782,13 +782,13 @@ tooltip.SteelCasing=頑丈な鋼鉄製の筐体です。マシンの作成に使
tooltip.DynamicTank=ダイナミックタンクの組み立てに使います。沢山の液体を貯蔵します。
tooltip.StructuralGlass=強化されたガラスで破壊してもアイテム化します。マルチブロックの窓として使用することが出来ます。
tooltip.DynamicValve=ダイナミックタンクの組み立てに使います。パイプからの液体の搬入出をサポートします。
tooltip.ThermalEvaporationController=加温採鹹装置の根幹となるブロックです。加温採鹹装置に一つだけ置くことが出来ます。
tooltip.ThermalEvaporationValve=加温採鹹装置のバルブです。パイプからの液体の搬入出をサポートします。
tooltip.ThermalEvaporationBlock=加温採鹹装置の組み立てに使う銅合金製の筐体です。処理に必要な沢山の熱を素材が伝導します。
tooltip.InductionCasing=大なエネルギーに耐えられる筐体です。インダクションマトリックスの組み立てに使います。
tooltip.InductionPort=インダクションマトリックスの組み立てに使い、インダクションマトリックスのエネルギーの搬入出を担います。
tooltip.InductionCell=大なエネルギーを蓄えることが出来る、高伝導性のキャパシタです。 インダクションマトリックスの内部に組み込んで、蓄電容量を増大するのに使用します。
tooltip.InductionProvider=先進的な冷却システム、伝導体と変圧器の統合体です。 インダクションマトリックスの内部に組み込み、エネルギーの入出力上限を増強するのに使います。
tooltip.ThermalEvaporationController=加温蒸発濃縮装置の根幹となるブロックです。加温蒸発濃縮装置につき一つだけ置くことが出来ます。
tooltip.ThermalEvaporationValve=加温蒸発濃縮装置のバルブです。サーモダイナミックコンダクターからの導熱、パイプからの液体の搬入出をサポートします。
tooltip.ThermalEvaporationBlock=加温蒸発濃縮装置の組み立てに使う銅合金製の筐体です。処理に必要な沢山の熱を素材が伝導します。
tooltip.InductionCasing=大なエネルギーに耐えられる筐体です。インダクションマトリックスの組み立てに使います。
tooltip.InductionPort=インダクションマトリックスの組み立てに用い、インダクションマトリックスにおけるエネルギーの搬入出を担います。
tooltip.InductionCell=大なエネルギーを蓄えることが出来る、高伝導性のキャパシタです。 インダクションマトリックスの内部に組み込み、蓄電容量を増やします。
tooltip.InductionProvider=先進的な冷却システム、伝導体と変圧器の統合体です。 インダクションマトリックスの内部に組み込み、エネルギーの入出力上限を増やします。
tooltip.SuperheatingElement=周囲に高熱を放出する、何だか危ない部品です。
tooltip.PressureDisperser=蒸気を分散させるためのマルチブロックの部品です。 蒸気の流れを適切に制御するために、隙間なく水平に置く必要があります。
tooltip.BoilerCasing=耐圧性の高密な筐体です。ボイラー室の組み立てに使います。

View file

@ -49,7 +49,7 @@
"tile.gen.gas": {"category": "block", "sounds": [{"name": "GasGenerator", "stream": false}]},
"tile.gen.heat": {"category": "block", "sounds": [{"name": "HeatGenerator", "stream": false}]},
"tile.gen.solar": {"category": "block", "sounds": [{"name": "SolarGenerator", "stream": false}]},
"tile.gen.wind": {"category": "block", "sounds": [{"name": "WindTurbine", "stream": false}]},
"tile.gen.wind": {"category": "weather", "sounds": [{"name": "WindTurbine", "stream": false}]},
"item.flamethrower.idle": {"category": "player", "sounds": [{"name": "FlamethrowerIdle", "stream": false}]},
"item.flamethrower.active": {"category": "player", "sounds": [{"name": "FlamethrowerActive", "stream": false}]},