Java Code Examples for net.minecraftforge.fluids.Fluid#getBlock()
The following examples show how to use
net.minecraftforge.fluids.Fluid#getBlock() .
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: HeatExchangerManager.java From PneumaticCraft with GNU General Public License v3.0 | 6 votes |
public void init(){ PneumaticRegistry.getInstance().registerBlockExchanger(Blocks.ice, 263, 500); PneumaticRegistry.getInstance().registerBlockExchanger(Blocks.packed_ice, 263, 500); PneumaticRegistry.getInstance().registerBlockExchanger(Blocks.snow, 268, 1000); PneumaticRegistry.getInstance().registerBlockExchanger(Blocks.torch, 1700, 100000); PneumaticRegistry.getInstance().registerBlockExchanger(Blocks.fire, 1700, 1000); Map<String, Fluid> fluids = FluidRegistry.getRegisteredFluids(); for(Fluid fluid : fluids.values()) { if(fluid.getBlock() != null) { PneumaticRegistry.getInstance().registerBlockExchanger(fluid.getBlock(), fluid.getTemperature(), FLUID_RESISTANCE); } } PneumaticRegistry.getInstance().registerBlockExchanger(Blocks.flowing_water, FluidRegistry.WATER.getTemperature(), 500); PneumaticRegistry.getInstance().registerBlockExchanger(Blocks.flowing_lava, FluidRegistry.LAVA.getTemperature(), 500); }
Example 2
Source File: RecipeHandlerFluidRegistry.java From NEI-Integration with MIT License | 5 votes |
public CachedFluidRegistryRecipe(Fluid fluid) { this.fluid = new PositionedFluidTank(new FluidStack(fluid, 1000), 1000, new Rectangle(32, 5, 96, 32)); this.fluid.showAmount = false; if (fluid.getBlock() != null) { this.block = new PositionedStack(new ItemStack(fluid.getBlock()), 32, 43); } this.setContainerItems(fluid); }
Example 3
Source File: PneumaticCraft.java From PneumaticCraft with GNU General Public License v3.0 | 5 votes |
@EventHandler public void validateFluids(FMLServerStartedEvent event){ Fluid oil = FluidRegistry.getFluid(Fluids.oil.getName()); if(oil.getBlock() == null) { String modName = FluidRegistry.getDefaultFluidName(oil).split(":")[0]; throw new IllegalStateException(String.format("Oil fluid does not have a block associated with it. The fluid is owned by %s. This could be fixed by creating the world with having this mod loaded after PneumaticCraft. This can be done by adding a injectedDependencies.json inside the config folder containing: [{\"modId\": \"%s\",\"deps\": [{\"type\":\"after\",\"target\":\"%s\"}]}]", modName, modName, Names.MOD_ID)); } }
Example 4
Source File: Fluids.java From PneumaticCraft with GNU General Public License v3.0 | 5 votes |
private static void initializeFluidBlocksAndBuckets(){ for(final Fluid fluid : fluids) { //FluidRegistry.registerFluid(fluid); (The constructor of FluidPneumaticCrafts registers the fluid. Block fluidBlock = fluid.getBlock(); Blockss.registerBlock(fluidBlock); fluidToBlockMap.put(fluid.getName(), fluidBlock); Item fluidBucket = new ItemBucket(fluidBlock){ @Override public void addInformation(ItemStack p_77624_1_, net.minecraft.entity.player.EntityPlayer p_77624_2_, List p_77624_3_, boolean p_77624_4_){ super.addInformation(p_77624_1_, p_77624_2_, p_77624_3_, p_77624_4_); ItemPneumatic.addTooltip(p_77624_1_, p_77624_2_, p_77624_3_); }; @Override @SideOnly(Side.CLIENT) public void getSubItems(Item item, CreativeTabs creativeTab, List items){ if(FluidRegistry.isFluidDefault(fluid)) super.getSubItems(item, creativeTab, items); } }.setContainerItem(Items.bucket).setCreativeTab(PneumaticCraft.tabPneumaticCraft).setTextureName(Textures.ICON_LOCATION + fluid.getName() + "Bucket").setUnlocalizedName(fluid.getName() + "Bucket"); Itemss.registerItem(fluidBucket); fluidBlockToBucketMap.put(fluidBlock, fluidBucket); FluidContainerRegistry.registerFluidContainer(new FluidStack(fluid, 1000), new ItemStack(fluidBucket), new ItemStack(Items.bucket)); } }
Example 5
Source File: FluidRecipeLoader.java From Wizardry with GNU Lesser General Public License v3.0 | 4 votes |
private static Set<BlockPos> allLiquidInPool(World world, BlockPos pos, int needed, Fluid fluid) { if (needed <= 0) return Sets.newHashSet(); Block block = fluid.getBlock(); if (block == null) return Sets.newHashSet(); IBlockState sourceBlock = block.getDefaultState(); BlockPos.MutableBlockPos topPos = new BlockPos.MutableBlockPos(pos); IBlockState stateAt = world.getBlockState(topPos); boolean lastWasFluid = false; while (stateAt.getBlock() == block) { lastWasFluid = stateAt == sourceBlock; stateAt = world.getBlockState(topPos.setPos(topPos.getX(), topPos.getY() + 1, topPos.getZ())); } topPos.setPos(topPos.getX(), topPos.getY() - 1, topPos.getZ()); BlockPos.MutableBlockPos tool = new BlockPos.MutableBlockPos(); Set<BlockPos> positions = Sets.newHashSet(topPos.toImmutable()); Set<BlockPos> visited = Sets.newHashSet(positions); Set<BlockPos> resultants = Sets.newHashSet(); if (lastWasFluid) resultants.addAll(positions); while (resultants.size() < needed && !positions.isEmpty() && visited.size() < 1000) { BlockPos point = positions.iterator().next(); positions.remove(point); for (int index = EnumFacing.VALUES.length - 1; index >= 0; index--) { EnumFacing facing = EnumFacing.byIndex(index); tool.setPos(point.getX() + facing.getXOffset(), point.getY() + facing.getYOffset(), point.getZ() + facing.getZOffset()); if (!visited.contains(tool)) { BlockPos immutable = tool.toImmutable(); visited.add(immutable); stateAt = world.getBlockState(tool); if (stateAt.getBlock() == block) { positions.add(immutable); if (stateAt == sourceBlock) { resultants.add(immutable); if (resultants.size() >= needed) return resultants; } } } } } return resultants; }