net.minecraftforge.fluids.FluidRegistry Java Examples

The following examples show how to use net.minecraftforge.fluids.FluidRegistry. 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: RecipeHandlerFluidRegistry.java    From NEI-Integration with MIT License 6 votes vote down vote up
public List<Fluid> getFluids() {
    List<Fluid> fluids = new LinkedList<Fluid>();
    
    for (Fluid fluid : FluidRegistry.getRegisteredFluids().values()) {
        if (fluid != null) {
            fluids.add(fluid);
        }
    }
    
    Collections.sort(fluids, new Comparator<Fluid>() {
        
        @Override
        public int compare(Fluid f1, Fluid f2) {
            if (f1 == null || f2 == null) {
                return 0;
            }
            return Integer.compare(f1.getID(), f2.getID());
        }
        
    });
    
    return fluids;
}
 
Example #2
Source File: FillerTileEntity.java    From EmergingTechnology with MIT License 6 votes vote down vote up
private void fillAdjacent() {
    for (EnumFacing facing : EnumFacing.VALUES) {
        TileEntity neighbour = this.world.getTileEntity(this.pos.offset(facing));

        // Return if no tile entity or another filler
        if (neighbour == null || neighbour instanceof FillerTileEntity) {
            continue;
        }

        IFluidHandler neighbourFluidHandler = neighbour
                .getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, facing.getOpposite());

        // Return if neighbour has no fluid tank
        if (neighbourFluidHandler == null) {
            continue;
        }

        // Fill the neighbour
        neighbourFluidHandler.fill(new FluidStack(FluidRegistry.WATER,
                EmergingTechnologyConfig.HYDROPONICS_MODULE.FILLER.fillerFluidTransferRate), true);
    }
}
 
Example #3
Source File: EnderIO.java    From PneumaticCraft with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void postInit(){
    Fluid hootch = FluidRegistry.getFluid("hootch");
    Fluid rocketFuel = FluidRegistry.getFluid("rocket_fuel");
    Fluid fireWater = FluidRegistry.getFluid("fire_water");

    if(hootch != null) {
        PneumaticRegistry.getInstance().registerFuel(hootch, 60 * 6000);
    } else {
        Log.warning("Couldn't find a fluid with name 'hootch' even though EnderIO is in the instance. It hasn't been registered as fuel!");
    }
    if(rocketFuel != null) {
        PneumaticRegistry.getInstance().registerFuel(rocketFuel, 160 * 7000);
    } else {
        Log.warning("Couldn't find a fluid with name 'rocket_fuel' even though EnderIO is in the instance. It hasn't been registered as fuel!");
    }
    if(fireWater != null) {
        PneumaticRegistry.getInstance().registerFuel(fireWater, 80 * 15000);
    } else {
        Log.warning("Couldn't find a fluid with name 'fire_water' even though EnderIO is in the instance. It hasn't been registered as fuel!");
    }
}
 
Example #4
Source File: SurfaceRockPopulator.java    From GregTech with GNU Lesser General Public License v3.0 6 votes vote down vote up
private Set<Material> findUndergroundMaterials(Collection<IBlockState> generatedBlocks) {
    HashSet<Material> result = new HashSet<>();
    for (IBlockState blockState : generatedBlocks) {
        Material resultMaterial;
        if (blockState.getBlock() instanceof IFluidBlock || blockState.getBlock() instanceof BlockLiquid) {
            Fluid fluid = FluidRegistry.lookupFluidForBlock(blockState.getBlock());
            resultMaterial = fluid == null ? null : MetaFluids.getMaterialFromFluid(fluid);
        } else {
            ItemStack itemStack = new ItemStack(blockState.getBlock(), 1, blockState.getBlock().damageDropped(blockState));
            UnificationEntry entry = OreDictUnifier.getUnificationEntry(itemStack);
            resultMaterial = entry == null ? null : entry.material;
        }
        if (resultMaterial != null) {
            result.add(resultMaterial);
        }
    }
    return result;
}
 
