本文整理汇总了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() + "\"");
}
}
示例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;
}
}
示例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;
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
}
示例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;
}
示例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);
}
示例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");
}
}
示例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;
}
示例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 };
}
示例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();
}
示例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};
}
示例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);
}
}
}
示例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;
}