Java Code Examples for net.minecraftforge.fluids.Fluid#getName()

The following examples show how to use net.minecraftforge.fluids.Fluid#getName() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CommonProxy.java    From Moo-Fluids with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void initContainableFluids() {
  if (FluidRegistry.isUniversalBucketEnabled()) {
    if (FluidRegistry.getBucketFluids().size() > 0) {
      for (final Fluid fluid : FluidRegistry.getBucketFluids()) {
        final String fluidName = fluid.getName();
        if (!EntityHelper.hasContainableFluid(fluidName)) {
          EntityHelper.setContainableFluid(fluidName, fluid);

          if (ModInformation.DEBUG_MODE) {
            LogHelper.info(String.format(fluidName,
                                         "%s has been added as an containable (i.e. bucketable) fluid"));
          }
        }
      }
    } else {
      LogHelper.error("No registered fluids found");
    }
  } else {
    throw new UnsupportedOperationException("Forge UniversalBucket must be enabled");
  }
}
 
Example 2
Source File: TileEntityCyaniteReprocessor.java    From BigReactors with MIT License 5 votes vote down vote up
@Override
protected int getDefaultTankForFluid(Fluid fluid) {
	if(fluid.getName() == "water")
		return 0;
	else
		return FLUIDTANK_NONE;
}
 
Example 3
Source File: ModLiquids.java    From YouTubeModdingTutorial with MIT License 4 votes vote down vote up
public static String getFluidName(Fluid fluid){
    return fluid == null ? "null" : fluid.getName();
}
 
Example 4
Source File: FluidStateMapper.java    From ExNihiloAdscensio with MIT License 4 votes vote down vote up
public FluidStateMapper(Fluid fluid) {
	this.fluid = fluid;

	this.location = new ModelResourceLocation(new ResourceLocation("exnihiloadscensio","fluid_block"), fluid.getName());
}
 
Example 5
Source File: XMLPlanetLoader.java    From AdvancedRocketry with MIT License 4 votes vote down vote up
private static String writePlanet(DimensionProperties properties, int numTabs) {
	String outputString = "";
	String tabLen = "";

	for(int i = 0; i < numTabs; i++) {
		tabLen += "\t";
	}

	outputString = tabLen + "<planet name=\"" + properties.getName() + "\" DIMID=\"" + properties.getId() + "\"" +
			(properties.isNativeDimension ? "" : " dimMapping=\"\"") + 
			(properties.customIcon.isEmpty() ? "" : " customIcon=\"" + properties.customIcon + "\"") + ">\n";


	outputString = outputString + tabLen + "\t<isKnown>" + Configuration.initiallyKnownPlanets.contains(properties.getId()) + "</isKnown>\n";	
	if(properties.hasRings) {
		outputString = outputString + tabLen + "\t<hasRings>true</hasRings>\n";
		outputString = outputString + tabLen + "\t<ringColor>" + properties.ringColor[0] + "," + properties.ringColor[1] + "," + properties.ringColor[2] + "</ringColor>\n";
	}

	if(properties.isGasGiant())
	{
		outputString = outputString + tabLen + "\t<GasGiant>true</GasGiant>\n";
		if(!properties.getHarvestableGasses().isEmpty())
		{
			for(Fluid f : properties.getHarvestableGasses())
			{
				outputString = outputString + tabLen + "\t<gas>" + f.getName() + "</gas>\n";
			}
			
		}
	}

	outputString = outputString + tabLen + "\t<fogColor>" + properties.fogColor[0] + "," + properties.fogColor[1] + "," + properties.fogColor[2] + "</fogColor>\n";
	outputString = outputString + tabLen + "\t<skyColor>" + properties.skyColor[0] + "," + properties.skyColor[1] + "," + properties.skyColor[2] + "</skyColor>\n";
	outputString = outputString + tabLen + "\t<gravitationalMultiplier>" + (int)(properties.getGravitationalMultiplier()*100f) + "</gravitationalMultiplier>\n";
	outputString = outputString + tabLen + "\t<orbitalDistance>" + properties.getOrbitalDist() + "</orbitalDistance>\n";
	outputString = outputString + tabLen + "\t<orbitalPhi>" + (int)(properties.orbitalPhi* Math.PI/180) + "</orbitalPhi>\n";
	outputString = outputString + tabLen + "\t<rotationalPeriod>" + (int)properties.rotationalPeriod + "</rotationalPeriod>\n";
	outputString = outputString + tabLen + "\t<atmosphereDensity>" + (int)properties.getAtmosphereDensity() + "</atmosphereDensity>\n";
	
	if(properties.getSeaLevel() != 63)
		outputString = outputString + tabLen + "\t<seaLevel>" + properties.getSeaLevel() + "</seaLevel>\n";
	
	if(properties.getGenType() != 0)
		outputString = outputString + tabLen + "\t<genType>" + properties.getGenType() + "</genType>\n";
	
	if(properties.oreProperties != null) {
		outputString = outputString + tabLen + "\t<oreGen>\n";
		outputString = outputString + XMLOreLoader.writeOreEntryXML(properties.oreProperties, numTabs+2);
		outputString = outputString + tabLen + "\t</oreGen>\n";
	}

	if(properties.isNativeDimension && !properties.isGasGiant()) {
		String biomeIds = "";
		for(BiomeEntry biome : properties.getBiomes()) {
			try {
				biomeIds = biomeIds + "," + Biome.REGISTRY.getNameForObject(biome.biome).toString();//Biome.getIdForBiome(biome.biome);
			} catch (NullPointerException e) {
				AdvancedRocketry.logger.warn("Error saving biomes for world, biomes list saved may be incomplete.  World: " + properties.getId());
			}
		}
		if(!biomeIds.isEmpty())
			biomeIds = biomeIds.substring(1);
		else
			AdvancedRocketry.logger.warn("Dim " + properties.getId() + " has no biomes to save!");

		outputString = outputString + tabLen + "\t<biomeIds>" + biomeIds + "</biomeIds>\n";
	}

	for(ItemStack stack : properties.getRequiredArtifacts()) {
		outputString = outputString + tabLen + "\t<artifact>" + stack.getItem().getRegistryName() + " " + stack.getItemDamage() + "</artifact>\n";
	}

	for(Integer properties2 : properties.getChildPlanets()) {
		outputString = outputString + writePlanet(DimensionManager.getInstance().getDimensionProperties(properties2), numTabs+1);
	}

	if(properties.getOceanBlock() != null) {
		outputString = outputString + tabLen + "\t<oceanBlock>" + Block.REGISTRY.getNameForObject(properties.getOceanBlock().getBlock()) + "</oceanBlock>\n";
	}
	
	if(properties.getStoneBlock() != null) {
		outputString = outputString + tabLen + "\t<fillerBlock>" + Block.REGISTRY.getNameForObject(properties.getStoneBlock().getBlock()) + "</fillerBlock>\n";
	}
	
	outputString = outputString + tabLen + "</planet>\n";
	return outputString;
}
 