Example #5
Source File: FillerConfigUtils.java    From GregTech with GNU Lesser General Public License v3.0 6 votes vote down vote up
private static FillerEntry createSimpleFiller(String stringDeclaration) {
    if (stringDeclaration.startsWith("block:")) {
        Block block = OreConfigUtils.getBlockByName(stringDeclaration.substring(6));
        return FillerEntry.createSimpleFiller(block.getDefaultState());

    } else if (stringDeclaration.startsWith("fluid:")) {
        String fluidName = stringDeclaration.substring(6);
        Fluid fluid = FluidRegistry.getFluid(fluidName);
        Preconditions.checkNotNull(fluid, "Fluid not found with name %s", fluidName);
        Preconditions.checkNotNull(fluid.getBlock(), "Block is not defined for fluid %s", fluidName);
        return FillerEntry.createSimpleFiller(fluid.getBlock().getDefaultState());

    } else if (stringDeclaration.startsWith("ore:")) {
        Map<StoneType, IBlockState> blockStateMap = OreConfigUtils.getOreStateMap(stringDeclaration);
        return new OreFilterEntry(blockStateMap);

    } else if (stringDeclaration.startsWith("ore_dict:")) {
        String oreDictName = stringDeclaration.substring(9);
        IBlockState firstBlock = OreConfigUtils.getOreDictBlocks(oreDictName).get(0);
        return FillerEntry.createSimpleFiller(firstBlock);

    } else {
        throw new IllegalArgumentException("Unknown string block state declaration: " + stringDeclaration);
    }
}
 
Example #6
Source File: BioCulture.java    From bartworks with MIT License 6 votes vote down vote up
public static BioCulture getBioCultureFromNBTTag(NBTTagCompound tag) {
    if (tag == null || tag.getIntArray("Color").length == 0)
        return null;
    BioCulture ret = getBioCulture(tag.getString("Name"));

    if (ret == null)
        ret = createAndRegisterBioCulture(
                new Color(tag.getIntArray("Color")[0], tag.getIntArray("Color")[1], tag.getIntArray("Color")[2]),
                tag.getString("Name"),
                BioPlasmid.convertDataToPlasmid(getBioDataFromNBTTag(tag.getCompoundTag("Plasmid"))),
                BioDNA.convertDataToDNA(getBioDataFromNBTTag(tag.getCompoundTag("DNA"))),
                BW_Util.getRarityFromByte(tag.getByte("Rarety")),
                tag.getBoolean("Breedable")
        );
    if (ret.bBreedable)
        ret.setFluid(FluidRegistry.getFluid(tag.getString("Fluid")));
    if (ret.getFluidNotSet()) //should never happen, but better safe than sorry
        ret.setbBreedable(false);
    return ret;
}
 
Example #7
Source File: ItemEmptyPCB.java    From PneumaticCraft with GNU General Public License v3.0 6 votes vote down vote up
@Override
public boolean onEntityItemUpdate(EntityItem entityItem){
    super.onEntityItemUpdate(entityItem);
    ItemStack stack = entityItem.getEntityItem();
    if(Fluids.areFluidsEqual(FluidRegistry.lookupFluidForBlock(entityItem.worldObj.getBlock((int)Math.floor(entityItem.posX), (int)Math.floor(entityItem.posY), (int)Math.floor(entityItem.posZ))), Fluids.etchingAcid)) {
        if(!stack.hasTagCompound()) {
            stack.setTagCompound(new NBTTagCompound());
        }
        int etchProgress = stack.getTagCompound().getInteger("etchProgress");
        if(etchProgress < 100) {
            if(entityItem.ticksExisted % (TileEntityConstants.PCB_ETCH_TIME / 5) == 0) stack.getTagCompound().setInteger("etchProgress", etchProgress + 1);
        } else {
            entityItem.setEntityItemStack(new ItemStack(rand.nextInt(100) >= stack.getItemDamage() ? Itemss.unassembledPCB : Itemss.failedPCB));
        }
    }
    return false;
}
 
