mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-26 06:42:56 +00:00
Generalized some of the multiblock code into a stricter format
This commit is contained in:
1 parent
8f6cf7e1c9
commit
c97f617692
4 files changed
+91
-57
No files matched your search
@@ -4,25 +4,14 @@ import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import mekanism.api.Coord4D;
|
||||
import mekanism.common.multiblock.SynchronizedData;
|
||||
import mekanism.common.util.FluidContainerUtils.ContainerEditMode;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
public class SynchronizedTankData
|
||||
public class SynchronizedTankData extends SynchronizedData<SynchronizedTankData>
|
||||
{
|
||||
public Set<Coord4D> locations = new HashSet<Coord4D>();
|
||||
|
||||
public int volLength;
|
||||
|
||||
public int volWidth;
|
||||
|
||||
public int volHeight;
|
||||
|
||||
public int volume;
|
||||
|
||||
public int inventoryID;
|
||||
|
||||
public FluidStack fluidStored;
|
||||
|
||||
public ContainerEditMode editMode = ContainerEditMode.BOTH;
|
||||
@@ -37,46 +26,6 @@ public class SynchronizedTankData
|
||||
|
||||
public Set<ValveData> valves = new HashSet<ValveData>();
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
int code = 1;
|
||||
code = 31 * locations.hashCode();
|
||||
code = 31 * volLength;
|
||||
code = 31 * volWidth;
|
||||
code = 31 * volHeight;
|
||||
code = 31 * volume;
|
||||
return code;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
if(!(obj instanceof SynchronizedTankData))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
SynchronizedTankData data = (SynchronizedTankData)obj;
|
||||
|
||||
if(!data.locations.equals(locations))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if(data.volLength != volLength || data.volWidth != volWidth || data.volHeight != volHeight)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if(data.volume != volume)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static class ValveData
|
||||
{
|
||||
public ForgeDirection side;
|
||||
|
||||
Reference in new issue
Block a user