Transparent textures
+ the block selection detector now unselect when no block is looked at
3
.gitignore
vendored
@ -26,4 +26,5 @@ hs_err_pid*
|
||||
.metadata/
|
||||
.recommenders/
|
||||
|
||||
cubyz-client/logs/
|
||||
cubyz-client/logs/
|
||||
cubyz-client/cache
|
BIN
cubyz-client/cache/bedrock.png
vendored
Before Width: | Height: | Size: 20 KiB |
BIN
cubyz-client/cache/coal_ore.png
vendored
Before Width: | Height: | Size: 16 KiB |
BIN
cubyz-client/cache/diamond_ore.png
vendored
Before Width: | Height: | Size: 17 KiB |
BIN
cubyz-client/cache/dirt.png
vendored
Before Width: | Height: | Size: 17 KiB |
BIN
cubyz-client/cache/emerald_ore.png
vendored
Before Width: | Height: | Size: 17 KiB |
BIN
cubyz-client/cache/gold_ore.png
vendored
Before Width: | Height: | Size: 17 KiB |
BIN
cubyz-client/cache/iron_ore.png
vendored
Before Width: | Height: | Size: 16 KiB |
BIN
cubyz-client/cache/oak_leaves.png
vendored
Before Width: | Height: | Size: 16 KiB |
BIN
cubyz-client/cache/oak_log.png
vendored
Before Width: | Height: | Size: 13 KiB |
BIN
cubyz-client/cache/ruby_ore.png
vendored
Before Width: | Height: | Size: 17 KiB |
BIN
cubyz-client/cache/sand.png
vendored
Before Width: | Height: | Size: 13 KiB |
BIN
cubyz-client/cache/stone.png
vendored
Before Width: | Height: | Size: 20 KiB |
BIN
cubyz-client/cache/water.png
vendored
Before Width: | Height: | Size: 6.1 KiB |
@ -130,6 +130,13 @@ public class Cubyz implements IGameLogic {
|
||||
|
||||
@Override
|
||||
public void init(Window window) throws Exception {
|
||||
// Delete cache
|
||||
File cache = new File("cache");
|
||||
if (cache.exists()) {
|
||||
for (File f : cache.listFiles()) {
|
||||
f.delete();
|
||||
}
|
||||
}
|
||||
//CubzLogger.useDefaultHandler = true;
|
||||
gameUI = new UISystem();
|
||||
gameUI.init(window);
|
||||
@ -273,6 +280,8 @@ public class Cubyz implements IGameLogic {
|
||||
public static final ArrayList<Chunk> EMPTY_CHUNK_LIST = new ArrayList<Chunk>();
|
||||
public static final Block[] EMPTY_BLOCK_LIST = new Block[0];
|
||||
|
||||
float playerBobbing;
|
||||
boolean bobbingUp;
|
||||
@Override
|
||||
public void render(Window window) {
|
||||
if (window.shouldClose()) {
|
||||
@ -280,13 +289,29 @@ public class Cubyz implements IGameLogic {
|
||||
}
|
||||
|
||||
if (world != null) {
|
||||
if (playerInc.x != 0 || playerInc.z != 0) { // while walking
|
||||
if (bobbingUp) {
|
||||
playerBobbing += 0.005f;
|
||||
if (playerBobbing >= 0.05f) {
|
||||
bobbingUp = false;
|
||||
}
|
||||
} else {
|
||||
playerBobbing -= 0.005f;
|
||||
if (playerBobbing <= -0.05f) {
|
||||
bobbingUp = true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//System.out.println("no bobbing");
|
||||
//playerBobbing = 0;
|
||||
}
|
||||
if (playerInc.y != 0) {
|
||||
world.getLocalPlayer().vy = playerInc.y;
|
||||
}
|
||||
if (playerInc.x != 0) {
|
||||
world.getLocalPlayer().vx = playerInc.x;
|
||||
}
|
||||
ctx.getCamera().setPosition(world.getLocalPlayer().getPosition().x, world.getLocalPlayer().getPosition().y + 1.5f, world.getLocalPlayer().getPosition().z);
|
||||
ctx.getCamera().setPosition(world.getLocalPlayer().getPosition().x, world.getLocalPlayer().getPosition().y + 1.5f + playerBobbing, world.getLocalPlayer().getPosition().z);
|
||||
}
|
||||
if (world != null) {
|
||||
renderer.render(window, ctx, new Vector3f(0.3F, 0.3F, 0.3F), light, world.getChunks(), world.getBlocks());
|
||||
|
@ -23,8 +23,8 @@ public class CubyzMeshSelectionDetector {
|
||||
}
|
||||
|
||||
/**
|
||||
* Return selected spatial
|
||||
* @return selected spatial, or null if none.
|
||||
* Return selected block instance
|
||||
* @return selected block instance, or null if none.
|
||||
*/
|
||||
public BlockInstance getSelectedBlockInstance() {
|
||||
return selectedSpatial;
|
||||
@ -37,6 +37,7 @@ public class CubyzMeshSelectionDetector {
|
||||
|
||||
public void selectSpatial(List<Chunk> chunks, Vector3f position, Vector3f dir) {
|
||||
float closestDistance = Float.POSITIVE_INFINITY;
|
||||
selectedSpatial = null;
|
||||
for (Chunk ch : chunks) {
|
||||
if(!ch.isLoaded())
|
||||
continue;
|
||||
|
@ -1,6 +1,5 @@
|
||||
package io.cubyz.utils;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.ByteArrayInputStream;
|
||||
@ -37,10 +36,8 @@ public class TextureConverter {
|
||||
System.err.println("Could not read cache of " + name + " texture");
|
||||
}
|
||||
}
|
||||
BufferedImage out = new BufferedImage(1024, 1024, BufferedImage.TYPE_INT_RGB);
|
||||
BufferedImage out = new BufferedImage(1024, 1024, BufferedImage.TYPE_INT_ARGB);
|
||||
Graphics2D g2d = out.createGraphics();
|
||||
g2d.setColor(Color.WHITE);
|
||||
g2d.fillRect(0, 0, 1024, 1024);
|
||||
g2d.drawImage(in, 0, 0, 512, 512, null);
|
||||
g2d.drawImage(in, 512, 0, 512, 512, null);
|
||||
g2d.drawImage(in, 0, 512, 512, 512, null);
|
||||
|
@ -7,8 +7,4 @@ public class OakLeaves extends Block {
|
||||
setID("cubyz:oak_leaves");
|
||||
}
|
||||
|
||||
public void update() {
|
||||
|
||||
}
|
||||
|
||||
}
|