Example #8
Source File: GT_TileEntity_THTR.java    From bartworks with MIT License 6 votes vote down vote up
@Override
public boolean checkRecipe(ItemStack controllerStack) {

    if (!(this.HeliumSupply >= GT_TileEntity_THTR.HELIUM_NEEDED && this.BISOPeletSupply + this.TRISOPeletSupply >= 100000))
        return false;

    reduceSupply();
    addBurnedOutBalls();
    this.updateSlots();

    this.mOutputFluids = new FluidStack[]{FluidRegistry.getFluidStack("ic2hotcoolant",0)};

    this.mEUt=0;
    this.mMaxProgresstime=648000;
    return true;
}
 
Example #9
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 #10
Source File: FarmLogicSquid.java    From PneumaticCraft with GNU General Public License v3.0 6 votes vote down vote up
private boolean tryPlaceSoil(int x, int y, int z, boolean isLast){
    if(housing.getWorld().getBlock(x, y, z).isReplaceable(housing.getWorld(), x, y, z)) {
        if(!isLast && shouldTurnIntoWater(x, y, z)) {
            if((housing.getWorld().getBlock(x, y, z) != Blocks.water || housing.getWorld().getBlockMetadata(x, y, z) != 0) && housing.hasLiquid(new FluidStack(FluidRegistry.getFluid("water"), 1000))) {
                housing.removeLiquid(new FluidStack(FluidRegistry.getFluid("water"), 1000));
                housing.getWorld().setBlock(x, y, z, Blocks.water);
                return true;
            }
        } else {
            for(Block res : Forestry.farmStructureBlocks) {
                if(housing.hasResources(new ItemStack[]{new ItemStack(res)})) {
                    housing.removeResources(new ItemStack[]{new ItemStack(res)});
                    housing.getWorld().setBlock(x, y, z, res);
                    return true;
                }
            }
        }
    }
    return false;
}
 
Example #11
Source File: TileEntityEnderFurnace.java    From enderutilities with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 * Uses one dose (1000 mB) of fluid fuel, returns the amount of burn time that was gained from it.
 * @param stack
 * @return burn time gained, in ticks
 */
private static int consumeFluidFuelDosage(ItemStack stack)
{
    if (itemContainsFluidFuel(stack) == false)
    {
        return 0;
    }

    // All the null checks happened already in itemContainsFluidFuel()
    IFluidHandler handler = stack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, null);

    // Consume max 1000 mB per use.
    FluidStack fluidStack = handler.drain(new FluidStack(FluidRegistry.LAVA, Fluid.BUCKET_VOLUME), true);

    //System.out.printf("consumeFluidFuelDosageFluidCapability: %s - %d\n", (fluidStack != null ? fluidStack.getFluid().getName() : "null"), fluidStack != null ? fluidStack.amount : 0);
    // 1.5 times vanilla lava fuel value (150 items per bucket)
    return fluidStack != null ? (fluidStack.amount * 15 * COOKTIME_DEFAULT / 100) : 0;
}
 
Example #12
Source File: MessageFluidUpdate.java    From ExNihiloAdscensio with MIT License 6 votes vote down vote up
@Override
public IMessage onMessage(final MessageFluidUpdate msg, MessageContext ctx)
{
	Minecraft.getMinecraft().addScheduledTask(new Runnable() {
		@Override
		public void run()
		{
			TileEntity entity =  Minecraft.getMinecraft().player.world.getTileEntity(new BlockPos(msg.x, msg.y, msg.z));
			if (entity instanceof TileBarrel)
			{
				TileBarrel te = (TileBarrel) entity;
				Fluid fluid = FluidRegistry.getFluid(msg.fluidName);
				FluidStack f = fluid == null ? null : new FluidStack(fluid, msg.fillAmount);
				te.getTank().setFluid(f);
			}
		}
	});
	return null;
}
 
