當前位置: 首頁>>代碼示例>>Java>>正文


Java BlockFace類代碼示例

本文整理匯總了Java中ethanjones.cubes.core.util.BlockFace的典型用法代碼示例。如果您正苦於以下問題:Java BlockFace類的具體用法?Java BlockFace怎麽用?Java BlockFace使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


BlockFace類屬於ethanjones.cubes.core.util包,在下文中一共展示了BlockFace類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: parseSwitch

import ethanjones.cubes.core.util.BlockFace; //導入依賴的package包/類
private void parseSwitch(JsonObject.Member member, String[] textures, String value) {
	parseSwitch2(member, textures, value);
	switch (member.getName()) {
	case "posZ":
		textures[BlockFace.posZ.index] = value;
		break;
	case "negZ":
		textures[BlockFace.negZ.index] = value;
		break;
	case "side":
		textures[BlockFace.posX.index] = value;
		textures[BlockFace.negX.index] = value;
		textures[BlockFace.posZ.index] = value;
		textures[BlockFace.negZ.index] = value;
		break;
	case "other":
		parseSwitchFor(textures, value);
		break;
	default:
		throw new JsonException("Unexpected block texture member \"" + member.getName() + "\"");
	}
}
 
開發者ID:RedTroop,項目名稱:Cubes_2,代碼行數:23,代碼來源:BlockJson.java

示例2: reanderBackgroundWhile1

import ethanjones.cubes.core.util.BlockFace; //導入依賴的package包/類
private static void reanderBackgroundWhile1(List<Block> blocks) {
	int size = blocks.size();
	try {
		while (texture == null && size > 0) {
			int index = MathUtils.random(0, blocks.size() - 1);
			Block block = blocks.get(index);
			if (block.canBeTransparent()) {
				blocks.remove(index);
				continue;
			}
			BlockTextureHandler textureHandler;

			textureHandler = block.getTextureHandler(0);
			if (textureHandler == null)
				throw new Error();
			;
		}
		texture = textureHandler.getSide(BlockFace.posX);
		size = blocks.size();
	} catch (Exception e) {
		blocks.remove(index);
		continue;
	}
}
 
開發者ID:RedTroop,項目名稱:Cubes_2,代碼行數:25,代碼來源:MenuManager.java

示例3: parseSwitch2

import ethanjones.cubes.core.util.BlockFace; //導入依賴的package包/類
private static void parseSwitch2(JsonObject.Member member, String[] textures, String value) {
	switch (member.getName()) {
	case "posX":
		textures[BlockFace.posX.index] = value;
		break;
	case "negX":
		textures[BlockFace.negX.index] = value;
		break;
	case "posY":
		break;
	case "top":
		textures[BlockFace.posY.index] = value;
		break;
	case "negY":
		break;
	case "bottom":
		textures[BlockFace.negY.index] = value;
		break;
	default:
		break;
	}
}
 
開發者ID:RedTroop,項目名稱:Cubes_2,代碼行數:23,代碼來源:BlockJson.java

示例4: BlockIf

import ethanjones.cubes.core.util.BlockFace; //導入依賴的package包/類
private void BlockIf(int x1, int i1, Area area1, Block block1, float[] vertexOffset1, Vector3 areaOffset1,
		BlockTextureHandler textureHandler1, boolean ao1, int y1, int z1, float[] vertices1, Object maxX1,
		int MIN_AREA) {
	if (x1 < SIZE_BLOCKS - 1) {
		if (block1.renderFace(BlockFace.posX, area1.blocks[i1 + MAX_X_OFFSET])) {
			// light: byte is signed (-128 to 127) so & 0xFF to convert
			// to 0-255

			vertexOffset1 = createMaxX(areaOffset1, textureHandler1.getSide(BlockFace.posX),
					AmbientOcclusion.posX(area1, x1, y1, z1, ao1), x1, y1, z1,
					area1.light[i1 + MAX_X_OFFSET] & 0xFF, vertices1, vertexOffset1);
		}
	} else if (maxX1 == null || y1 > maxX1.maxY) {
		vertexOffset1 = createMaxX(areaOffset1, textureHandler1.getSide(BlockFace.posX),
				AmbientOcclusion.posX(area1, x1, y1, z1, ao1), x1, y1, z1, MAX_SUNLIGHT, vertices1, vertexOffset1);
	} else if (block1.renderFace(BlockFace.posX, maxX1.blocks[getRef(MIN_AREA, y1, z1)])) {
		vertexOffset1 = createMaxX(areaOffset1, textureHandler1.getSide(BlockFace.posX),
				AmbientOcclusion.posX(area1, x1, y1, z1, ao1), x1, y1, z1,
				maxX1.light[getRef(MIN_AREA, y1, z1)] & 0xFF, vertices1, vertexOffset1);
	}
}
 
