本文整理汇总了Java中ethanjones.cubes.graphics.world.BlockTextureHandler类的典型用法代码示例。如果您正苦于以下问题:Java BlockTextureHandler类的具体用法?Java BlockTextureHandler怎么用?Java BlockTextureHandler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BlockTextureHandler类属于ethanjones.cubes.graphics.world包,在下文中一共展示了BlockTextureHandler类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: reanderBackgroundWhile1
import ethanjones.cubes.graphics.world.BlockTextureHandler; //导入依赖的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;
}
}
示例2: loadGraphics
import ethanjones.cubes.graphics.world.BlockTextureHandler; //导入依赖的package包/类
@Override
public void loadGraphics() {
if (textures == null) {
super.loadGraphics();
return;
}
textureHandlers = new BlockTextureHandler[meta];
for (int m = 0; m < textureHandlers.length; m++) {
textureHandlers[m] = new BlockTextureHandler(textures[m][0]);
if (textures[m].length == 6) {
for (int s = 1; s < textures[m].length; s++) {
textureHandlers[m].setSide(s, textures[m][s]);
}
} else {
throw new CubesException("Invalid JBlock.textures length for id \"" + id + "\"");
}
}
textures = null;
}
示例3: BlockIf
import ethanjones.cubes.graphics.world.BlockTextureHandler; //导入依赖的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);
}
}
示例4: BlockIf2
import ethanjones.cubes.graphics.world.BlockTextureHandler; //导入依赖的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);
}
}
示例5: loadGraphics
import ethanjones.cubes.graphics.world.BlockTextureHandler; //导入依赖的package包/类
@Override
public void loadGraphics() {
if (textures == null) {
super.loadGraphics();
return;
}
textureHandlers = new BlockTextureHandler[meta];
for (int m = 0; m < textureHandlers.length; m++) {
textureHandlers[m] = new BlockTextureHandler(textures[m][0]);
if (textures[m].length == 6) {
for (int s = 1; s < textures[m].length; s++) {
textureHandlers[m].setSide(s, textures[m][s]);
}
} else {
throw new CubesException("Invalid JBlock.textures length for id \"" + id + "\"");
}
}
textures = null;
}
示例6: loadGraphics
import ethanjones.cubes.graphics.world.BlockTextureHandler; //导入依赖的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");
}
}
示例7: render
import ethanjones.cubes.graphics.world.BlockTextureHandler; //导入依赖的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;
}
示例8: loadGraphics
import ethanjones.cubes.graphics.world.BlockTextureHandler; //导入依赖的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 };
}
示例9: renderBackground
import ethanjones.cubes.graphics.world.BlockTextureHandler; //导入依赖的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();
}
示例10: render
import ethanjones.cubes.graphics.world.BlockTextureHandler; //导入依赖的package包/类
@Override
public int render(float[] vertices, int vertexOffset, Vector3 areaOffset, Block block, int meta, BlockTextureHandler textureHandler, Area area, int x, int y, int z, int i, boolean ao, Area minX, Area maxZ, Area minZ, Area maxX) {
vertexOffset = CrossFaceVertices.createMinXMaxZ(areaOffset, textureHandler.getSide(null), x, y, z, area.light[i + MIN_Z_OFFSET] & 0xFF, vertices, vertexOffset, ao);
vertexOffset = CrossFaceVertices.createMaxZMinX(areaOffset, textureHandler.getSide(null), x, y, z, area.light[i + MIN_Z_OFFSET] & 0xFF, vertices, vertexOffset, ao);
vertexOffset = CrossFaceVertices.createMaxXMinZ(areaOffset, textureHandler.getSide(null), x, y, z, area.light[i + MIN_Z_OFFSET] & 0xFF, vertices, vertexOffset, ao);
vertexOffset = CrossFaceVertices.createMinZMaxX(areaOffset, textureHandler.getSide(null), x, y, z, area.light[i + MIN_Z_OFFSET] & 0xFF, vertices, vertexOffset, ao);
return vertexOffset;
}
示例11: loadGraphics
import ethanjones.cubes.graphics.world.BlockTextureHandler; //导入依赖的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: loadGraphics
import ethanjones.cubes.graphics.world.BlockTextureHandler; //导入依赖的package包/类
public void loadGraphics() {
textureHandlers = new BlockTextureHandler[] { new BlockTextureHandler(id) };
}
示例13: getTextureHandler
import ethanjones.cubes.graphics.world.BlockTextureHandler; //导入依赖的package包/类
public BlockTextureHandler getTextureHandler(int meta) {
if (meta < 0 || meta >= textureHandlers.length)
meta = 0;
return textureHandlers[meta];
}
示例14: BlockIf3
import ethanjones.cubes.graphics.world.BlockTextureHandler; //导入依赖的package包/类
private void BlockIf3(int y1, Area area1, Block block1, int i1, Vector3 areaOffset1,
BlockTextureHandler textureHandler1, int x1, int z1, boolean ao1, int vertexOffset1, float[] vertices1) {
if (y1 < area1.maxY) {
if (block1.renderFace(BlockFace.posY, area1.blocks[i1 + MAX_Y_OFFSET])) {
vertexOffset1 = createMaxY(areaOffset1, textureHandler1.getSide(BlockFace.posY),
AmbientOcclusion.posY(area1, x1, y1, z1, ao1), x1, y1, z1,
area1.light[i1 + MAX_Y_OFFSET] & 0xFF, vertices1, vertexOffset1);
}
} else {
vertexOffset1 = createMaxY(areaOffset1, textureHandler1.getSide(BlockFace.posY),
AmbientOcclusion.posY(area1, x1, y1, z1, ao1), x1, y1, z1, MAX_SUNLIGHT, vertices1, vertexOffset1); // FIXME
// fix
// the
// light
// at
// the
// top
// and
// bottom
// of
// an
// area
}
if (y1 > 0) {
if (block1.renderFace(BlockFace.negY, area1.blocks[i1 + MIN_Y_OFFSET])) {
vertexOffset1 = createMinY(areaOffset1, textureHandler1.getSide(BlockFace.negY),
AmbientOcclusion.negY(area1, x1, y1, z1, ao1), x1, y1, z1,
area1.light[i1 + MIN_Y_OFFSET] & 0xFF, vertices1, vertexOffset1);
}
} else {
vertexOffset1 = createMinY(areaOffset1, textureHandler1.getSide(BlockFace.negY),
AmbientOcclusion.negY(area1, x1, y1, z1, ao1), x1, y1, z1, 0, vertices1, vertexOffset1); // FIXME
// fix
// the
// light
// at
// the
// top
// and
// bottom
// of
// an
// area
}
}
示例15: loadGraphics
import ethanjones.cubes.graphics.world.BlockTextureHandler; //导入依赖的package包/类
public void loadGraphics() {
textureHandlers = new BlockTextureHandler[]{new BlockTextureHandler(id)};
}