Example #13
Source File: TileBarrel.java    From ExNihiloAdscensio with MIT License 6 votes vote down vote up
@Override
public void update()
{
	if (world.isRemote)
		return;

	if (Config.shouldBarrelsFillWithRain && (mode == null || mode.getName() == "fluid")) {
		BlockPos plusY = new BlockPos(pos.getX(), pos.getY()+1, pos.getZ());
		if(world.isRainingAt(plusY)) {
			FluidStack stack = new FluidStack(FluidRegistry.WATER, 2);
			tank.fill(stack, true);
		}
	}
	if (mode != null)
		mode.update(this);
       
	if(getBlockType().getLightValue(world.getBlockState(pos), world, pos) != world.getLight(pos))
       {
           world.checkLight(pos);
           PacketHandler.sendToAllAround(new MessageCheckLight(pos), this);
       }
}
 
Example #14
Source File: PacketUpdateGui.java    From Signals with GNU General Public License v3.0 6 votes vote down vote up
public static Object readField(ByteBuf buf, int type){

        switch(type){
            case 0:
                return buf.readInt();
            case 1:
                return buf.readFloat();
            case 2:
                return buf.readDouble();
            case 3:
                return buf.readBoolean();
            case 4:
                return ByteBufUtils.readUTF8String(buf);
            case 5:
                return buf.readByte();
            case 6:
                return ByteBufUtils.readItemStack(buf);
            case 7:
                if(!buf.readBoolean()) return null;
                return new FluidStack(FluidRegistry.getFluid(ByteBufUtils.readUTF8String(buf)), buf.readInt(), ByteBufUtils.readTag(buf));
            default:
                throw new IllegalArgumentException("Invalid sync type! " + type);
        }
    }
 
Example #15
Source File: ContainerFluidKineticGenerator.java    From Production-Line with MIT License 6 votes vote down vote up
/**
 * Looks for changes made in the container, sends them to every listener.
 */
@Override
public void detectAndSendChanges() {
    super.detectAndSendChanges();

    for (IContainerListener listener : this.listeners) {
        if (this.fluidAmount != this.tile.fluidTank.getFluidAmount()) {
            listener.sendProgressBarUpdate(this, 0, this.tile.fluidTank.getFluidAmount());
        }
        if (this.tile.fluidTank.getFluid() != null && this.fluid != this.tile.fluidTank.getFluid().getFluid()) {
            listener.sendProgressBarUpdate(this, 1, FluidRegistry.getFluidID(this.tile.fluidTank.getFluid().getFluid()));
        }
    }

    this.fluidAmount = this.tile.fluidTank.getFluidAmount();
    if (this.tile.fluidTank.getFluid() != null) {
        this.fluid = this.tile.fluidTank.getFluid().getFluid();
    }
}
 
Example #16
Source File: ItemFluidContainer.java    From customstuff4 with GNU General Public License v3.0 6 votes vote down vote up
@SideOnly(Side.CLIENT)
@Override
public void getSubItems(@Nullable CreativeTabs tab, @Nonnull NonNullList<ItemStack> subItems)
{
    if (isInCreativeTab(tab))
    {
        subItems.add(new ItemStack(this));

        for (Fluid fluid : FluidRegistry.getRegisteredFluids().values())
        {
            if (!fluid.getName().equals("milk"))
            {
                // add all fluids that the bucket can be filled  with
                FluidStack fs = new FluidStack(fluid, content.capacity);
                ItemStack stack = new ItemStack(this);
                IFluidHandlerItem fluidHandler = new FluidHandlerItemStack(stack, content.capacity);
                if (fluidHandler.fill(fs, true) == fs.amount)
                {
                    ItemStack filled = fluidHandler.getContainer();
                    subItems.add(filled);
                }
            }
        }
    }
}
 
