public class BlockTinkerFluid extends BlockFluidClassic { public BlockTinkerFluid(Fluid fluid, Material material) { super(fluid, material); setCreativeTab(TinkerRegistry.tabSmeltery); } @Nonnull @Override public String getUnlocalizedName() { Fluid fluid = FluidRegistry.getFluid(fluidName); if(fluid != null) { return fluid.getUnlocalizedName(); } return super.getUnlocalizedName(); } @Override public BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, IBlockState state, BlockPos pos, EnumFacing face) { return BlockFaceShape.UNDEFINED; } }
log.error("Fluid " + entry.getValue().getUnlocalizedName() + " has an empty name registered!"); log.error("Fluid " + entry.getValue().getUnlocalizedName() + " is registered with an empty name!");
public static @Nonnull ItemStack getBucket(@Nonnull Fluid fluid) { final FluidStack fluidStack = new FluidStack(fluid, Fluid.BUCKET_VOLUME); try { fluidStack.getFluid(); } catch (NullPointerException e) { throw new RuntimeException("The fluid " + fluid + " (" + fluid.getUnlocalizedName() + ") is registered in the FluidRegistry, but the FluidRegistry has no delegate for it. This is impossible.", e); } try { return FluidUtil.getFilledBucket(fluidStack); } catch (Exception e) { throw new RuntimeException("The fluid " + fluid + " (" + fluid.getUnlocalizedName() + ") is registered in the FluidRegistry, but crashes when put into a bucket. This is a bug in the mod it belongs to.", e); } }
@Nonnull @Override public Map<Object, Object> getMeta(@Nonnull FluidStack fluidStack) { Map<Object, Object> data = Maps.newHashMap(); data.put("amount", fluidStack.amount); Fluid fluid = fluidStack.getFluid(); if (fluid != null) { data.put("name", fluid.getName()); data.put("id", FluidRegistry.getDefaultFluidName(fluid)); data.put("rawName", fluid.getUnlocalizedName(fluidStack)); data.put("displayName", fluid.getLocalizedName(fluidStack)); } return data; }
@Override protected void queryMatches(Fluid fluid, String query, final ArrayDeque<FluidStack> results) { if(fluid == null || fluid.getName() == null) { return; } try { FluidStack stack = new FluidStack(fluid, 1000); if(fluid.getUnlocalizedName().toLowerCase().contains(query) || fluid.getLocalizedName(stack).toLowerCase().contains(query) || fluid.getName().toLowerCase().contains(query)) { results.add(stack); } } catch(Exception e) { BetterQuesting.logger.error("An error occured while searching fluid \"" + fluid.getName() + "\" (" + fluid.getClass().getName() + ")", e); } }
public static String getTranslatedFluidName(FluidStack fluidStack) { if (fluidStack == null) return ""; final Fluid fluid = fluidStack.getFluid(); String localizedName = fluid.getLocalizedName(fluidStack); if (!Strings.isNullOrEmpty(localizedName) && !localizedName.equals(fluid.getUnlocalizedName())) { return fluid.getRarity(fluidStack).rarityColor.toString() + localizedName; } else { return TextFormatting.OBFUSCATED + "LOLNOPE" + TextFormatting.RESET; } } }
public BlockFluidBlood(Fluid blood, String name) { super(blood, Material.WATER); this.name = name; blood.setBlock(this); setUnlocalizedName(blood.getUnlocalizedName()); setRegistryName(REFERENCE.MODID, name); }
protected void setNames(Fluid fluid) { setUnlocalizedName(NullHelper.notnullF(fluid.getUnlocalizedName(), "encountered fluid without a name")); setRegistryName("block_fluid_" + fluid.getName().toLowerCase(Locale.ENGLISH)); }
@Override protected void addDisplayText(List<ITextComponent> textList) { if(isStructureFormed()) { FluidStack stackInTank = importFluids.drain(Integer.MAX_VALUE, false); if(stackInTank != null && stackInTank.amount > 0) { TextComponentTranslation fluidName = new TextComponentTranslation(stackInTank.getFluid().getUnlocalizedName(stackInTank)); textList.add(new TextComponentTranslation("gregtech.multiblock.distillation_tower.distilling_fluid", fluidName)); } } super.addDisplayText(textList); }
@Override public String getUnlocalizedName(ItemStack stack) { FluidIdentifierStack fluidStack = SimpleServiceLocator.logisticsFluidManager.getFluidFromContainer(ItemIdentifierStack.getFromStack(stack)); if (fluidStack != null) { String s = fluidStack.makeFluidStack().getFluid().getUnlocalizedName(); if (s != null) { return s; } } return super.getUnlocalizedName(stack); }
@Override public String getItemStackDisplayName(ItemStack stack) { String fluidName = "info.cofh.empty"; String openParen = " ("; String closeParen = StringHelper.END + ")"; if (stack.getTagCompound() != null) { Fluid fluid = FluidRegistry.getFluid(stack.getTagCompound().getString(CoreProps.FLUID)); if (fluid != null) { fluidName = fluid.getUnlocalizedName(); if (fluid.getRarity() == EnumRarity.UNCOMMON) { openParen += StringHelper.YELLOW; } else if (fluid.getRarity() == EnumRarity.RARE) { openParen += StringHelper.BRIGHT_BLUE; } else if (fluid.getRarity() == EnumRarity.EPIC) { openParen += StringHelper.PINK; } } } return super.getItemStackDisplayName(stack) + openParen + StringHelper.localize(fluidName) + closeParen; }
private static Map<ResourceLocation, EntryAbstract> buildBlocks() { Map<ResourceLocation, EntryAbstract> entries = new LinkedHashMap<>(); String base = "guide.vampirism.blocks."; //General new ItemInfoBuilder(ModBlocks.castle_block).craftableStacks(new ItemStack(ModBlocks.castle_block, 1, 3), WORKBENCH, new ItemStack(ModBlocks.castle_block, 1, 0), WORKBENCH, new ItemStack(ModBlocks.castle_block, 1, 1), WORKBENCH, new ItemStack(ModBlocks.castle_block, 1, 4), WORKBENCH, new ItemStack(ModBlocks.castle_slab, 1, 0), WORKBENCH, new ItemStack(ModBlocks.castle_slab, 1, 1), WORKBENCH, new ItemStack(ModBlocks.castle_slab, 1, 2), WORKBENCH, new ItemStack(ModBlocks.castle_stairs_dark, 1, 0), WORKBENCH, new ItemStack(ModBlocks.castle_stairs_purple, 1, 0), WORKBENCH, new ItemStack(ModBlocks.castle_stairs_dark_stone, 1, 0), WORKBENCH).build(entries); new ItemInfoBuilder(ModBlocks.vampirism_flower).build(entries); //Vampire new ItemInfoBuilder(ModBlocks.blood_container).craftable(WORKBENCH).build(entries); new ItemInfoBuilder(ModBlocks.altar_inspiration).setLinks(new ResourceLocation("guide.vampirism.vampire.leveling")).craftable(WORKBENCH).build(entries); new ItemInfoBuilder(ModBlocks.altar_infusion).setLinks(new ResourceLocation("guide.vampirism.vampire.leveling")).craftableStacks(new ItemStack(ModBlocks.altar_infusion), WORKBENCH, new ItemStack(ModBlocks.altar_pillar), WORKBENCH, new ItemStack(ModBlocks.altar_tip), WORKBENCH).build(entries); new ItemInfoBuilder(new ItemStack(ModItems.item_coffin), true).craftable(WORKBENCH).build(entries); new ItemInfoBuilder(ModBlocks.church_altar).build(entries); //Hunter new ItemInfoBuilder(new ItemStack(ModItems.item_med_chair), true).setFormats((new ItemStack(ModItems.injection, 1, 1)).getDisplayName(), (new ItemStack(ModItems.injection, 1, 2)).getDisplayName()).craftable(WORKBENCH).build(entries); new ItemInfoBuilder(ModBlocks.hunter_table).setFormats(ModItems.hunter_intel.getLocalizedName()).setLinks(new ResourceLocation("guide.vampirism.hunter.leveling"), new ResourceLocation("guide.vampirism.items.hunter_intel")).craftable(WORKBENCH).build(entries); new ItemInfoBuilder(ModBlocks.weapon_table).craftable(WORKBENCH).build(entries); new ItemInfoBuilder(ModBlocks.blood_potion_table).craftable(WORKBENCH).build(entries); new ItemInfoBuilder(ModBlocks.alchemical_cauldron).craftable(WORKBENCH).build(entries); int cn = Balance.hps.GARLIC_DIFFUSOR_NORMAL_DISTANCE * 2 + 1; int ce = Balance.hps.GARLIC_DIFFUSOR_ENHANCED_DISTANCE * 2 + 1; new ItemInfoBuilder(ModBlocks.garlic_beacon).setFormats(cn, cn, ce, ce, ModItems.purified_garlic.getLocalizedName()).setLinks(new ResourceLocation("guide.vampirism.items.item_garlic"), new ResourceLocation("guide.vampirism.items.purified_garlic"), new ResourceLocation("guide.vampirism.items.holy_water_bottle")).craftableStacks(ModBlocks.garlic_beacon, WORKBENCH, new ItemStack(ModBlocks.garlic_beacon, 1, BlockGarlicBeacon.Type.IMPROVED.getId()), WORKBENCH, ModItems.garlic_beacon_core, ALCHEMICAL_CAULDRON, ModItems.garlic_beacon_core_improved, ALCHEMICAL_CAULDRON).build(entries); new ItemInfoBuilder(ModBlocks.blood_pedestal).craftable(WORKBENCH).build(entries); new ItemInfoBuilder(ModBlocks.blood_grinder).craftable(WORKBENCH).setFormats(ModItems.human_heart.getLocalizedName(), UtilLib.translate(Items.BEEF.getUnlocalizedName() + ".name"), ModBlocks.blood_sieve.getLocalizedName()).build(entries); new ItemInfoBuilder(ModBlocks.blood_sieve).craftable(WORKBENCH).setFormats(UtilLib.translate(ModFluids.impure_blood.getUnlocalizedName()), ModBlocks.blood_grinder.getLocalizedName()).setLinks(new ResourceLocation("guide.vampirism.blocks.blood_grinder")).build(entries); links.putAll(entries); return entries; }