Skip to content

Commit

Permalink
make less merge conflicts for brachy
Browse files Browse the repository at this point in the history
  • Loading branch information
serenibyss committed Aug 6, 2021
1 parent b7e2f15 commit 455cd7b
Show file tree
Hide file tree
Showing 35 changed files with 148 additions and 150 deletions.
6 changes: 3 additions & 3 deletions src/main/java/gregtech/api/unification/material/Material.java
Original file line number Diff line number Diff line change
Expand Up @@ -747,17 +747,17 @@ public Builder addOreByproducts(Material... byproducts) {
}

public Builder cableProperties(long voltage, int amperage, int loss) {
properties.setProperty(PropertyKey.WIRE, new WireProperty((int) voltage, amperage, loss));
properties.setProperty(PropertyKey.WIRE, new WireProperties((int) voltage, amperage, loss));
return this;
}

public Builder fluidPipeProperties(int maxTemp, int throughput, boolean gasProof) {
properties.setProperty(PropertyKey.FLUID_PIPE, new FluidPipeProperty(maxTemp, throughput, gasProof));
properties.setProperty(PropertyKey.FLUID_PIPE, new FluidPipeProperties(maxTemp, throughput, gasProof));
return this;
}

public Builder itemPipeProperties(int priority, float stacksPerSec) {
properties.setProperty(PropertyKey.ITEM_PIPE, new ItemPipeProperty(priority, stacksPerSec));
properties.setProperty(PropertyKey.ITEM_PIPE, new ItemPipeProperties(priority, stacksPerSec));
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

import java.util.Objects;

public class FluidPipeProperty implements IMaterialProperty<FluidPipeProperty> {
public class FluidPipeProperties implements IMaterialProperty<FluidPipeProperties> {

public final int maxFluidTemperature;
public final int throughput;
public final boolean gasProof;

public FluidPipeProperty(int maxFluidTemperature, int throughput, boolean gasProof) {
public FluidPipeProperties(int maxFluidTemperature, int throughput, boolean gasProof) {
this.maxFluidTemperature = maxFluidTemperature;
this.throughput = throughput;
this.gasProof = gasProof;
Expand All @@ -17,7 +17,7 @@ public FluidPipeProperty(int maxFluidTemperature, int throughput, boolean gasPro
/**
* Default property constructor.
*/
public FluidPipeProperty() {
public FluidPipeProperties() {
this(300, 1, false);
}

Expand All @@ -35,8 +35,8 @@ public void verifyProperty(MaterialProperties properties) {
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof FluidPipeProperty)) return false;
FluidPipeProperty that = (FluidPipeProperty) o;
if (!(o instanceof FluidPipeProperties)) return false;
FluidPipeProperties that = (FluidPipeProperties) o;
return maxFluidTemperature == that.maxFluidTemperature &&
throughput == that.throughput;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import java.util.Objects;

public class ItemPipeProperty implements IMaterialProperty<ItemPipeProperty> {
public class ItemPipeProperties implements IMaterialProperty<ItemPipeProperties> {

/**
* Items will try to take the path with the lowest priority
Expand All @@ -14,15 +14,15 @@ public class ItemPipeProperty implements IMaterialProperty<ItemPipeProperty> {
*/
public final float transferRate;

public ItemPipeProperty(int priority, float transferRate) {
public ItemPipeProperties(int priority, float transferRate) {
this.priority = priority;
this.transferRate = transferRate;
}

/**
* Default property constructor.
*/
public ItemPipeProperty() {
public ItemPipeProperties() {
this(1, 0.25f);
}

Expand All @@ -41,7 +41,7 @@ public void verifyProperty(MaterialProperties properties) {
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ItemPipeProperty that = (ItemPipeProperty) o;
ItemPipeProperties that = (ItemPipeProperties) o;
return priority == that.priority && Float.compare(that.transferRate, transferRate) == 0;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ public class PropertyKey<T extends IMaterialProperty<T>> {

public static final PropertyKey<BlastProperty> BLAST = new PropertyKey<>("blast", BlastProperty.class);
public static final PropertyKey<DustProperty> DUST = new PropertyKey<>("dust", DustProperty.class);
public static final PropertyKey<FluidPipeProperty> FLUID_PIPE = new PropertyKey<>("fluid_pipe", FluidPipeProperty.class);
public static final PropertyKey<FluidPipeProperties> FLUID_PIPE = new PropertyKey<>("fluid_pipe", FluidPipeProperties.class);
public static final PropertyKey<FluidProperty> FLUID = new PropertyKey<>("fluid", FluidProperty.class);
public static final PropertyKey<GemProperty> GEM = new PropertyKey<>("gem", GemProperty.class);
public static final PropertyKey<IngotProperty> INGOT = new PropertyKey<>("ingot", IngotProperty.class);
public static final PropertyKey<ItemPipeProperty> ITEM_PIPE = new PropertyKey<>("item_pipe", ItemPipeProperty.class);
public static final PropertyKey<ItemPipeProperties> ITEM_PIPE = new PropertyKey<>("item_pipe", ItemPipeProperties.class);
public static final PropertyKey<OreProperty> ORE = new PropertyKey<>("ore", OreProperty.class);
public static final PropertyKey<PlasmaProperty> PLASMA = new PropertyKey<>("plasma", PlasmaProperty.class);
public static final PropertyKey<ToolProperty> TOOL = new PropertyKey<>("tool", ToolProperty.class);
public static final PropertyKey<WireProperty> WIRE = new PropertyKey<>("wire", WireProperty.class);
public static final PropertyKey<WireProperties> WIRE = new PropertyKey<>("wire", WireProperties.class);

private final String key;
private final Class<T> type;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

import java.util.Objects;

public class WireProperty implements IMaterialProperty<WireProperty> {
public class WireProperties implements IMaterialProperty<WireProperties> {

public final int voltage;
public final int amperage;
public final int lossPerBlock;

public WireProperty(int voltage, int baseAmperage, int lossPerBlock) {
public WireProperties(int voltage, int baseAmperage, int lossPerBlock) {
this.voltage = voltage;
this.amperage = baseAmperage;
this.lossPerBlock = lossPerBlock;
Expand All @@ -17,7 +17,7 @@ public WireProperty(int voltage, int baseAmperage, int lossPerBlock) {
/**
* Default values constructor
*/
public WireProperty() {
public WireProperties() {
this(8, 1, 1);
}

Expand All @@ -29,8 +29,8 @@ public void verifyProperty(MaterialProperties properties) {
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof WireProperty)) return false;
WireProperty that = (WireProperty) o;
if (!(o instanceof WireProperties)) return false;
WireProperties that = (WireProperties) o;
return voltage == that.voltage &&
amperage == that.amperage &&
lossPerBlock == that.lossPerBlock;
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/gregtech/common/blocks/MetaBlocks.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import gregtech.api.unification.material.Material;
import gregtech.api.unification.material.MaterialRegistry;
import gregtech.api.unification.material.Materials;
import gregtech.api.unification.material.properties.FluidPipeProperty;
import gregtech.api.unification.material.properties.FluidPipeProperties;
import gregtech.api.unification.material.properties.PropertyKey;
import gregtech.api.unification.ore.OrePrefix;
import gregtech.api.unification.ore.StoneType;
Expand Down Expand Up @@ -212,7 +212,7 @@ public static void init() {
}
}
for (BlockFluidPipe pipe : FLUID_PIPES) {
pipe.addPipeMaterial(Materials.Wood, new FluidPipeProperty(310, 5, false));
pipe.addPipeMaterial(Materials.Wood, new FluidPipeProperties(310, 5, false));
}
for (BlockCable cable : CABLES) {
// cable.addCableMaterial(MarkerMaterials.Tier.Superconductor, new WireProperty(Integer.MAX_VALUE, 4, 0)); todo fix
Expand Down
20 changes: 10 additions & 10 deletions src/main/java/gregtech/common/pipelike/cable/BlockCable.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import gregtech.api.pipenet.tile.IPipeTile;
import gregtech.api.pipenet.tile.TileEntityPipeBase;
import gregtech.api.unification.material.MaterialRegistry;
import gregtech.api.unification.material.properties.WireProperty;
import gregtech.api.unification.material.properties.WireProperties;
import gregtech.api.unification.material.Material;
import gregtech.api.util.GTUtility;
import gregtech.common.ConfigHolder;
Expand Down Expand Up @@ -43,16 +43,16 @@
import java.util.Map;
import java.util.TreeMap;

public class BlockCable extends BlockMaterialPipe<Insulation, WireProperty, WorldENet> implements ITileEntityProvider {
public class BlockCable extends BlockMaterialPipe<Insulation, WireProperties, WorldENet> implements ITileEntityProvider {

private final Map<Material, WireProperty> enabledMaterials = new TreeMap<>();
private final Map<Material, WireProperties> enabledMaterials = new TreeMap<>();

public BlockCable(Insulation cableType) {
super(cableType);
setHarvestLevel("cutter", 1);
}

public void addCableMaterial(Material material, WireProperty wireProperties) {
public void addCableMaterial(Material material, WireProperties wireProperties) {
Preconditions.checkNotNull(material, "material");
Preconditions.checkNotNull(wireProperties, "wireProperties");
Preconditions.checkArgument(MaterialRegistry.MATERIAL_REGISTRY.getNameForObject(material) != null, "material is not registered");
Expand All @@ -71,12 +71,12 @@ public Class<Insulation> getPipeTypeClass() {
}

@Override
protected WireProperty createProperties(Insulation insulation, Material material) {
protected WireProperties createProperties(Insulation insulation, Material material) {
return insulation.modifyProperties(enabledMaterials.getOrDefault(material, getFallbackType()));
}

@Override
protected WireProperty getFallbackType() {
protected WireProperties getFallbackType() {
return enabledMaterials.values().iterator().next();
}

Expand All @@ -93,7 +93,7 @@ public void getSubBlocks(CreativeTabs itemIn, NonNullList<ItemStack> items) {
}

@Override
public int onPipeToolUsed(ItemStack stack, EnumFacing coverSide, IPipeTile<Insulation, WireProperty> pipeTile, EntityPlayer entityPlayer) {
public int onPipeToolUsed(ItemStack stack, EnumFacing coverSide, IPipeTile<Insulation, WireProperties> pipeTile, EntityPlayer entityPlayer) {
ICutterItem cutterItem = stack.getCapability(GregtechCapabilities.CAPABILITY_CUTTER, null);
if (cutterItem != null) {
if (cutterItem.damageItem(DamageValues.DAMAGE_FOR_CUTTER, true)) {
Expand All @@ -111,12 +111,12 @@ public int onPipeToolUsed(ItemStack stack, EnumFacing coverSide, IPipeTile<Insul
}

@Override
public boolean canPipesConnect(IPipeTile<Insulation, WireProperty> selfTile, EnumFacing side, IPipeTile<Insulation, WireProperty> sideTile) {
public boolean canPipesConnect(IPipeTile<Insulation, WireProperties> selfTile, EnumFacing side, IPipeTile<Insulation, WireProperties> sideTile) {
return true;
}

@Override
public boolean canPipeConnectToBlock(IPipeTile<Insulation, WireProperty> selfTile, EnumFacing side, TileEntity tile) {
public boolean canPipeConnectToBlock(IPipeTile<Insulation, WireProperties> selfTile, EnumFacing side, TileEntity tile) {
return tile != null && tile.getCapability(GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER, side.getOpposite()) != null;
}

Expand Down Expand Up @@ -148,7 +148,7 @@ public EnumBlockRenderType getRenderType(@Nonnull IBlockState state) {
}

@Override
public TileEntityPipeBase<Insulation, WireProperty> createNewTileEntity(boolean supportsTicking) {
public TileEntityPipeBase<Insulation, WireProperties> createNewTileEntity(boolean supportsTicking) {
return supportsTicking ? new TileEntityCableTickable() : new TileEntityCable();
}

Expand Down
8 changes: 4 additions & 4 deletions src/main/java/gregtech/common/pipelike/cable/Insulation.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package gregtech.common.pipelike.cable;

import gregtech.api.pipenet.block.material.IMaterialPipeType;
import gregtech.api.unification.material.properties.WireProperty;
import gregtech.api.unification.material.properties.WireProperties;
import gregtech.api.unification.ore.OrePrefix;
import gregtech.common.ConfigHolder;

public enum Insulation implements IMaterialPipeType<WireProperty> {
public enum Insulation implements IMaterialPipeType<WireProperties> {

WIRE_SINGLE("wire_single", 0.1f, 1, 2, OrePrefix.wireGtSingle, -1),
WIRE_DOUBLE("wire_double", 0.2f, 2, 2, OrePrefix.wireGtDouble, -1),
Expand Down Expand Up @@ -52,14 +52,14 @@ public OrePrefix getOrePrefix() {


@Override
public WireProperty modifyProperties(WireProperty baseProperties) {
public WireProperties modifyProperties(WireProperties baseProperties) {

int lossPerBlock;
if (ConfigHolder.doLosslessWiresMakeLossyCables && baseProperties.lossPerBlock == 0)
lossPerBlock = (int)(0.75 * lossMultiplier);
else lossPerBlock = baseProperties.lossPerBlock * lossMultiplier;

return new WireProperty(baseProperties.voltage, baseProperties.amperage * amperage, lossPerBlock);
return new WireProperties(baseProperties.voltage, baseProperties.amperage * amperage, lossPerBlock);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import gregtech.api.GTValues;
import gregtech.api.pipenet.block.material.ItemBlockMaterialPipe;
import gregtech.api.unification.material.properties.WireProperty;
import gregtech.api.unification.material.properties.WireProperties;
import gregtech.api.util.GTUtility;
import net.minecraft.client.resources.I18n;
import net.minecraft.client.util.ITooltipFlag;
Expand All @@ -14,7 +14,7 @@
import javax.annotation.Nullable;
import java.util.List;

public class ItemBlockCable extends ItemBlockMaterialPipe<Insulation, WireProperty> {
public class ItemBlockCable extends ItemBlockMaterialPipe<Insulation, WireProperties> {

public ItemBlockCable(BlockCable block) {
super(block);
Expand All @@ -23,7 +23,7 @@ public ItemBlockCable(BlockCable block) {
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, @Nullable World worldIn, List<String> tooltip, ITooltipFlag flagIn) {
WireProperty wireProperties = blockPipe.createItemProperties(stack);
WireProperties wireProperties = blockPipe.createItemProperties(stack);
String voltageName = GTValues.VN[GTUtility.getTierByVoltage(wireProperties.voltage)];
tooltip.add(I18n.format("gregtech.cable.voltage", wireProperties.voltage, voltageName));
tooltip.add(I18n.format("gregtech.cable.amperage", wireProperties.amperage));
Expand Down
16 changes: 8 additions & 8 deletions src/main/java/gregtech/common/pipelike/cable/net/EnergyNet.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import gregtech.api.pipenet.PipeNet;
import gregtech.api.pipenet.WorldPipeNet;
import gregtech.api.util.PerTickLongCounter;
import gregtech.api.unification.material.properties.WireProperty;
import gregtech.api.unification.material.properties.WireProperties;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
Expand All @@ -15,12 +15,12 @@
import java.util.List;
import java.util.Stack;

public class EnergyNet extends PipeNet<WireProperty> {
public class EnergyNet extends PipeNet<WireProperties> {

private final PerTickLongCounter currentAmperageCounter = new PerTickLongCounter(0L);
private final PerTickLongCounter currentMaxVoltageCounter = new PerTickLongCounter(0L);

protected EnergyNet(WorldPipeNet<WireProperty, EnergyNet> world) {
protected EnergyNet(WorldPipeNet<WireProperties, EnergyNet> world) {
super(world);
}

Expand All @@ -43,7 +43,7 @@ public void incrementCurrentAmperage(long amperage, long voltage) {
public List<RoutePath> computePatches(BlockPos startPos) {
ArrayList<RoutePath> readyPaths = new ArrayList<>();
RoutePath currentPath = new RoutePath();
Node<WireProperty> firstNode = getNodeAt(startPos);
Node<WireProperties> firstNode = getNodeAt(startPos);
currentPath.path.put(startPos, firstNode.data);
readyPaths.add(currentPath.cloneAndCompute(startPos));
HashSet<BlockPos> observedSet = new HashSet<>();
Expand All @@ -54,7 +54,7 @@ public List<RoutePath> computePatches(BlockPos startPos) {
while (true) {
for (EnumFacing facing : EnumFacing.VALUES) {
currentPos.move(facing);
Node<WireProperty> secondNode = getNodeAt(currentPos);
Node<WireProperties> secondNode = getNodeAt(currentPos);
if (secondNode != null && canNodesConnect(firstNode, facing, secondNode, this) && !observedSet.contains(currentPos)) {
BlockPos immutablePos = currentPos.toImmutable();
observedSet.add(immutablePos);
Expand Down Expand Up @@ -82,17 +82,17 @@ public List<RoutePath> computePatches(BlockPos startPos) {


@Override
protected void writeNodeData(WireProperty nodeData, NBTTagCompound tagCompound) {
protected void writeNodeData(WireProperties nodeData, NBTTagCompound tagCompound) {
tagCompound.setInteger("voltage", nodeData.voltage);
tagCompound.setInteger("amperage", nodeData.amperage);
tagCompound.setInteger("loss", nodeData.lossPerBlock);
}

@Override
protected WireProperty readNodeData(NBTTagCompound tagCompound) {
protected WireProperties readNodeData(NBTTagCompound tagCompound) {
int voltage = tagCompound.getInteger("voltage");
int amperage = tagCompound.getInteger("amperage");
int lossPerBlock = tagCompound.getInteger("loss");
return new WireProperty(voltage, amperage, lossPerBlock);
return new WireProperties(voltage, amperage, lossPerBlock);
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package gregtech.common.pipelike.cable.net;

import gregtech.api.unification.material.properties.WireProperty;
import gregtech.api.unification.material.properties.WireProperties;
import gregtech.common.pipelike.cable.tile.TileEntityCable;
import net.minecraft.init.Blocks;
import net.minecraft.tileentity.TileEntity;
Expand All @@ -14,7 +14,7 @@
public class RoutePath {

public BlockPos destination;
public HashMap<BlockPos, WireProperty> path = new HashMap<>();
public HashMap<BlockPos, WireProperties> path = new HashMap<>();
public int maxAmperage = Integer.MAX_VALUE;
public int minVoltage = Integer.MAX_VALUE;
public int totalLoss;
Expand All @@ -23,7 +23,7 @@ public RoutePath cloneAndCompute(BlockPos destination) {
RoutePath newPath = new RoutePath();
newPath.path = new HashMap<>(path);
newPath.destination = destination;
for (WireProperty wireProperties : path.values()) {
for (WireProperties wireProperties : path.values()) {
newPath.maxAmperage = Math.min(newPath.maxAmperage, wireProperties.amperage);
newPath.minVoltage = Math.min(newPath.minVoltage, wireProperties.voltage);
newPath.totalLoss += wireProperties.lossPerBlock;
Expand All @@ -33,7 +33,7 @@ public RoutePath cloneAndCompute(BlockPos destination) {

public boolean burnCablesInPath(World world, long voltage, long amperage) {
for (BlockPos blockPos : path.keySet()) {
WireProperty wireProperties = path.get(blockPos);
WireProperties wireProperties = path.get(blockPos);
if (voltage > wireProperties.voltage || amperage > wireProperties.amperage) {
TileEntity tileEntity = world.getTileEntity(blockPos);
if (tileEntity instanceof TileEntityCable) {
Expand Down
Loading

0 comments on commit 455cd7b

Please sign in to comment.