Example #17
Source File: TileEntityAerialInterface.java    From PneumaticCraft with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void readFromNBT(NBTTagCompound tag){

    super.readFromNBT(tag);
    // Read in the ItemStacks in the inventory from NBT

    redstoneMode = tag.getInteger("redstoneMode");
    feedMode = tag.getInteger("feedMode");
    setPlayer(tag.getString("playerName"), tag.getString("playerUUID"));
    isConnectedToPlayer = tag.getBoolean("connected");
    if(tag.hasKey("curXpFluid")) curXpFluid = FluidRegistry.getFluid(tag.getString("curXpFluid"));
    if(energyRF != null) readRF(tag);

    NBTTagList tagList = tag.getTagList("Items", 10);
    inventory = new ItemStack[4];
    for(int i = 0; i < tagList.tagCount(); ++i) {
        NBTTagCompound tagCompound = tagList.getCompoundTagAt(i);
        byte slot = tagCompound.getByte("Slot");
        if(slot >= 0 && slot < inventory.length) {
            inventory[slot] = ItemStack.loadItemStackFromNBT(tagCompound);
        }
    }
    dispenserUpgradeInserted = getUpgrades(ItemMachineUpgrade.UPGRADE_DISPENSER_DAMAGE) > 0;
}
 
Example #18
Source File: ItemPack.java    From SimplyJetpacks with MIT License 5 votes vote down vote up
@Override
public FluidStack getFluid(ItemStack container) {
    T pack = this.getPack(container);
    if (pack == null || pack.fuelType != FuelType.FLUID || pack.fuelFluid == null) {
        return null;
    }
    int amount = NBTHelper.getNBT(container).getInteger(TAG_FLUID);
    return amount > 0 ? new FluidStack(FluidRegistry.getFluid(pack.fuelFluid), amount) : null;
}
 
Example #19
Source File: FluidOnTopRecipe.java    From ExNihiloAdscensio with MIT License 5 votes vote down vote up
public FluidOnTopRecipe(FluidFluidBlock recipe)
{
    inputFluidInBarrel = new FluidStack(FluidRegistry.getFluid(recipe.getFluidInBarrel()), 1000);
    inputFluidOnTop = new FluidStack(FluidRegistry.getFluid(recipe.getFluidOnTop()), 1000);

    inputBucketInBarrel = Util.getBucketStack(inputFluidInBarrel.getFluid());
    inputBucketOnTop = Util.getBucketStack(inputFluidOnTop.getFluid());
    
    outputStack = recipe.getResult().getItemStack();
}
 
Example #20
Source File: BlockWaterPad.java    From AgriCraft with MIT License 5 votes vote down vote up
@Override
public int fill(World world, BlockPos pos, IBlockState state, FluidStack fluid, boolean doFill) {
    if (!AgriProperties.POWERED.getValue(state) && (fluid != null) && (fluid.amount == 1000) && (fluid.getFluid().equals(FluidRegistry.WATER))) {
        if (doFill) {
            world.setBlockState(pos, AgriProperties.POWERED.applyToBlockState(state, true));
        }
        return 1000;
    } else {
        return 0;
    }
}
 
Example #21
Source File: CompatTConstruct.java    From ExNihiloAdscensio with MIT License 5 votes vote down vote up
public static void registerMelting() {
	for (ItemOre ore : OreRegistry.getItemOreRegistry()) {
		if (FluidRegistry.isFluidRegistered(ore.getOre().getName())) {
			Fluid fluid = FluidRegistry.getFluid(ore.getOre().getName());
			TinkerRegistry.registerMelting(new ItemStack(ore, 1, 1), fluid, 2*Material.VALUE_Ingot);
		}
	}
}
 
Example #22
Source File: ProgWidgetCC.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
private ProgWidgetLiquidFilter getFilterForArgs(String fluidName) throws IllegalArgumentException{
    Fluid fluid = FluidRegistry.getFluid(fluidName);
    if(fluid == null) throw new IllegalArgumentException("Can't find fluid for the name \"" + fluidName + "\"!");
    ProgWidgetLiquidFilter filter = new ProgWidgetLiquidFilter();
    filter.setFluid(fluid);
    return filter;
}
 
