Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public final static Fluid generateFluidNoPrefix(final String unlocalizedName, final String localizedName, final int MeltingPoint, final short[] RGBA){
- Fluid gtFluid;
- if (FluidUtils.getFluidStack(unlocalizedName.toLowerCase(), 1) == null){
- Logger.WARNING("Generating our own fluid.");
- gtFluid = FluidUtils.addGTFluidNoPrefix(
- unlocalizedName,
- localizedName,
- RGBA,
- 4,
- MeltingPoint,
- ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell"+unlocalizedName, 1),
- ItemList.Cell_Empty.get(1L, new Object[0]),
- 1000);
- }
- else {
- gtFluid = FluidUtils.getFluidStack(unlocalizedName.toLowerCase(), 1).getFluid();
- }
- //Generate a Cell if we need to
- if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell"+unlocalizedName, 1) == null){
- new BaseItemCell(unlocalizedName, localizedName, RGBA, gtFluid);
- }
- return gtFluid;
- }
- public static Fluid addGTFluidNoPrefix(final String aName, final String aLocalized, final short[] aRGBa, final int aState, final long aTemperatureK, final ItemStack aFullContainer, final ItemStack aEmptyContainer, final int aFluidAmount) {
- return addGTFluid(aName, "fluid.autogenerated", aLocalized, aRGBa, aState, aTemperatureK, aFullContainer, aEmptyContainer, aFluidAmount);
- }
- public static Fluid addGTFluid(String aName, final String aTexture, final String aLocalized, final short[] aRGBa, final int aState, final long aTemperatureK, final ItemStack aFullContainer, final ItemStack aEmptyContainer, final int aFluidAmount) {
- aName = Utils.sanitizeString(aName.toLowerCase());
- Fluid rFluid = new FluidGT6(aName, aTexture, (aRGBa != null) ? aRGBa : Dyes._NULL.getRGBA());
- GT_LanguageManager.addStringLocalization(rFluid.getUnlocalizedName(), (aLocalized == null) ? aName : aLocalized);
- if (FluidRegistry.registerFluid(rFluid)) {
- switch (aState) {
- case 0: {
- rFluid.setGaseous(false);
- rFluid.setViscosity(10000);
- break;
- }
- case 1:
- case 4: {
- rFluid.setGaseous(false);
- rFluid.setViscosity(1000);
- break;
- }
- case 2: {
- rFluid.setGaseous(true);
- rFluid.setDensity(-100);
- rFluid.setViscosity(200);
- break;
- }
- case 3: {
- rFluid.setGaseous(true);
- rFluid.setDensity(-10000);
- rFluid.setViscosity(10);
- rFluid.setLuminosity(15);
- break;
- }
- }
- }
- else {
- rFluid = FluidRegistry.getFluid(aName);
- }
- if ((rFluid.getTemperature() == new Fluid("test").getTemperature()) || (rFluid.getTemperature() <= 0)) {
- rFluid.setTemperature((int) (aTemperatureK));
- }
- if ((aFullContainer != null) && (aEmptyContainer != null) && !FluidContainerRegistry.registerFluidContainer(new FluidStack(rFluid, aFluidAmount), aFullContainer, aEmptyContainer)) {
- GT_Values.RA.addFluidCannerRecipe(aFullContainer, container(aFullContainer, false), null, new FluidStack(rFluid, aFluidAmount));
- }
- else {
- //Utils.LOG_INFO("Failed creating recipes to fill/empty cells of "+aName+".");
- }
- return rFluid;
- }
- package gtPlusPlus.api.objects.minecraft;
- import gregtech.api.GregTech_API;
- import gtPlusPlus.core.lib.CORE;
- import net.minecraftforge.fluids.Fluid;
- public class FluidGT6 extends Fluid implements Runnable
- {
- private final short[] mRGBa;
- public final String mTextureName;
- public FluidGT6(final String aName, final String aTextureName, final short[] aRGBa) {
- super(aName);
- this.mRGBa = aRGBa;
- this.mTextureName = aTextureName;
- if (GregTech_API.sGTBlockIconload != null) {
- GregTech_API.sGTBlockIconload.add(this);
- }
- }
- @Override
- public int getColor() {
- return (Math.max(0, Math.min(255, this.mRGBa[0])) << 16) | (Math.max(0, Math.min(255, this.mRGBa[1])) << 8) | Math.max(0, Math.min(255, this.mRGBa[2]));
- }
- @Override
- public void run() {
- this.setIcons(GregTech_API.sBlockIcons.registerIcon(CORE.MODID+ ":" + "fluids/fluid." + this.mTextureName));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement