@Override public Object[] invoke(TileEntity te, Object[] args) throws LuaException, InterruptedException { ElementTagCompound tag = ((LumenTile) te).getEnergy(); Object[] o = new Object[16]; for (int i = 0; i < CrystalElement.elements.length; i++) { CrystalElement e = CrystalElement.elements[i]; o[i] = tag.getValue(e); } return o; }
@Override protected void drawGuiContainerForegroundLayer(int par1, int par2) { super.drawGuiContainerForegroundLayer(par1, par2); int j = (width - xSize) / 2; int k = (height - ySize) / 2; int minx = 120; int miny = 24; int w = 36; int maxx = minx + w; int maxy = miny + w; if (mode == AspectMode.DEMAND) { // api.drawRectFrame(minx, miny, w, w, ReikaColorAPI.mixColors(this.getActive().getColor(), // 0x1e1e1e, clickDelay/90F)); // Color.HSBtoRGB(hsb[0], Math.min(clickDelay/90F, hsb[1]), Math.min(bright/255F, hsb[2])) int color = ReikaColorAPI.mixColors(0x010101, 0xffffff, 1 - bright / 255F - clickDelay / 90F); color = ReikaColorAPI.mixColors(color, this.getActive().getColor(), 1 - clickDelay / 90F); api.drawRectFrame(minx, miny, w, w, color); if (api.isMouseInBox(j + minx, j + maxx, k + miny, k + maxy)) { bright = Math.min(bright + 12, 255); } else { bright = Math.max(bright - 4, 30); } if (clickDelay > 0) { clickDelay = Math.max(clickDelay - 4, 0); } ElementTagCompound tag = TileEntityAspectFormer.getAspectCost(this.getActive()); int dx = 18; int dy = 21; boolean text = GuiScreen.isCtrlKeyDown() && api.isMouseInBox( j + dx + 32 - 20, j + dx + 32 + 20, k + dy + 20 - 20, k + dy + 20 + 20); Proportionality<CrystalElement> p = text ? null : new Proportionality(); HashMap<CrystalElement, Integer> colors = text ? null : new HashMap(); for (CrystalElement e : tag.elementSet()) { if (text) { String s = e.displayName + ": " + tag.getValue(e) + " L/Vis"; fontRendererObj.drawString( s, dx, dy, ReikaColorAPI.mixColors(e.getColor(), 0xffffff, 0.75F)); dy += fontRendererObj.FONT_HEIGHT; } else { p.addValue(e, tag.getValue(e)); colors.put(e, e.getColor()); } } if (!text) { p.renderAsPie(dx + 32, dy + 20, 20, 0, colors); api.drawCircle(dx + 32, dy + 20, 20.25, 0x000000); } } }
@Override protected ElementTagCompound getRequiredEnergy() { ElementTagCompound tag = new ElementTagCompound(); tag.addTag( CrystalElement.GREEN, this.getMaxStorage(CrystalElement.GREEN) - energy.getValue(CrystalElement.GREEN)); tag.addTag( CrystalElement.PURPLE, this.getMaxStorage(CrystalElement.PURPLE) - energy.getValue(CrystalElement.PURPLE)); return tag; }
private void renderGlow( TileEntityChromaLamp te, double par2, double par4, double par6, float par8) { ElementTagCompound tag = te.getColors(); Tessellator v5 = Tessellator.instance; GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_LIGHTING); BlendMode.ADDITIVEDARK.apply(); ReikaTextureHelper.bindTexture(ChromatiCraft.class, "Textures/clouds/bubble.png"); int tick = te.getTicksExisted(); double s = 0.3875; double h = 0.875; for (CrystalElement e : tag.elementSet()) { GL11.glPushMatrix(); double ang = Math.toRadians(map[e.ordinal()]); double ang2 = e.ordinal() * 22.5; double vu = Math.cos(ang); double vv = Math.sin(ang); int alpha = Math.max(0, (int) (255 * Math.sin(Math.toRadians(ang2 + tick + par8)))); double u = (vu * (tick) % 32) / 32D; double v = (vv * (tick) % 32) / 32D; double du = 1 + u; double dv = 1 + v; int color = ReikaColorAPI.mixColors(e.getColor(), 0, alpha / 255F); v5.startDrawingQuads(); v5.setColorOpaque_I(color); v5.setBrightness(240); v5.addVertexWithUV(0.5 - s, h, 0.5 - s, u, dv); v5.addVertexWithUV(0.5 + s, h, 0.5 - s, du, dv); v5.addVertexWithUV(0.5 + s, 0, 0.5 - s, du, v); v5.addVertexWithUV(0.5 - s, 0, 0.5 - s, u, v); v5.addVertexWithUV(0.5 - s, 0, 0.5 + s, du, v); v5.addVertexWithUV(0.5 + s, 0, 0.5 + s, u, v); v5.addVertexWithUV(0.5 + s, h, 0.5 + s, u, dv); v5.addVertexWithUV(0.5 - s, h, 0.5 + s, du, dv); v5.addVertexWithUV(0.5 + s, h, 0.5 - s, u, dv); v5.addVertexWithUV(0.5 + s, h, 0.5 + s, du, dv); v5.addVertexWithUV(0.5 + s, 0, 0.5 + s, du, v); v5.addVertexWithUV(0.5 + s, 0, 0.5 - s, u, v); v5.addVertexWithUV(0.5 - s, 0, 0.5 - s, du, v); v5.addVertexWithUV(0.5 - s, 0, 0.5 + s, u, v); v5.addVertexWithUV(0.5 - s, h, 0.5 + s, u, dv); v5.addVertexWithUV(0.5 - s, h, 0.5 - s, du, dv); v5.draw(); GL11.glPopMatrix(); } BlendMode.DEFAULT.apply(); GL11.glEnable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_BLEND); }
static { required.addTag(CrystalElement.YELLOW, 50); required.addTag(CrystalElement.LIME, 30); required.addTag(CrystalElement.GRAY, 20); required.addTag(CrystalElement.BROWN, 40); }
@Override public void updateEntity(World world, int x, int y, int z, int meta) { if (!world.isRemote) { if (dropFlag) { if (this.getTicksExisted() % 20 == 0) { this.doDropWarning(world, x, y, z); } } else { int n = this.hasSpeed() ? 4 : 1; for (int k = 0; k < n; k++) { if (digging && !coords.isEmpty()) { // this.prepareChunkloading(); if (this.hasEnergy(required)) { Coordinate c = coords.get(index); int dx = c.xCoord; int dy = c.yCoord; int dz = c.zCoord; Block id = this.parseBlock(world.getBlock(dx, dy, dz)); int meta2 = world.getBlockMetadata(dx, dy, dz); // ReikaJavaLibrary.pConsole(readX+":"+dx+", "+dy+", "+readZ+":"+dz+" > // "+ores.getSize(), Side.SERVER); this.removeFound(world, dx, dy, dz, id, meta2); if (id instanceof SpecialOreBlock) { this.dropSpecialOreBlock(world, x, y, z, dx, dy, dz, (SpecialOreBlock) id, meta2); } else if (ReikaBlockHelper.isOre(id, meta2)) { // ores.addBlockCoordinate(dx, dy, dz); this.dropBlock(world, x, y, z, dx, dy, dz, id, meta2); } else if (this.shouldMine(id, meta2)) { this.dropBlock(world, x, y, z, dx, dy, dz, id, meta2); } else if (this.isTieredResource(world, dx, dy, dz, id, meta2)) { this.dropTieredResource(world, x, y, z, dx, dy, dz, id, meta2); } else if (id instanceof MinerBlock) { this.dropMineableBlock(world, x, y, z, dx, dy, dz, id, meta2); } this.useEnergy(required.copy().scale(this.hasEfficiency() ? 0.25F : 1)); // ReikaJavaLibrary.pConsole("Mining "+id+":"+meta2+" @ "+dx+","+dy+","+dz+"; // index="+index); index++; if (index >= coords.size()) { this.finishDigging(); k = n; } } } else if (!digReady && !finishedDigging) { this.prepareChunkloading(); for (int i = 0; i < TICKSTEP; i++) { int dx = x + readX; int dy = readY; int dz = z + readZ; ReikaWorldHelper.forceGenAndPopulate(world, dx, dz); Block id = this.parseBlock(world.getBlock(dx, dy, dz)); int meta2 = world.getBlockMetadata(dx, dy, dz); // ReikaJavaLibrary.pConsole(readX+":"+dx+", "+dy+", "+readZ+":"+dz+" > // "+ores.getSize(), Side.SERVER); boolean add = false; if (ReikaBlockHelper.isOre(id, meta2)) { // ores.addBlockCoordinate(dx, dy, dz); add = coords.add(new Coordinate(dx, dy, dz)); } else if (this.isTieredResource(world, dx, dy, dz, id, meta2)) { add = coords.add(new Coordinate(dx, dy, dz)); } else if (id instanceof MinerBlock && ((MinerBlock) id).isMineable(meta2)) { add = coords.add(new Coordinate(dx, dy, dz)); } else if (this.shouldMine(id, meta2)) { add = coords.add(new Coordinate(dx, dy, dz)); } if (add) { this.addFound(world, dx, dy, dz, id, meta2); } this.updateReadPosition(); if (readY >= worldObj.getActualHeight()) { this.prepareDigging(); } } } } progress = readY; } } if (world.isRemote) this.spawnParticles(world, x, y, z); }
public static ElementTagCompound getRequiredEnergy() { return required.copy(); }
public final ElementTagCompound getEnergy() { ElementTagCompound tag = new ElementTagCompound(); tag.setTag(color, energy); return tag; }
private static int duration(ElementTagCompound energy) { return ReikaMathLibrary.roundUpToX(20, (int) Math.sqrt(energy.getTotalEnergy())); }