開發者ID:RedTroop,項目名稱:Cubes_2,代碼行數:22,代碼來源:BlockRenderType.java

示例5: BlockIf2

import ethanjones.cubes.core.util.BlockFace; //導入依賴的package包/類
private static void BlockIf2(int x1, int i1, Block block1, Area area1, BlockTextureHandler textureHandler1, int y1,
		int z1, int vertexOffset1, float[] vertices1, boolean ao1, Object minX1, int MAX_AREA) {
	if (x1 > 0) {
		if (block1.renderFace(BlockFace.negX, area1.blocks[i1 + MIN_X_OFFSET])) {
			vertexOffset1 = createMinX(areaOffset1, textureHandler1.getSide(BlockFace.negX),
					AmbientOcclusion.negX(area1, x1, y1, z1, ao1), x1, y1, z1,
					area1.light[i1 + MIN_X_OFFSET] & 0xFF, vertices1, vertexOffset1);
		}
	} else if (minX1 == null || y1 > minX1.maxY) {
		vertexOffset1 = createMinX(areaOffset1, textureHandler1.getSide(BlockFace.negX),
				AmbientOcclusion.negX(area1, x1, y1, z1, ao1), x1, y1, z1, MAX_SUNLIGHT, vertices1, vertexOffset1);
	} else if (block1.renderFace(BlockFace.negX, minX1.blocks[getRef(MAX_AREA, y1, z1)])) {
		vertexOffset1 = createMinX(areaOffset1, textureHandler1.getSide(BlockFace.negX),
				AmbientOcclusion.negX(area1, x1, y1, z1, ao1), x1, y1, z1,
				minX1.light[getRef(MAX_AREA, y1, z1)] & 0xFF, vertices1, vertexOffset1);
	}
}
 
開發者ID:RedTroop,項目名稱:Cubes_2,代碼行數:18,代碼來源:BlockRenderType.java

示例6: placeMeta

import ethanjones.cubes.core.util.BlockFace; //導入依賴的package包/類
@EventHandler
public void placeMeta(PlayerPlaceBlockEvent event) {
	if (event.getBlock() == Blocks.log) {
		placeMetaSwitch(event);
	} else if (event.getBlock() == Blocks.chest) {
		Vector3 pos = event.getPlayer().position.cpy();
		pos.sub(event.getBlockReference().asVector3());
		pos.nor();
		BlockFace blockFace = VectorUtil.directionXZ(pos);
		if (blockFace == null || blockFace == BlockFace.posX) {
			event.setMeta(0);
		} else if (blockFace == BlockFace.negX) {
			event.setMeta(1);
		} else if (blockFace == BlockFace.posZ) {
			event.setMeta(2);
		} else if (blockFace == BlockFace.negZ) {
			event.setMeta(3);
		}
	}
}
 
開發者ID:RedTroop,項目名稱:Cubes_2,代碼行數:21,代碼來源:CubesServer.java

示例7: interactionIf5

import ethanjones.cubes.core.util.BlockFace; //導入依賴的package包/類
private static void interactionIf5(BlockFace blockFace,int stepZ, int stepY){
	if (stepZ > 0)
		blockFace = BlockFace.negY;
	if (stepY < 0)
		blockFace = BlockFace.posY;

}
 
開發者ID:RedTroop,項目名稱:Cubes_2,代碼行數:8,代碼來源:BlockIntersection.java

示例8: getTextureRegion

import ethanjones.cubes.core.util.BlockFace; //導入依賴的package包/類
@Override
public TextureRegion getTextureRegion(int meta) {
  if (block.renderType(meta) == BlockRenderType.DEFAULT) {
    TextureRegion icon = BlockIcons.getIcon(block.id, meta);
    if (icon != null) return icon;
  }
  return block.getTextureHandler(meta).getSide(BlockFace.posX);
}
 
開發者ID:RedTroop,項目名稱:Cubes_2,代碼行數:9,代碼來源:ItemBlock.java

示例9: loadGraphics

import ethanjones.cubes.core.util.BlockFace; //導入依賴的package包/類
@Override
public void loadGraphics() {
  textureHandlers = new BlockTextureHandler[4];

  for (int i = 0; i < textureHandlers.length; i++) {
    textureHandlers[i] = new BlockTextureHandler("core:chest_side");
    textureHandlers[i].setSide(BlockFace.posY, "core:chest_y");
    textureHandlers[i].setSide(BlockFace.negY, "core:chest_y");
    textureHandlers[i].setSide(lockFace[i], "core:chest_lock");
  }
}
 
開發者ID:RedTroop,項目名稱:Cubes_2,代碼行數:12,代碼來源:BlockChest.java

示例10: render

import ethanjones.cubes.core.util.BlockFace; //導入依賴的package包/類
@Override
public int render(float[] vertices1, int vertexOffset1, Vector3 areaOffset1, Block block1, int meta1,
		BlockTextureHandler textureHandler1, Area area1, int x1, int y1, int z1, int i1, boolean ao1,
		Area minX1, Area maxZ1, Area minZ1, Area maxX1) {

	BlockIf(x1, i1, area1, block1, vertexOffset1, areaOffset1, textureHandler1, ao1, y1, z1, vertices1, maxX1,
			MIN_AREA);

	BlockIf2(x1, i1, block1, area1, textureHandler1, y1, z1, vertexOffset1, vertices1, ao1, minX1, MAX_AREA);

	
	BlockIf3(y1, area1, block1, i1, areaOffset1, textureHandler1, x1, z1, ao1, vertexOffset1, vertices1);



	BlockIf( z1,  i1,  block1,  area1,  areaOffset1,  vertexOffset1,  textureHandler1,  x1,  ao1,  y1,  vertices1,  maxZ1,  MIN_AREA);

	if (z1 > 0) {
		if (block1.renderFace(BlockFace.negZ, area1.blocks[i1 + MIN_Z_OFFSET])) {
			vertexOffset1 = createMinZ(areaOffset1, textureHandler1.getSide(BlockFace.negZ),
					AmbientOcclusion.negZ(area1, x1, y1, z1, ao1), x1, y1, z1,
					area1.light[i1 + MIN_Z_OFFSET] & 0xFF, vertices1, vertexOffset1);
		}
	} else if (minZ1 == null || y1 > minZ1.maxY) {
		vertexOffset1 = createMinZ(areaOffset1, textureHandler1.getSide(BlockFace.negZ),
				AmbientOcclusion.negZ(area1, x1, y1, z1, ao1), x1, y1, z1, MAX_SUNLIGHT, vertices1,
				vertexOffset1);
	} else if (block1.renderFace(BlockFace.negZ, minZ1.blocks[getRef(x1, y1, MAX_AREA)])) {
		vertexOffset1 = createMinZ(areaOffset1, textureHandler1.getSide(BlockFace.negZ),
				AmbientOcclusion.negZ(area1, x1, y1, z1, ao1), x1, y1, z1,
				minZ1.light[getRef(x1, y1, MAX_AREA)] & 0xFF, vertices1, vertexOffset1);
	}
	return vertexOffset1;
}
 
開發者ID:RedTroop,項目名稱:Cubes_2,代碼行數:35,代碼來源:BlockRenderType.java

示例11: loadGraphics

import ethanjones.cubes.core.util.BlockFace; //導入依賴的package包/類
@Override
public void loadGraphics() {
	BlockTextureHandler handler = new BlockTextureHandler("core:grass_side");
	handler.setSide(BlockFace.posY, "core:grass_top");
	handler.setSide(BlockFace.negY, "core:dirt");
	textureHandlers = new BlockTextureHandler[] { handler };
}
 
開發者ID:RedTroop,項目名稱:Cubes_2,代碼行數:8,代碼來源:BlockGrass.java

示例12: renderBackground

import ethanjones.cubes.core.util.BlockFace; //導入依賴的package包/類
public static void renderBackground() {
  if (disableBackground) return;
  if (texture == null) {
    List<Block> blocks = new ArrayList<Block>();
    blocks.addAll(IDManager.getBlocks());
    while (texture == null && blocks.size() > 0) {
      int index = MathUtils.random(0, blocks.size() - 1);
      Block block = blocks.get(index);
      if (block.canBeTransparent()) {
        blocks.remove(index);
        continue;
      }
      BlockTextureHandler textureHandler;
      try {
        textureHandler = block.getTextureHandler(0);
        if (textureHandler == null) throw new NullPointerException();
      } catch (Exception e) {
        blocks.remove(index);
        continue;
      }
      texture = textureHandler.getSide(BlockFace.posX);
    }
    if (texture == null) {
      disableBackground = true;
      return;
    }
  }
  spriteBatch.begin();
  spriteBatch.setColor(Color.WHITE);
  float width = texture.getRegionWidth();
  float height = texture.getRegionHeight();
  int xTimes = (int) Math.floor(GUI_WIDTH / width);
  int yTimes = (int) Math.floor(GUI_HEIGHT / height);
  for (int x = 0; x <= xTimes; x++) {
    for (int y = 0; y <= yTimes; y++) {
      spriteBatch.draw(texture, x * width, y * height, width, height);
    }
  }
  spriteBatch.end();
}
 
開發者ID:RedTroop,項目名稱:Cubes,代碼行數:41,代碼來源:MenuManager.java

示例13: loadGraphics

import ethanjones.cubes.core.util.BlockFace; //導入依賴的package包/類
@Override
public void loadGraphics() {
  BlockTextureHandler handler = new BlockTextureHandler("core:grass_side");
  handler.setSide(BlockFace.posY, "core:grass_top");
  handler.setSide(BlockFace.negY, "core:dirt");
  textureHandlers = new BlockTextureHandler[]{handler};
}
 
開發者ID:RedTroop,項目名稱:Cubes,代碼行數:8,代碼來源:BlockGrass.java

示例14: placeMeta

import ethanjones.cubes.core.util.BlockFace; //導入依賴的package包/類
@EventHandler
public void placeMeta(PlayerPlaceBlockEvent event) {
  if (event.getBlock() == Blocks.log) {
    switch (event.getBlockIntersection().getBlockFace()) {
      case posY:
      case negY:
        event.setMeta(0);
        break;
      case posX:
      case negX:
        event.setMeta(1);
        break;
      case posZ:
      case negZ:
        event.setMeta(2);
        break;
    }
  } else if (event.getBlock() == Blocks.chest) {
    Vector3 pos = event.getPlayer().position.cpy();
    pos.sub(event.getBlockReference().asVector3());
    pos.nor();
    BlockFace blockFace = VectorUtil.directionXZ(pos);
    if (blockFace == null || blockFace == BlockFace.posX) {
      event.setMeta(0);
    } else if (blockFace == BlockFace.negX) {
      event.setMeta(1);
    } else if (blockFace == BlockFace.posZ) {
      event.setMeta(2);
    } else if (blockFace == BlockFace.negZ) {
      event.setMeta(3);
    }
  }
}
 
開發者ID:RedTroop,項目名稱:Cubes,代碼行數:34,代碼來源:CubesServer.java

示例15: BlockIntersection

import ethanjones.cubes.core.util.BlockFace; //導入依賴的package包/類
private BlockIntersection(BlockReference blockReference, BlockFace blockFace, Block block, int blockMeta) {
	this.blockReference = blockReference;
	this.blockFace = blockFace;
	this.block = block;
	this.blockMeta = blockMeta;
}
 
開發者ID:RedTroop,項目名稱:Cubes_2,代碼行數:7,代碼來源:BlockIntersection.java


注:本文中的ethanjones.cubes.core.util.BlockFace類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。