예제 #1
0
 @Override
 public Object[] invoke(TileEntity te, Object[] args) throws Exception {
   TileEntityAdvancedGear adv = (TileEntityAdvancedGear) te;
   if (adv.getGearType() == GearType.CVT) {
     int ratio = ((Double) args[0]).intValue();
     adv.setRatio(ratio);
   }
   return null;
 }
예제 #2
0
 protected void doRenderMachine(double x, double y, HandbookEntry he) {
   HandbookRegistry h = (HandbookRegistry) he;
   MachineRegistry m = h.getMachine();
   if (m == null) return;
   MaterialRegistry[] mats = MaterialRegistry.values();
   TileEntity te = m.createTEInstanceForRender(0);
   int timeStep = (int) ((System.nanoTime() / SECOND) % mats.length);
   int r = (int) (System.nanoTime() / 20000000) % 360;
   float variable = 0;
   if (h.isEngine() && h != HandbookRegistry.SOLAR) {
     // ((TileEntityEngine)te).type = EngineType.engineList[h.getOffset()];
     // variable = -1000F*(h.getOffset()+1);
     EngineType type = EngineType.engineList[h.getOffset()];
     te = type.getTEInstanceForRender();
     ((TileEntityEngine) te).setType(type.getCraftedProduct());
   }
   if (h == HandbookRegistry.SHAFT) {
     variable = -1000F * (timeStep + 1);
   }
   if (h == HandbookRegistry.FLYWHEEL) {
     int tick = (int) ((System.nanoTime() / SECOND) % RotaryNames.getNumberFlywheelTypes());
     variable = 500 - 1000F * (tick + 1);
   }
   if (h == HandbookRegistry.GEARBOX) {
     variable = -1000F * (timeStep + 1);
   }
   if (h == HandbookRegistry.WORM) {
     variable = -1000F;
   }
   if (h == HandbookRegistry.CVT) {
     variable = -2000F;
   }
   if (h == HandbookRegistry.COIL) {
     int tick = (int) ((System.nanoTime() / SECOND) % 2);
     if (tick == 1) ((TileEntityAdvancedGear) te).setBedrock(true);
     variable = -3000F;
   }
   double sc = 48;
   GL11.glPushMatrix();
   if (m.hasModel() && !m.isPipe()) {
     double dx = x;
     double dy = y + 21;
     double dz = 0;
     GL11.glTranslated(dx, dy, dz);
     GL11.glScaled(sc, -sc, sc);
     GL11.glRotatef(renderq, 1, 0, 0);
     GL11.glRotatef(r, 0, 1, 0);
     TileEntityRendererDispatcher.instance.renderTileEntityAt(te, -0.5, 0, -0.5, variable);
   } else {
     double dx = x;
     double dy = y;
     double dz = 0;
     GL11.glTranslated(dx, dy, dz);
     GL11.glScaled(sc, -sc, sc);
     GL11.glRotatef(renderq, 1, 0, 0);
     GL11.glRotatef(r, 0, 1, 0);
     ReikaTextureHelper.bindTerrainTexture();
     rb.renderBlockAsItem(m.getBlock(), m.getBlockMetadata(), 1);
   }
   GL11.glPopMatrix();
 }