Example #23
Source File: ItemSyringe.java    From Wizardry with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void onUsingTick(ItemStack stack, EntityLivingBase player, int count) {
	if (!(player instanceof EntityPlayer)) return;
	if (player.world.isRemote) return;

	if (count <= 1) {
		player.swingArm(player.getActiveHand());
		((EntityPlayer) player).getCooldownTracker().setCooldown(this, 30);

		if (stack.getItemDamage() == 2) {
			player.addPotionEffect(new PotionEffect(ModPotions.STEROID, 500, 0, true, false));
			stack.setItemDamage(0);
		} else if (stack.getItemDamage() == 1) {
			ManaManager.forObject(player)
					.addMana(ManaManager.getMaxMana(player))
					.close();
			player.attackEntityFrom(DamageSourceMana.INSTANCE, 2);
			stack.setItemDamage(0);
		} else if (stack.getItemDamage() == 0) {

			RayTraceResult raytraceresult = this.rayTrace(player.world, (EntityPlayer) player, true);

			if (raytraceresult != null && raytraceresult.typeOfHit != null && raytraceresult.typeOfHit == RayTraceResult.Type.BLOCK) {
				BlockPos blockpos = raytraceresult.getBlockPos();
				if (raytraceresult.sideHit == null) raytraceresult.sideHit = EnumFacing.UP;

				if (player.world.isBlockModifiable((EntityPlayer) player, blockpos)
						&& ((EntityPlayer) player).canPlayerEdit(blockpos.offset(raytraceresult.sideHit), raytraceresult.sideHit, stack)) {

					IBlockState iblockstate = player.world.getBlockState(blockpos);

					Fluid fluid = FluidRegistry.lookupFluidForBlock(iblockstate.getBlock());
					if (fluid != null && fluid == ModFluids.MANA && iblockstate.getValue(BlockLiquid.LEVEL) == 0) {
						stack.setItemDamage(1);
					}
				}
			}
		}
	}
}
 
Example #24
Source File: IngredientFluidStackFactory.java    From Wizardry with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Nonnull
@Override
public Ingredient parse(JsonContext context, JsonObject json) {
	String name = JsonUtils.getString(json, "fluid");
	int amount = JsonUtils.getInt(json, "amount", 1000);
	Fluid fluid = FluidRegistry.getFluid(name);
	if (fluid == null)
		throw new JsonSyntaxException("Fluid with name " + name + " could not be found");
	return new IngredientFluidStack(fluid, amount);
}
 
Example #25
Source File: ItemHelperTests.java    From customstuff4 with GNU General Public License v3.0 5 votes vote down vote up
@Test
public void test_fluidStackEqual()
{
    assertTrue(ItemHelper.fluidStackEqual(null, null, false));
    assertFalse(ItemHelper.fluidStackEqual(new FluidStack(FluidRegistry.WATER, 10), null, false));
    assertFalse(ItemHelper.fluidStackEqual(null, new FluidStack(FluidRegistry.WATER, 10), false));
    assertFalse(ItemHelper.fluidStackEqual(new FluidStack(FluidRegistry.WATER, 1), new FluidStack(FluidRegistry.WATER, 10), true));
    assertTrue(ItemHelper.fluidStackEqual(new FluidStack(FluidRegistry.WATER, 1), new FluidStack(FluidRegistry.WATER, 10), false));

    assertFalse(ItemHelper.fluidStackEqual(new FluidStack(FluidRegistry.LAVA, 10), new FluidStack(FluidRegistry.WATER, 10), true));
    assertFalse(ItemHelper.fluidStackEqual(new FluidStack(FluidRegistry.LAVA, 10), new FluidStack(FluidRegistry.WATER, 10), false));

    assertFalse(ItemHelper.fluidStackEqual(new FluidStack(FluidRegistry.WATER, 10), new FluidStack(FluidRegistry.LAVA, 10), true));
    assertFalse(ItemHelper.fluidStackEqual(new FluidStack(FluidRegistry.WATER, 10), new FluidStack(FluidRegistry.LAVA, 10), false));
}
 
