Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 3.91 KB | None | 0 0
  1.     public final static Fluid generateFluidNoPrefix(final String unlocalizedName, final String localizedName, final int MeltingPoint, final short[] RGBA){
  2.         Fluid gtFluid;
  3.         if (FluidUtils.getFluidStack(unlocalizedName.toLowerCase(), 1) == null){
  4.             Logger.WARNING("Generating our own fluid.");
  5.             gtFluid = FluidUtils.addGTFluidNoPrefix(
  6.                     unlocalizedName,
  7.                     localizedName,
  8.                     RGBA,
  9.                     4,
  10.                     MeltingPoint,
  11.                     ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell"+unlocalizedName, 1),
  12.                     ItemList.Cell_Empty.get(1L, new Object[0]),
  13.                     1000);
  14.         }
  15.         else {
  16.             gtFluid = FluidUtils.getFluidStack(unlocalizedName.toLowerCase(), 1).getFluid();
  17.         }
  18.         //Generate a Cell if we need to
  19.         if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell"+unlocalizedName, 1) == null){
  20.             new BaseItemCell(unlocalizedName, localizedName, RGBA, gtFluid);
  21.         }
  22.         return gtFluid;
  23.     }
  24.  
  25. 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) {
  26.         return addGTFluid(aName, "fluid.autogenerated", aLocalized, aRGBa, aState, aTemperatureK, aFullContainer, aEmptyContainer, aFluidAmount);
  27.     }
  28.  
  29. 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) {
  30.         aName = Utils.sanitizeString(aName.toLowerCase());
  31.         Fluid rFluid = new FluidGT6(aName, aTexture, (aRGBa != null) ? aRGBa : Dyes._NULL.getRGBA());
  32.         GT_LanguageManager.addStringLocalization(rFluid.getUnlocalizedName(), (aLocalized == null) ? aName : aLocalized);
  33.         if (FluidRegistry.registerFluid(rFluid)) {
  34.             switch (aState) {
  35.                 case 0: {
  36.                     rFluid.setGaseous(false);
  37.                     rFluid.setViscosity(10000);
  38.                     break;
  39.                 }
  40.                 case 1:
  41.                 case 4: {
  42.                     rFluid.setGaseous(false);
  43.                     rFluid.setViscosity(1000);
  44.                     break;
  45.                 }
  46.                 case 2: {
  47.                     rFluid.setGaseous(true);
  48.                     rFluid.setDensity(-100);
  49.                     rFluid.setViscosity(200);
  50.                     break;
  51.                 }
  52.                 case 3: {
  53.                     rFluid.setGaseous(true);
  54.                     rFluid.setDensity(-10000);
  55.                     rFluid.setViscosity(10);
  56.                     rFluid.setLuminosity(15);
  57.                     break;
  58.                 }
  59.             }
  60.         }
  61.         else {
  62.             rFluid = FluidRegistry.getFluid(aName);
  63.         }
  64.         if ((rFluid.getTemperature() == new Fluid("test").getTemperature()) || (rFluid.getTemperature() <= 0)) {
  65.             rFluid.setTemperature((int) (aTemperatureK));
  66.         }
  67.         if ((aFullContainer != null) && (aEmptyContainer != null) && !FluidContainerRegistry.registerFluidContainer(new FluidStack(rFluid, aFluidAmount), aFullContainer, aEmptyContainer)) {
  68.             GT_Values.RA.addFluidCannerRecipe(aFullContainer, container(aFullContainer, false), null, new FluidStack(rFluid, aFluidAmount));
  69.         }
  70.         else {
  71.             //Utils.LOG_INFO("Failed creating recipes to fill/empty cells of "+aName+".");
  72.         }
  73.         return rFluid;
  74.     }
  75.  
  76.  
  77.  
  78.  
  79.  
  80.  
  81.  
  82.  
  83.  
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90. package gtPlusPlus.api.objects.minecraft;
  91.  
  92. import gregtech.api.GregTech_API;
  93. import gtPlusPlus.core.lib.CORE;
  94. import net.minecraftforge.fluids.Fluid;
  95.  
  96. public class FluidGT6 extends Fluid implements Runnable
  97. {
  98.     private final short[] mRGBa;
  99.     public final String mTextureName;
  100.  
  101.     public FluidGT6(final String aName, final String aTextureName, final short[] aRGBa) {
  102.         super(aName);
  103.         this.mRGBa = aRGBa;
  104.         this.mTextureName = aTextureName;
  105.         if (GregTech_API.sGTBlockIconload != null) {
  106.             GregTech_API.sGTBlockIconload.add(this);
  107.         }
  108.     }
  109.  
  110.     @Override
  111.     public int getColor() {
  112.         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]));
  113.     }
  114.  
  115.     @Override
  116.     public void run() {
  117.         this.setIcons(GregTech_API.sBlockIcons.registerIcon(CORE.MODID+ ":" + "fluids/fluid." + this.mTextureName));
  118.     }
  119. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement