コード例 #1
0
 @Override
 public void handleServerSide(EntityPlayer player) {
   World world = DimensionManager.getWorld(this.dim);
   if (world == null) return;
   TileEntity tileEntity = world.getTileEntity(this.x, this.y, this.z);
   if (tileEntity != null && tileEntity instanceof TileEntityCustomizeableDecoration) {
     TileEntityCustomizeableDecoration tile = (TileEntityCustomizeableDecoration) tileEntity;
     tile.setOrientation(rotation);
     tile.setScale(scale);
   }
 }
コード例 #2
0
  public PacketTileRotationScale(
      World world, int xCoord, int yCoord, int zCoord, double rot, double sc) {
    dim = world.provider.dimensionId;
    x = xCoord;
    y = yCoord;
    z = zCoord;
    rotation = rot;
    scale = sc;

    TileEntity tileEntity = world.getTileEntity(this.x, this.y, this.z);
    if (tileEntity != null && tileEntity instanceof TileEntityCustomizeableDecoration) {
      TileEntityCustomizeableDecoration tile = (TileEntityCustomizeableDecoration) tileEntity;
      tile.setOrientation(rotation);
      tile.setScale(scale);
    }
  }
  @Override
  public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float tick) {
    TileEntityCustomizeableDecoration tile = (TileEntityCustomizeableDecoration) tileEntity;
    RenderElement[] renderElements = tile.getRenderElements();

    GL11.glPushMatrix();
    GL11.glColor4d(1, 1, 1, 1);
    GL11.glEnable(3042);
    GL11.glBlendFunc(770, 771);
    GL11.glTranslated(x, y, z);
    for (RenderElement element : renderElements) {
      if (element != null) {
        try {
          //					if(!GraphicUtilities.isModelPathValid(element.getModel())
          //						/*||*/if(	!GraphicUtilities.isTexturePathValid(element.getTexture()) )
          //						break;
          GL11.glPushMatrix();

          GraphicUtilities.bindTexture(element.getTexture());
          GL11.glColor4d(
              element.getColour()[0],
              element.getColour()[1],
              element.getColour()[2],
              element.getAlpha());
          GL11.glTranslated(0.5, 0.5, 0.5);
          GL11.glRotated(tile.getOrientation(), 0, 1, 0);
          GL11.glTranslated(-0.5, -0.5, -0.5);
          GL11.glTranslated(
              element.getTranslation()[0],
              element.getTranslation()[1],
              element.getTranslation()[2]);

          if (element.getRotation()[2] != 0) GL11.glRotated(element.getRotation()[2], 0, 0, 1);
          if (element.getRotation()[1] != 0) GL11.glRotated(element.getRotation()[1], 0, 1, 0);
          if (element.getRotation()[0] != 0) GL11.glRotated(element.getRotation()[0], 1, 0, 0);

          GL11.glScaled(tile.getScale(), tile.getScale(), tile.getScale());
          if (GraphicUtilities.isModelPathValid(element.getModel())) {
            IModelCustom tempMod = GraphicUtilities.bindModel(element.getModel());
            if (tempMod != null && GraphicUtilities.isModelPartValid(tempMod, element.getPart()))
              tempMod.renderPart(element.getPart());
          }
          GL11.glPopMatrix();
        } catch (Exception except) {
          // except.printStackTrace();
          GL11.glPopMatrix();
        }
      }
    }

    GL11.glDisable(3042);
    GL11.glColor4d(1, 1, 1, 1);
    GL11.glPopMatrix();
  }