protected void drawFluidStackTooltip(FluidStack par1ItemStack, int par2, int par3) { this.zLevel = 100; List list = getLiquidTooltip(par1ItemStack, this.mc.gameSettings.advancedItemTooltips); for (int k = 0; k < list.size(); ++k) { list.set(k, EnumChatFormatting.GRAY + (String) list.get(k)); } this.drawToolTip(list, par2, par3); this.zLevel = 0; }
private static void repathNeighbors(World world, int i, int j, int k) { TileEntity tileentity = getTileEntity(world, i, j, k); List<ChunkCoordinates> blocks = Lists.newLinkedList(); blocks.add(new ChunkCoordinates(i, j, k)); world.setBlockMetadataWithNotify(i, j, k, 8, 2); while (blocks.size() > 0) { ChunkCoordinates coords = blocks.remove(0); redirectPortal(world, tileentity, coords.posX + 1, coords.posY, coords.posZ, 5, blocks); redirectPortal(world, tileentity, coords.posX, coords.posY + 1, coords.posZ, 1, blocks); redirectPortal(world, tileentity, coords.posX, coords.posY, coords.posZ + 1, 3, blocks); redirectPortal(world, tileentity, coords.posX - 1, coords.posY, coords.posZ, 6, blocks); redirectPortal(world, tileentity, coords.posX, coords.posY - 1, coords.posZ, 2, blocks); redirectPortal(world, tileentity, coords.posX, coords.posY, coords.posZ - 1, 4, blocks); } }
public <BLOCK extends Block> BLOCK newBlock( String name, Class<BLOCK> cls, Class itemClass, String title) { try { int id = config.getBlock(name, 4095).getInt(); Constructor<BLOCK> ctor = cls.getConstructor(int.class); BLOCK block = ctor.newInstance(id); String qualName = assetKey + ":" + name; block.setUnlocalizedName(qualName); // block.func_111022_d(qualName.toLowerCase()); // Set default icon name // block.func_111022_d(qualName); // Set default icon name block.setTextureName(qualName); // Set default icon name GameRegistry.registerBlock(block, itemClass); if (title != null) { LanguageRegistry.addName(block, title); if (clientSide) { // System.out.printf("%s: BaseMod.newBlock: %s: creative tab = %s\n", // this, block.getUnlocalizedName(), block.getCreativeTabToDisplayOn()); if (block.getCreativeTabToDisplayOn() == null && !title.startsWith("[")) block.setCreativeTab(CreativeTabs.tabMisc); } } if (block instanceof IBlock) registeredBlocks.add((IBlock) block); return block; } catch (Exception e) { throw new RuntimeException(e); } }
int addVillager(String name, ResourceLocation skin) { int id = config.getVillager(name); VSBinding b = new VSBinding(); b.id = id; b.object = skin; registeredVillagers.add(b); return id; }
private static void onpulse(World world, int i, int j, int k) { List<ChunkCoordinates> set = Lists.newLinkedList(); Stack<ChunkCoordinates> validate = new Stack<ChunkCoordinates>(); addSurrounding(set, i, j, k); while (set.size() > 0) { ChunkCoordinates coords = set.remove(0); expandPortal(world, coords.posX, coords.posY, coords.posZ, set, validate); } while (validate.size() > 0) { ChunkCoordinates coords = validate.pop(); i = coords.posX; j = coords.posY; k = coords.posZ; if (!BlockPortal.checkPortalTension(world, i, j, k)) { world.setBlock(i, j, k, Blocks.air, 0, 0); } } }
private static void directPortal( World world, int i, int j, int k, int meta, List<ChunkCoordinates> blocks, List<ChunkCoordinates> portals) { if (isValidLinkPortalBlock(world.getBlock(i, j, k)) == 0) { return; } if (world.getBlockMetadata(i, j, k) != 0) { return; } world.setBlockMetadataWithNotify(i, j, k, meta, 0); if (world.getBlock(i, j, k) == NailedBlocks.portal) { portals.add(new ChunkCoordinates(i, j, k)); } else { blocks.add(new ChunkCoordinates(i, j, k)); } }
public static void unpath(World world, int i, int j, int k) { List<ChunkCoordinates> blocks = Lists.newLinkedList(); List<ChunkCoordinates> notify = Lists.newLinkedList(); blocks.add(new ChunkCoordinates(i, j, k)); while (blocks.size() > 0) { ChunkCoordinates coords = blocks.remove(0); depolarize(world, coords.posX + 1, coords.posY, coords.posZ, blocks); depolarize(world, coords.posX, coords.posY + 1, coords.posZ, blocks); depolarize(world, coords.posX, coords.posY, coords.posZ + 1, blocks); depolarize(world, coords.posX - 1, coords.posY, coords.posZ, blocks); depolarize(world, coords.posX, coords.posY - 1, coords.posZ, blocks); depolarize(world, coords.posX, coords.posY, coords.posZ - 1, blocks); notify.add(coords); } for (ChunkCoordinates coords : notify) { if (world.blockExists(coords.posX, coords.posY, coords.posZ)) { world.markBlockForUpdate(coords.posX, coords.posY, coords.posZ); world.notifyBlocksOfNeighborChange( coords.posX, coords.posY, coords.posZ, world.getBlock(coords.posX, coords.posY, coords.posZ)); } } }
private static void depolarize(World world, int i, int j, int k, List<ChunkCoordinates> blocks) { Block block = world.getBlock(i, j, k); if (isValidLinkPortalBlock(block) == 0) { return; } if (world.getBlockMetadata(i, j, k) == 0) { return; } world.setBlockMetadataWithNotify(i, j, k, 0, 0); if ((block == NailedBlocks.portal) && (!BlockPortal.isValidPortal(world, i, j, k))) { world.setBlock(i, j, k, Blocks.air, 0, 2); } blocks.add(new ChunkCoordinates(i, j, k)); }
@Override public void readPageFromXML(Element element) { NodeList nodes = element.getElementsByTagName("tooltype"); if (nodes != null) type = nodes.item(0).getTextContent(); nodes = element.getElementsByTagName("recipe"); if (nodes != null) { String recipe = nodes.item(0).getTextContent(); icons = MantleClientRegistry.getRecipeIcons(recipe); if (type.equals("travelmulti")) { List<ItemStack[]> stacks = new LinkedList<ItemStack[]>(); List<String> tools = new LinkedList<String>(); String[] suffixes = new String[] {"goggles", "vest", "wings", "boots", "glove", "belt"}; for (String suffix : suffixes) { ItemStack[] icons2 = MantleClientRegistry.getRecipeIcons(nodes.item(0).getTextContent() + suffix); if (icons2 != null) { stacks.add(icons2); tools.add(suffix); } } iconsMulti = new ItemStack[stacks.size()][]; toolMulti = new ItemStack[stacks.size()]; for (int i = 0; i < stacks.size(); i++) { iconsMulti[i] = stacks.get(i); toolMulti[i] = MantleClientRegistry.getManualIcon("travel" + tools.get(i)); } icons = iconsMulti[0]; lastUpdate = System.currentTimeMillis(); counter = 0; } } }
private static void pathto(World world, int i, int j, int k) { List<ChunkCoordinates> blocks = Lists.newLinkedList(); List<ChunkCoordinates> portals = Lists.newLinkedList(); List<ChunkCoordinates> repath = Lists.newLinkedList(); List<ChunkCoordinates> redraw = Lists.newLinkedList(); blocks.add(new ChunkCoordinates(i, j, k)); while ((portals.size() > 0) || (blocks.size() > 0)) { while (blocks.size() > 0) { ChunkCoordinates coords = blocks.remove(0); directPortal(world, coords.posX + 1, coords.posY, coords.posZ, 5, blocks, portals); directPortal(world, coords.posX, coords.posY + 1, coords.posZ, 1, blocks, portals); directPortal(world, coords.posX, coords.posY, coords.posZ + 1, 3, blocks, portals); directPortal(world, coords.posX - 1, coords.posY, coords.posZ, 6, blocks, portals); directPortal(world, coords.posX, coords.posY - 1, coords.posZ, 2, blocks, portals); directPortal(world, coords.posX, coords.posY, coords.posZ - 1, 4, blocks, portals); redraw.add(coords); } if (portals.size() > 0) { ChunkCoordinates coords = portals.remove(0); directPortal(world, coords.posX + 1, coords.posY, coords.posZ, 5, blocks, portals); directPortal(world, coords.posX, coords.posY + 1, coords.posZ, 1, blocks, portals); directPortal(world, coords.posX, coords.posY, coords.posZ + 1, 3, blocks, portals); directPortal(world, coords.posX - 1, coords.posY, coords.posZ, 6, blocks, portals); directPortal(world, coords.posX, coords.posY - 1, coords.posZ, 2, blocks, portals); directPortal(world, coords.posX, coords.posY, coords.posZ - 1, 4, blocks, portals); if (world.getBlock(coords.posX, coords.posY, coords.posZ) == NailedBlocks.portal) { repath.add(coords); } } } while (repath.size() > 0) { ChunkCoordinates coords = repath.remove(0); if (world.getBlock(coords.posX, coords.posY, coords.posZ) == NailedBlocks.portal) { if (!BlockPortal.isValidPortal(world, coords.posX, coords.posY, coords.posZ)) { repathNeighbors(world, coords.posX, coords.posY, coords.posZ); world.setBlock(coords.posX, coords.posY, coords.posZ, Blocks.air, 0, 0); addSurrounding(repath, coords.posX, coords.posY, coords.posZ); } else { redraw.add(coords); } } } for (ChunkCoordinates coords : redraw) { if (world.blockExists(coords.posX, coords.posY, coords.posZ)) { world.markBlockForUpdate(coords.posX, coords.posY, coords.posZ); world.notifyBlocksOfNeighborChange( coords.posX, coords.posY, coords.posZ, world.getBlock(coords.posX, coords.posY, coords.posZ)); } } }
protected void drawToolTip(List par1List, int par2, int par3) { if (!par1List.isEmpty()) { GL11.glDisable(GL12.GL_RESCALE_NORMAL); RenderHelper.disableStandardItemLighting(); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_DEPTH_TEST); int k = 0; Iterator iterator = par1List.iterator(); while (iterator.hasNext()) { String s = (String) iterator.next(); int l = this.fontRenderer.getStringWidth(s); if (l > k) { k = l; } } int i1 = par2 + 12; int j1 = par3 - 12; int k1 = 8; if (par1List.size() > 1) { k1 += 2 + (par1List.size() - 1) * 10; } if (i1 + k > this.width) { i1 -= 28 + k; } if (j1 + k1 + 6 > this.height) { j1 = this.height - k1 - 6; } this.zLevel = 300.0F; itemRenderer.zLevel = 300.0F; int l1 = -267386864; this.drawGradientRect(i1 - 3, j1 - 4, i1 + k + 3, j1 - 3, l1, l1); this.drawGradientRect(i1 - 3, j1 + k1 + 3, i1 + k + 3, j1 + k1 + 4, l1, l1); this.drawGradientRect(i1 - 3, j1 - 3, i1 + k + 3, j1 + k1 + 3, l1, l1); this.drawGradientRect(i1 - 4, j1 - 3, i1 - 3, j1 + k1 + 3, l1, l1); this.drawGradientRect(i1 + k + 3, j1 - 3, i1 + k + 4, j1 + k1 + 3, l1, l1); int i2 = 1347420415; int j2 = (i2 & 16711422) >> 1 | i2 & -16777216; this.drawGradientRect(i1 - 3, j1 - 3 + 1, i1 - 3 + 1, j1 + k1 + 3 - 1, i2, j2); this.drawGradientRect(i1 + k + 2, j1 - 3 + 1, i1 + k + 3, j1 + k1 + 3 - 1, i2, j2); this.drawGradientRect(i1 - 3, j1 - 3, i1 + k + 3, j1 - 3 + 1, i2, i2); this.drawGradientRect(i1 - 3, j1 + k1 + 2, i1 + k + 3, j1 + k1 + 3, j2, j2); for (int k2 = 0; k2 < par1List.size(); ++k2) { String s1 = (String) par1List.get(k2); this.fontRenderer.drawStringWithShadow(s1, i1, j1, -1); if (k2 == 0) { j1 += 2; } j1 += 10; } this.zLevel = 0.0F; itemRenderer.zLevel = 0.0F; } }