mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-25 14:24:35 +00:00
Merge branch 'development' into 1.9.4
* development: Update pt_BR.lang Allow shift-right clicking machines with upgrades Fixed NBT reference losses Fixed Thermal Evaporation Controller computer integration Add config option for transmitter alloy upgrades Fixed transmitter crash, fixed entangloporter frequency issue, fixed PRC muffling upgrades Conflicts: src/main/java/mekanism/client/render/RenderPartTransmitter.java src/main/java/mekanism/common/FluidNetwork.java src/main/java/mekanism/common/item/ItemAlloy.java src/main/java/mekanism/common/item/ItemUpgrade.java src/main/java/mekanism/common/util/PipeUtils.java
This commit is contained in:
commit
a5f4457677
17 files changed
+296
-114
No files matched your search
@@ -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
|
||||
|
||||
@@ -261,6 +261,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();
|
||||
|
||||
@@ -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.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
@@ -164,7 +165,7 @@ public class FluidNetwork extends DynamicNetwork<IFluidHandler, FluidNetwork>
|
||||
|
||||
if(acceptor != null && fluidToSend != null)
|
||||
{
|
||||
fluidSent += acceptor.fill(side, new FluidStack(fluidToSend.getFluid(), currentSending), doTransfer);
|
||||
fluidSent += acceptor.fill(side, PipeUtils.copy(fluidToSend, currentSending), doTransfer);
|
||||
}
|
||||
|
||||
if(fluidSent > prev)
|
||||
|
||||
@@ -47,6 +47,7 @@ import mekanism.common.tile.TileEntityMetallurgicInfuser;
|
||||
import mekanism.common.tile.TileEntityPersonalChest;
|
||||
import mekanism.common.util.ItemDataUtils;
|
||||
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;
|
||||
@@ -791,7 +792,7 @@ public abstract class BlockMachine extends BlockContainer implements ICTMBlock
|
||||
|
||||
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;
|
||||
|
||||
@@ -91,7 +91,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");
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package mekanism.common.item;
|
||||
|
||||
import mekanism.api.IAlloyInteraction;
|
||||
import mekanism.api.MekanismConfig.general;
|
||||
import mekanism.api.capabilities.Capabilities;
|
||||
import mekanism.api.util.CapabilityUtils;
|
||||
import mekanism.common.MekanismItems;
|
||||
@@ -25,7 +26,7 @@ public class ItemAlloy extends ItemMekanism
|
||||
{
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
|
||||
if(CapabilityUtils.hasCapability(tile, Capabilities.ALLOY_INTERACTION_CAPABILITY, side))
|
||||
if(general.allowTransmitterAlloyUpgrade && CapabilityUtils.hasCapability(tile, Capabilities.ALLOY_INTERACTION_CAPABILITY, side))
|
||||
{
|
||||
if(!world.isRemote)
|
||||
{
|
||||
|
||||
@@ -41,6 +41,7 @@ import mekanism.common.tile.TileEntityFluidTank;
|
||||
import mekanism.common.util.ItemDataUtils;
|
||||
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;
|
||||
@@ -830,7 +831,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;
|
||||
@@ -848,7 +849,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)
|
||||
{
|
||||
|
||||
@@ -8,6 +8,7 @@ import mekanism.api.gas.IGasItem;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.util.ItemDataUtils;
|
||||
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;
|
||||
@@ -158,7 +159,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;
|
||||
@@ -171,7 +172,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)
|
||||
{
|
||||
|
||||
@@ -5,10 +5,18 @@ 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.util.EnumActionResult;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
@@ -43,4 +51,32 @@ public class ItemUpgrade extends ItemMekanism implements IUpgradeItem
|
||||
{
|
||||
return upgrade;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumActionResult onItemUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand)
|
||||
{
|
||||
if(player.isSneaking())
|
||||
{
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
Upgrade type = getUpgradeType(stack);
|
||||
|
||||
if(tile instanceof IUpgradeTile)
|
||||
{
|
||||
TileComponentUpgrade component = ((IUpgradeTile)tile).getComponent();
|
||||
|
||||
if(component.supports(type))
|
||||
{
|
||||
if(!world.isRemote && component.getUpgrades(type) < type.getMax())
|
||||
{
|
||||
component.addUpgrade(type);
|
||||
stack.stackSize--;
|
||||
}
|
||||
}
|
||||
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
return EnumActionResult.PASS;
|
||||
}
|
||||
}
|
||||
@@ -95,7 +95,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;
|
||||
|
||||
@@ -72,6 +72,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 : BlockStateMachine.MachineType.getValidMachines())
|
||||
{
|
||||
@@ -159,6 +160,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 : BlockStateMachine.MachineType.getValidMachines())
|
||||
{
|
||||
|
||||
@@ -24,6 +24,7 @@ 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.init.SoundEvents;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -190,13 +191,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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -211,13 +212,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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -492,7 +493,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 == EnumFacing.UP)
|
||||
|
||||
@@ -81,6 +81,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));
|
||||
|
||||
@@ -692,6 +692,12 @@ public class TileEntityThermalEvaporationController extends TileEntityThermalEva
|
||||
{
|
||||
return side != 0 && side != 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntityThermalEvaporationController getController()
|
||||
{
|
||||
return structured ? this : null;
|
||||
}
|
||||
|
||||
public void clearStructure()
|
||||
{
|
||||
|
||||
@@ -139,7 +139,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);
|
||||
}
|
||||
|
||||
@@ -125,10 +125,18 @@ public final class PipeUtils
|
||||
}
|
||||
|
||||
EnumFacing dir = EnumFacing.getFront(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;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user