-
Notifications
You must be signed in to change notification settings - Fork 178
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
292 additions
and
169 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
src/main/java/gregtech/api/nuclear/fission/CoolantRegistry.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,31 @@ | ||
package gregtech.api.nuclear.fission; | ||
|
||
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; | ||
|
||
import net.minecraftforge.fluids.Fluid; | ||
|
||
import org.jetbrains.annotations.NotNull; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
import java.util.Map; | ||
|
||
public class CoolantRegistry { | ||
private static final Map<Fluid, ICoolantStats> COOLANTS = new Object2ObjectOpenHashMap<>(); | ||
private static final Map<ICoolantStats, Fluid> COOLANTS_INVERSE = new Object2ObjectOpenHashMap<>(); | ||
|
||
|
||
public static void registerCoolant(@NotNull Fluid fluid, @NotNull ICoolantStats coolant) { | ||
COOLANTS.put(fluid, coolant); | ||
COOLANTS_INVERSE.put(coolant, fluid); | ||
} | ||
|
||
@Nullable | ||
public static ICoolantStats getCoolant(Fluid fluid) { | ||
return COOLANTS.get(fluid); | ||
} | ||
|
||
@Nullable | ||
public static Fluid originalFluid(ICoolantStats stats) { | ||
return COOLANTS_INVERSE.get(stats); | ||
} | ||
} |
38 changes: 38 additions & 0 deletions
38
src/main/java/gregtech/api/nuclear/fission/FissionFuelRegistry.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,43 @@ | ||
package gregtech.api.nuclear.fission; | ||
|
||
import gregtech.api.util.ItemStackHashStrategy; | ||
|
||
import it.unimi.dsi.fastutil.ints.Int2ObjectArrayMap; | ||
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenCustomHashMap; | ||
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; | ||
|
||
import net.minecraft.item.ItemStack; | ||
|
||
import org.jetbrains.annotations.NotNull; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
import java.util.Map; | ||
|
||
public class FissionFuelRegistry { | ||
private static final Map<Integer, IFissionFuelStats> HASHED_FUELS = new Int2ObjectArrayMap<>(); | ||
private static final Map<ItemStack, IFissionFuelStats> FUELS = new Object2ObjectOpenCustomHashMap<>( | ||
ItemStackHashStrategy.comparingAllButCount()); | ||
private static final Map<IFissionFuelStats, ItemStack> DEPLETED_FUELS = new Object2ObjectOpenHashMap<>(); | ||
|
||
|
||
public static void registerFuel(@NotNull ItemStack item, @NotNull IFissionFuelStats fuel, @NotNull ItemStack depletedFuel) { | ||
HASHED_FUELS.put(fuel.hashCode(), fuel); | ||
FUELS.put(item, fuel); | ||
DEPLETED_FUELS.put(fuel, depletedFuel); | ||
} | ||
|
||
@Nullable | ||
public static IFissionFuelStats getFissionFuel(ItemStack stack) { | ||
return FUELS.get(stack); | ||
} | ||
|
||
@Nullable | ||
public static IFissionFuelStats getFissionFuel(int hash) { | ||
return HASHED_FUELS.get(hash); | ||
} | ||
|
||
@Nullable | ||
public static ItemStack getDepletedFuel(IFissionFuelStats stats) { | ||
return DEPLETED_FUELS.get(stats); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.