本文整理匯總了Java中net.minecraftforge.fluids.FluidRegistry類的典型用法代碼示例。如果您正苦於以下問題:Java FluidRegistry類的具體用法?Java FluidRegistry怎麽用?Java FluidRegistry使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
FluidRegistry類屬於net.minecraftforge.fluids包,在下文中一共展示了FluidRegistry類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getEvaluator
import net.minecraftforge.fluids.FluidRegistry; //導入依賴的package包/類
@Override
protected DroneAIBlockCondition getEvaluator(IDroneBase drone, IProgWidget widget) {
return new DroneAIBlockCondition(drone, (ProgWidgetAreaItemBase) widget) {
@Override
protected boolean evaluate(BlockPos pos) {
TileEntity te = drone.world().getTileEntity(pos);
int count = 0;
if (te != null && te.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, null) ) {
IFluidHandler handler = te.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, null);
for (IFluidTankProperties prop : handler.getTankProperties()) {
FluidStack stack = prop.getContents();
if (stack != null) {
if (ProgWidgetLiquidFilter.isLiquidValid(stack.getFluid(), widget, 1)) {
count += stack.amount;
}
}
}
} else {
Fluid fluid = FluidRegistry.lookupFluidForBlock(drone.world().getBlockState(pos).getBlock());
if (fluid != null && ProgWidgetLiquidFilter.isLiquidValid(fluid, widget, 1) && FluidUtils.isSourceBlock(drone.world(), pos)) {
count += 1000;
}
}
return ((ICondition) widget).getOperator() == ICondition.Operator.EQUALS ?
count == ((ICondition) widget).getRequiredCount() :
count >= ((ICondition) widget).getRequiredCount();
}
};
}
示例2: addValidFluids
import net.minecraftforge.fluids.FluidRegistry; //導入依賴的package包/類
private void addValidFluids() {
List<Fluid> fluids = new ArrayList<Fluid>();
for (Fluid fluid : FluidRegistry.getRegisteredFluids().values()) {
if (fluid.getLocalizedName(new FluidStack(fluid, 1)).toLowerCase().contains(searchField.getText())) {
fluids.add(fluid);
}
}
fluids.sort(Comparator.comparing(Fluid::getName));
scrollbar.setStates(Math.max(0, (fluids.size() - GRID_WIDTH * GRID_HEIGHT + GRID_WIDTH - 1) / GRID_WIDTH));
int offset = scrollbar.getState() * GRID_WIDTH;
for (IGuiWidget widget : widgets) {
if (widget.getID() >= 0 && widget instanceof WidgetFluidFilter) {
int idWithOffset = widget.getID() + offset;
((WidgetFluidFilter) widget).setFluid(idWithOffset >= 0 && idWithOffset < fluids.size() ? fluids.get(idWithOffset) : null);
}
}
}
示例3: postInit
import net.minecraftforge.fluids.FluidRegistry; //導入依賴的package包/類
@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!");
}
}
示例4: init
import net.minecraftforge.fluids.FluidRegistry; //導入依賴的package包/類
@Override
public void init() {
// gasoline is equivalent to Thermal Foundation refined fuel @ 2,000,000
// "oil" gets added by CoFH so no need to do it here
ThermalExpansionHelper.addCompressionFuel(Fluids.DIESEL.getName(), 1000000);
ThermalExpansionHelper.addCompressionFuel(Fluids.KEROSENE.getName(), 1500000);
ThermalExpansionHelper.addCompressionFuel(Fluids.GASOLINE.getName(), 2000000);
ThermalExpansionHelper.addCompressionFuel(Fluids.LPG.getName(), 2500000);
PneumaticCraftRepressurized.logger.info("Added PneumaticCraft: Repressurized fuels to CoFH Compression Dynamo");
registerCoFHfuel("creosote", 75000);
registerCoFHfuel("coal", 300000);
registerCoFHfuel("tree_oil", 750000);
registerCoFHfuel("refined_oil", 937500);
registerCoFHfuel("refined_fuel", 1500000);
Fluid crudeOil = FluidRegistry.getFluid("crude_oil");
if (crudeOil != null) {
PneumaticCraftAPIHandler.getInstance().registerRefineryInput(crudeOil);
PneumaticCraftRepressurized.logger.info("Added CoFH Crude Oil as a Refinery input");
}
}
示例5: init
import net.minecraftforge.fluids.FluidRegistry; //導入依賴的package包/類
public void init() {
registerBlockExchanger(Blocks.ICE, 263, 500);
registerBlockExchanger(Blocks.PACKED_ICE, 263, 500);
registerBlockExchanger(Blocks.SNOW, 268, 1000);
registerBlockExchanger(Blocks.TORCH, 1700, 100000);
registerBlockExchanger(Blocks.FIRE, 1700, 1000);
Map<String, Fluid> fluids = FluidRegistry.getRegisteredFluids();
for (Fluid fluid : fluids.values()) {
if (fluid.getBlock() != null) {
registerBlockExchanger(fluid.getBlock(), fluid.getTemperature(), FLUID_RESISTANCE);
}
}
registerBlockExchanger(Blocks.FLOWING_WATER, FluidRegistry.WATER.getTemperature(), 500);
registerBlockExchanger(Blocks.FLOWING_LAVA, FluidRegistry.LAVA.getTemperature(), 500);
}
示例6: suckLiquid
import net.minecraftforge.fluids.FluidRegistry; //導入依賴的package包/類
private boolean suckLiquid() {
Block block = world.getBlockState(getPos().offset(EnumFacing.DOWN, currentDepth + 1)).getBlock();
Fluid fluid = FluidRegistry.lookupFluidForBlock(block);
if (fluid == null) {
pumpingLake = null;
return false;
}
FluidStack fluidStack = new FluidStack(fluid, 1000);
if (tank.fill(fluidStack, false) == 1000) {
if (pumpingLake == null) {
findLake(block);
}
BlockPos curPos = null;
boolean foundSource = false;
while (pumpingLake.size() > 0) {
curPos = pumpingLake.get(0);
if (getWorld().getBlockState(curPos).getBlock() == block && FluidUtils.isSourceBlock(getWorld(), curPos)) {
foundSource = true;
break;
}
pumpingLake.remove(0);
}
if (pumpingLake.size() == 0) {
pumpingLake = null;
} else if (foundSource) {
getWorld().setBlockToAir(curPos);
tank.fill(fluidStack, true);
addAir(-100);
status = Status.PUMPING;
}
}
return true;
}
示例7: validateFluids
import net.minecraftforge.fluids.FluidRegistry; //導入依賴的package包/類
@EventHandler
public void validateFluids(FMLServerStartedEvent event) {
if (ConfigHandler.general.oilGenerationChance > 0) {
Fluid oil = FluidRegistry.getFluid(Fluids.OIL.getName());
if (oil.getBlock() == null) {
String modName = FluidRegistry.getDefaultFluidName(oil).split(":")[0];
Log.error(String.format("Oil fluid does not have a block associated with it. The fluid is owned by [%s]. " +
"This might be fixable by creating the world with having this mod loaded after PneumaticCraft.", modName));
Log.error(String.format("This can be done by adding a injectedDependencies.json inside the config folder containing: " +
"[{\"modId\": \"%s\",\"deps\": [{\"type\":\"after\",\"target\":\"%s\"}]}]", modName, Names.MOD_ID));
Log.error(String.format("Alternatively, you can disable PneumaticCraft oil generation by setting 'D:oilGenerationChance=0.0' " +
"in the config file pneumaticcraft.cfg, and use the the oil from [%s].", modName));
throw new IllegalStateException("Oil fluid does not have a block associated with it (see errors above for more information)");
}
}
}
示例8: BaseLiquid
import net.minecraftforge.fluids.FluidRegistry; //導入依賴的package包/類
public BaseLiquid(String fluidName, Consumer<Fluid> f, int col) {
super(fluidName, new ResourceLocation(FirmaMod.MODID + ":blocks/water_still"), new ResourceLocation(FirmaMod.MODID + ":blocks/water_flow"));
this.setUnlocalizedName(FirmaMod.MODID + ":fluid." + fluidName);
FluidRegistry.registerFluid(this);
f.accept(this);
block = new BaseBlockLiquid(this, Material.WATER);
block.setRegistryName(FirmaMod.MODID + ":fluid." + fluidName);
block.setUnlocalizedName(FirmaMod.MODID + ":fluid." + fluidName);
block.setCreativeTab(FirmaMod.blockTab);
block.setLightOpacity(3);
block.setLightLevel(0);
GameRegistry.register(block);
i = new ItemBlock(block);
i.setRegistryName(FirmaMod.MODID+":fluid."+fluidName);
i.setUnlocalizedName(FirmaMod.MODID+":fluid."+fluidName);
GameRegistry.register(i);
FirmaMod.allFluids.add(this);
this.col = col;
}
示例9: registerFluids
import net.minecraftforge.fluids.FluidRegistry; //導入依賴的package包/類
public static void registerFluids()
{
//For creating alcohol. All made in Melter, so very hot.
FluidRegistry.registerFluid(BOILING_WORT = new Fluid("boiling_wort",new ResourceLocation(Soot.MODID,"blocks/wort"),new ResourceLocation(Soot.MODID,"blocks/wort_flowing")).setTemperature(500));
FluidRegistry.registerFluid(BOILING_POTATO_JUICE = new Fluid("boiling_potato_juice",new ResourceLocation(Soot.MODID,"blocks/potato_juice"),new ResourceLocation(Soot.MODID,"blocks/potato_juice_flowing")).setTemperature(500));
FluidRegistry.registerFluid(BOILING_WORMWOOD = new Fluid("boiling_wormwood",new ResourceLocation(Soot.MODID,"blocks/verdigris"),new ResourceLocation(Soot.MODID,"blocks/verdigris_flowing")).setTemperature(500));
FluidRegistry.registerFluid(BOILING_BEETROOT_SOUP = new Fluid("boiling_beetroot_soup",new ResourceLocation(Soot.MODID,"blocks/beetroot_soup"),new ResourceLocation(Soot.MODID,"blocks/beetroot_soup_flowing")).setTemperature(500));
//Alcohol itself. Cold.
FluidRegistry.registerFluid(ALE = new Fluid("ale",new ResourceLocation(Soot.MODID,"blocks/ale"),new ResourceLocation(Soot.MODID,"blocks/ale_flowing")));
FluidRegistry.registerFluid(VODKA = new Fluid("vodka",new ResourceLocation(Soot.MODID,"blocks/vodka"),new ResourceLocation(Soot.MODID,"blocks/vodka_flowing")));
FluidRegistry.registerFluid(INNER_FIRE = new Fluid("inner_fire",new ResourceLocation(Soot.MODID,"blocks/inner_fire"),new ResourceLocation(Soot.MODID,"blocks/inner_fire_flowing")));
FluidRegistry.registerFluid(UMBER_ALE = new Fluid("umber_ale",new ResourceLocation(Soot.MODID,"blocks/umber_ale"),new ResourceLocation(Soot.MODID,"blocks/umber_ale_flowing")));
FluidRegistry.registerFluid(METHANOL = new Fluid("methanol",new ResourceLocation(Soot.MODID,"blocks/methanol"),new ResourceLocation(Soot.MODID,"blocks/methanol_flowing")));
FluidRegistry.registerFluid(ABSINTHE = new Fluid("absinthe",new ResourceLocation(Soot.MODID,"blocks/absinthe"),new ResourceLocation(Soot.MODID,"blocks/absinthe_flowing")));
//Alchemy Fluids
FluidRegistry.registerFluid(MOLTEN_ANTIMONY = new FluidMolten("antimony",new ResourceLocation(Soot.MODID,"blocks/molten_antimony"),new ResourceLocation(Soot.MODID,"blocks/molten_antimony_flowing")));
FluidRegistry.registerFluid(MOLTEN_SUGAR = new FluidMolten("sugar",new ResourceLocation(Soot.MODID,"blocks/molten_sugar"),new ResourceLocation(Soot.MODID,"blocks/molten_sugar_flowing")));
}
示例10: work
import net.minecraftforge.fluids.FluidRegistry; //導入依賴的package包/類
@Override
public float work() {
if (WorkUtils.isDisabled(this.getBlockType())) return 0;
if (this.world.rand.nextBoolean() && this.world.rand.nextBoolean()) return 1;
List<BlockPos> blockPos = BlockUtils.getBlockPosInAABB(getWorkingArea());
boolean allWaterSources = true;
for (BlockPos pos : blockPos) {
IBlockState state = this.world.getBlockState(pos);
if (!(state.getBlock().equals(FluidRegistry.WATER.getBlock()) && state.getBlock().getMetaFromState(state) == 0))
allWaterSources = false;
}
if (allWaterSources) {
LootContext.Builder lootcontext = new LootContext.Builder((WorldServer) this.world);
List<ItemStack> items = this.world.getLootTableManager().getLootTableFromLocation(LootTableList.GAMEPLAY_FISHING).generateLootForPools(this.world.rand, lootcontext.build());
for (ItemStack stack : items) {
ItemHandlerHelper.insertItem(outFish, stack, false);
}
return 1;
}
return 1;
}
示例11: collideItem
import net.minecraftforge.fluids.FluidRegistry; //導入依賴的package包/類
@SuppressWarnings("ConstantConditions")
public void collideItem(EntityItem entityItem) {
final ItemStack dropped = entityItem.getItem();
if (dropped.isEmpty() || entityItem.isDead)
return;
if (inv.hasFluid()) {
if (!inv.hasFluid(FluidRegistry.LAVA)) {
boolean splash = false;
if (getContainer().isEmpty() && isBoiling()) {
splash = recipeDropLogic(dropped);
}
if (splash) {
play(SoundEvents.ENTITY_GENERIC_SPLASH, 0.5F, 0.5F);
}
} else {
play(SoundEvents.BLOCK_LAVA_EXTINGUISH, 1F, 1F);
entityItem.setDead();
return;
}
if (dropped.getCount() == 0)
entityItem.setDead();
}
}
示例12: recipeDropLogic
import net.minecraftforge.fluids.FluidRegistry; //導入依賴的package包/類
public boolean recipeDropLogic(ItemStack dropped) {
if (mode == Mode.NORMAL && changeMode(dropped.getItem())) {
play(SoundEvents.ENTITY_FIREWORK_TWINKLE, 0.2F, 1F);
dropped.setCount(0);
return true;
}
switch (mode) {
case NORMAL:
return processingLogic(dropped) || (inv.hasFluid(FluidRegistry.WATER) && acceptIngredient(dropped));
case POTION:
return acceptIngredient(dropped);
case CUSTOM:
return acceptIngredient(dropped);
default:
}
return false;
}
示例13: createFluid
import net.minecraftforge.fluids.FluidRegistry; //導入依賴的package包/類
private static <T extends Block & IFluidBlock> Fluid createFluid(String name, boolean hasFlowIcon, Consumer<Fluid> fluidPropertyApplier, Function<Fluid, T> blockFactory, boolean hasBucket) {
final ResourceLocation still = new ResourceLocation(LibMod.MOD_ID + ":blocks/fluid/" + name + "_still");
final ResourceLocation flowing = hasFlowIcon ? new ResourceLocation(LibMod.MOD_ID + ":blocks/fluid/" + name + "_flow") : still;
Fluid fluid = new Fluid(name, still, flowing);
final boolean useOwnFluid = FluidRegistry.registerFluid(fluid);
if (useOwnFluid) {
fluidPropertyApplier.accept(fluid);
MOD_FLUID_BLOCKS.add(blockFactory.apply(fluid));
if (hasBucket)
FluidRegistry.addBucketForFluid(fluid);
} else {
fluid = FluidRegistry.getFluid(name);
}
return fluid;
}
示例14: registerGeoBurnables
import net.minecraftforge.fluids.FluidRegistry; //導入依賴的package包/類
@SubscribeEvent
public static void registerGeoBurnables(RegistryEvent.Register<IGeoburnable> event){
IForgeRegistry<IGeoburnable> reg = event.getRegistry();
reg.register(new BlockGeoburnable(Blocks.MAGMA, 40, 1));
reg.register(new BlockGeoburnable(Blocks.FIRE, 80, 2){
@Override
public ItemStack getJEIIcon() {
return new ItemStack(Items.FLINT_AND_STEEL);
}
});
reg.register(new BlockGeoburnable(Blocks.LAVA, 160, 3){
@Override
public ItemStack getJEIIcon() {
return FluidUtil.getFilledBucket(new FluidStack(FluidRegistry.LAVA, Fluid.BUCKET_VOLUME));
}
});
}
示例15: update
import net.minecraftforge.fluids.FluidRegistry; //導入依賴的package包/類
@Override
public void update() {
if(!this.world.isRemote){
checkValid();
if(burnTime>0){
burnTime--;
}else{
if(itemsLeft>0){
itemsLeft--;
creosote.fill(FluidRegistry.getFluidStack("creosote", isCoke?Config.CokeCreosote:Config.CharcoalCreosote), true);
burnTime=isCoke?Config.CokeTime/10:Config.CharcoalTime/10;
}else{
this.world.setBlockState(this.pos, isCoke?BlocksRegistry.cokePile.getDefaultState():BlocksRegistry.charcoalPile.getDefaultState());
}
}
if(creosote.getFluidAmount()>0){
if(this.world.getTileEntity(this.pos.offset(EnumFacing.DOWN))instanceof TileActivePile){
TileActivePile down=(TileActivePile)this.world.getTileEntity(this.pos.offset(EnumFacing.DOWN));
creosote.drain(down.creosote.fill(creosote.getFluid(), true), true);
}
}
}
}