Example #26
Source File: FluidBase.java    From EmergingTechnology with MIT License 5 votes vote down vote up
public FluidBase(String fluidName, boolean canBeStill, String textureName, Integer color) {
	super(fluidName, stillTextureLocation(textureName, canBeStill), flowingTextureLocation(textureName, canBeStill));
	
	// int fixedColor = color.intValue();
	// if (((fixedColor >> 24) & 0xFF) == 0) {
	// 	fixedColor |= 0xFF << 24;
	// }
	// setColor(fixedColor);
	
	if (FluidRegistry.registerFluid(this)) {
		FluidRegistry.addBucketForFluid(this);
	}
}
 
Example #27
Source File: FluidBase.java    From EmergingTechnology with MIT License 5 votes vote down vote up
public FluidBase(String fluidName, boolean canBeStill) {
	super(fluidName, stillTextureLocation(fluidName, canBeStill), flowingTextureLocation(fluidName, canBeStill));
	
	if (FluidRegistry.registerFluid(this)) {
		FluidRegistry.addBucketForFluid(this);
	}
}
 
Example #28
Source File: FluidRegistryDumper.java    From NotEnoughItems with MIT License 5 votes vote down vote up
@Override
public Iterable<String[]> dump(int mode) {
    Map<String, Fluid> registeredFluids = FluidRegistry.getRegisteredFluids();
    Map<Fluid, Integer> fluidIDMap = FluidRegistry.getRegisteredFluidIDs();
    List<String[]> dumps = new LinkedList<>();
    for (Entry<String, Fluid> fluidEntry : registeredFluids.entrySet()) {
        Fluid fluid = fluidEntry.getValue();
        int id = fluidIDMap.get(fluid);
        //@formatter:off
        dumps.add(new String[] {
                fluidEntry.getKey(),
                Integer.toString(id),
                fluid.getUnlocalizedName(),
                String.valueOf(fluid.getLuminosity()),
                String.valueOf(fluid.getDensity()),
                String.valueOf(fluid.getTemperature()),
          String.valueOf(fluid.getViscosity()),
                String.valueOf(fluid.isGaseous()),
                fluid.getRarity().toString(),
                fluid.canBePlacedInWorld() ? fluid.getBlock().getRegistryName().toString() : "No Block",
                fluid.getStill().toString(),
                fluid.getFlowing().toString(),
                fluid.getFillSound().getRegistryName().toString(),
                fluid.getEmptySound().getRegistryName().toString(),
                fluid.getClass().getCanonicalName()
        });
        //@formatter:on
    }
    return dumps;
}
 
Example #29
Source File: Forestry.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void init(){
    PneumaticRegistry.getInstance().registerFuel(FluidRegistry.getFluid("biomass"), 500000);
    PneumaticRegistry.getInstance().registerFuel(FluidRegistry.getFluid("bioethanol"), 500000);

    for(ItemStack stack : ((ItemPlasticElectronTube)plasticElectronTube).getSubItems()) {
        RecipeManagers.fabricatorManager.addRecipe(null, FluidRegistry.getFluidStack("glass", 500), stack.copy(), new Object[]{" X ", "#X#", "XXX", '#', Items.redstone, 'X', new ItemStack(Itemss.plastic, 1, stack.getItemDamage())});
    }

}
 
Example #30
Source File: TileEntityTank.java    From AgriCraft with MIT License 5 votes vote down vote up
@Override
public FluidStack drain(FluidStack fs, boolean doDrain) {
    if (fs.getFluid() == FluidRegistry.WATER) {
        return drain(fs.amount, doDrain);
    } else {
        return new FluidStack(fs.getFluid(), 0);
    }
}