Example 6
Source File: TextureRegisterEvent.java    From Moo-Fluids with GNU General Public License v3.0 4 votes vote down vote up
@SubscribeEvent
public void onTextureStitch(TextureStitchEvent.Post event) {
  for (final Fluid fluid : EntityHelper.getContainableFluids().values()) {
    try {
      final String fluidName = fluid.getName();
      final EntityTypeData entityTypeData = EntityHelper.getEntityData(fluidName);
      final TextureAtlasSprite fluidIcon =
          event.getMap().getAtlasSprite(fluid.getStill().toString());
      final int fluidColor = fluid.getColor();

      if (fluidColor != 0xFFFFFFFF) {
        if (entityTypeData != null) {
          entityTypeData.setOverlay(new Color(
              (fluidColor >> 16) & 0xFF,
              (fluidColor >> 8) & 0xFF,
              (fluidColor) & 0xFF,
              128).getRGB());
        }
      } else if (fluidIcon != event.getMap().getMissingSprite() &&
                 fluidIcon.getFrameTextureData(0) != null) {
        final Color meanColour = ColorHelper.getMeanColour(fluidIcon.getFrameTextureData(0));
        if (entityTypeData != null) {
          entityTypeData.setOverlay(new Color(
              meanColour.getRed(),
              meanColour.getGreen(),
              meanColour.getBlue(),
              128).getRGB());
        }
      } else {
        if (entityTypeData != null) {
          entityTypeData.setOverlay(0xFFFFFFFF);
        }
      }

      EntityHelper.setEntityData(fluidName, entityTypeData);

      if (ModInformation.DEBUG_MODE) {
        LogHelper.info(String.format("Successfully added colour overlay for %s", fluidName));
        if (fluidIcon != null) {
          LogHelper.info("Successfully added colour overlay for " + fluidIcon.getIconName());
        }
      }
    } catch (final Exception ex) {
      LogHelper.error("Encountered an issue when attempting to manipulate texture");
      ex.printStackTrace();
    }
  }
}
 
Example 7
Source File: ReactantToFluidMapping.java    From BigReactors with MIT License 4 votes vote down vote up
public ReactantToFluidMapping(String reactantName, int reactantAmount, Fluid fluid, int fluidAmount) {
	super(reactantName, reactantAmount, fluid.getName(), fluidAmount);
}
 
Example 8
Source File: ReactantToFluidMapping.java    From BigReactors with MIT License 4 votes vote down vote up
public ReactantToFluidMapping(String reactantName, Fluid fluid, int fluidAmount) {
	super(reactantName, Reactants.standardFluidReactantAmount, fluid.getName(), fluidAmount);
}
 
Example 9
Source File: ReactantToFluidMapping.java    From BigReactors with MIT License 4 votes vote down vote up
public ReactantToFluidMapping(String reactantName, Fluid fluid) {
	super(reactantName, Reactants.standardFluidReactantAmount, fluid.getName(), Reactants.standardFluidReactantAmount);
}
 
Example 10
Source File: FluidToReactantMapping.java    From BigReactors with MIT License 4 votes vote down vote up
public FluidToReactantMapping(Fluid fluid, int fluidAmount, String reactantName, int reactantAmount) {
	super(fluid.getName(), fluidAmount, reactantName, reactantAmount);
}
 
Example 11
Source File: FluidToReactantMapping.java    From BigReactors with MIT License 4 votes vote down vote up
public FluidToReactantMapping(Fluid fluid, int fluidAmount, String reactantName) {
	super(fluid.getName(), fluidAmount, reactantName, Reactants.standardFluidReactantAmount);
}
 
Example 12
Source File: FluidToReactantMapping.java    From BigReactors with MIT License 4 votes vote down vote up
public FluidToReactantMapping(Fluid fluid, String reactantName) {
	super(fluid.getName(), Reactants.standardFluidReactantAmount, reactantName, Reactants.standardFluidReactantAmount);
}