private static String getMagnetKey(Block block, int meta) { return "bm_" + block.getTranslationKey() + "@" + meta; }
@Nonnull @Override public String getTranslationKey(ItemStack stack) { return block.getTranslationKey().replaceAll("tile.", "tile.botania:"); }
public BlockLivingStairs(IBlockState state) { super(state, state.getBlock().getTranslationKey().replaceAll("tile.", "") + state.getBlock().getMetaFromState(state) + "Stairs"); }
public BlockModWall(Block block, int meta) { super(block); // For backward compat don't kill me String name = block.getTranslationKey().replaceAll("tile.", "") + meta + "Wall"; setRegistryName(name); setTranslationKey(name); setDefaultState(pickDefaultState()); setCreativeTab(BotaniaCreativeTab.INSTANCE); }
public BlockLivingSlab(boolean full, IBlockState state) { super(full, state.getMaterial(), state.getBlock().getTranslationKey().replaceAll("tile.", "") + state.getBlock().getMetaFromState(state) + "Slab" + (full ? "Full" : "")); setSoundType(state.getBlock().getSoundType()); sourceState = state; }
public BlockModPane(Block source) { super(Material.GLASS, false); // Backward compat don't kill me String name = source.getTranslationKey().replaceAll("tile.", "") + "Pane"; setRegistryName(new ResourceLocation(LibMisc.MOD_ID, name)); setTranslationKey(name); setCreativeTab(BotaniaCreativeTab.INSTANCE); setHardness(0.3F); setSoundType(SoundType.GLASS); setLightLevel(1.0F); useNeighborBrightness = true; }
@Override public String getTranslationKey(ItemStack stack){ return InitBlocks.blockColoredLamp.getTranslationKey()+"_"+ALL_LAMP_TYPES[stack.getItemDamage()].regName; } }
public static GuideItem register(GuideCategory cat, Block block, @Nullable IRecipe recipe, @Nullable List<String> args) { String pageTitle = block.getTranslationKey() + ".name"; String text = block.getTranslationKey() + SUFFIX; return register(cat, Item.getItemFromBlock(block), pageTitle, text, recipe, args); }
@Override public String getTranslationKey(ItemStack itemstack) { Block block = getBlock(); if (block instanceof IBlockWithMeta) { IBlockWithMeta blockMeta = (IBlockWithMeta) block; int meta = itemstack.getMetadata(); return block.getTranslationKey() + "." + blockMeta.getNameFromMeta(meta); } return block.getTranslationKey(); }
public static Map<Object, Object> getBasicMeta(@Nonnull Block block) { HashMap<Object, Object> data = Maps.newHashMap(); ResourceLocation name = block.getRegistryName(); data.put("name", name == null ? "unknown" : name.toString()); data.put("displayName", block.getLocalizedName()); data.put("TranslationKey", block.getTranslationKey()); return data; }
public ItemBlockMachine(Block block) { super(block); if (!(block instanceof IMetaBlockName)) { throw new IllegalArgumentException(String.format("The given block %s is not an instance of IMetaBlockName!", block.getTranslationKey())); } this.setMaxDamage(0); this.setHasSubtypes(true); }
@Nonnull @Override public String getTranslationKey(ItemStack stack) { if (block instanceof BlockBase) { return ((BlockBase) block).getTranslationKey(stack.getItemDamage()); } else { return block.getTranslationKey(); } } }
/** * Gets the tile's unlocalized name, based on the block at the location of this entity (client-only). */ @Override public String getUnlocalizedTitle() { String blockUnlocalizedName = getBlockType().getTranslationKey(); return blockUnlocalizedName + '.' + getBlockMetadata() + ".name"; }
@Override public String getUnlocalizedTitle() { Block block = getBlockType(); if (block instanceof BlockBase) { return block.getTranslationKey() + ".name"; } return super.getUnlocalizedTitle(); }
@Override public String getName() { if (this.getBlockType() == null) { ModCyclic.logger.error(" null blockType:" + this.getClass().getName()); return ""; } return this.getBlockType().getTranslationKey() + ".name"; }
public static boolean isAirOrWater(World world, BlockPos pos) { ArrayList<Block> waterBoth = new ArrayList<Block>(); waterBoth.add(Blocks.FLOWING_WATER); waterBoth.add(Blocks.WATER); if (pos == null) { return false; } return world.isAirBlock(pos) || world.getBlockState(pos).getBlock().getTranslationKey().equalsIgnoreCase("tile.water") || (world.getBlockState(pos) != null && waterBoth.contains(world.getBlockState(pos).getBlock())); }
@Override public ITextComponent getDisplayName() { if (blockType == null) { return super.getDisplayName(); } return new TextComponentString(LanguageHandler.format(blockType.getTranslationKey() + ".name")); }
private void verifyFakePlayer(WorldServer w) { if (fakePlayer == null) { fakePlayer = UtilFakePlayer.initFakePlayer(w, this.uuid, this.getBlockType().getTranslationKey()); if (fakePlayer == null) { ModCyclic.logger.error("Fake player failed to init "); } } }
public String getName() { Block block = world.getBlockState(this.pos).getBlock(); return this.hasCustomName() ? this.customName : block.getTranslationKey() + ".name"; }
private void verifyFakePlayer(WorldServer w) { if (fakePlayer == null) { fakePlayer = UtilFakePlayer.initFakePlayer(w, this.uuid, this.getBlockType().getTranslationKey()); if (fakePlayer == null) { ModCyclic.logger.error("Fake player failed to init "); } } }