mirror of
https://github.com/PixelGuys/Cubyz.git
synced 2025-08-03 19:28:49 -04:00
Make water more watery
This commit is contained in:
parent
ab5947c363
commit
ed8bb9b778
@ -334,7 +334,7 @@ public class Cubyz implements IGameLogic {
|
||||
if (breakCooldown == 0) {
|
||||
breakCooldown = 10;
|
||||
BlockInstance bi = msd.getSelectedBlockInstance();
|
||||
if (bi.getBlock().getHardness() != -1f) {
|
||||
if (bi != null && bi.getBlock().getHardness() != -1f) {
|
||||
world.removeBlock(bi.getX(), bi.getY(), bi.getZ());
|
||||
} else {
|
||||
return;
|
||||
|
@ -43,6 +43,8 @@ public class CubyzMeshSelectionDetector {
|
||||
continue;
|
||||
try {
|
||||
for (BlockInstance bi : ch.getVisibles()) {
|
||||
if(!bi.getBlock().isSolid())
|
||||
continue;
|
||||
((BlockSpatial) bi.getSpatial()).setSelected(false);
|
||||
min.set(bi.getPosition());
|
||||
max.set(bi.getPosition());
|
||||
|
@ -14,7 +14,6 @@ public class Block implements IRegistryElement {
|
||||
private String texture;
|
||||
private float hardness;
|
||||
private boolean solid = true;
|
||||
//NOTE FOR ZEN: This variable is mostly making the fluids non-selectable! Also i couln't find where you made the blocks selected. Please make if this is false, then the block isn't blue (selected)!!
|
||||
private boolean selectable = true;
|
||||
|
||||
public String getTexture() {
|
||||
|
@ -5,6 +5,7 @@ public class OakLeaves extends Block {
|
||||
public OakLeaves() {
|
||||
setTexture("oak_leaves");
|
||||
setID("cubyz:oak_leaves");
|
||||
this.transparent = true;
|
||||
}
|
||||
|
||||
}
|
@ -6,6 +6,8 @@ public class Water extends Block {
|
||||
setTexture("water");
|
||||
setID("cubyz:water");
|
||||
setSelectable(false);
|
||||
setSolid(false);
|
||||
transparent = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -122,7 +122,7 @@ public class Chunk {
|
||||
if(generated) {
|
||||
BlockInstance[] neighbors = inst0.getNeighbors();
|
||||
for (int i = 0; i < neighbors.length; i++) {
|
||||
if (neighbors[i] == null) {
|
||||
if (blocksLight(neighbors[i], inst0.getBlock().isTransparent())) {
|
||||
visibles.add(inst0);
|
||||
break;
|
||||
}
|
||||
@ -134,7 +134,7 @@ public class Chunk {
|
||||
BlockInstance[] neighbors1 = neighbors[i].getNeighbors();
|
||||
boolean vis = true;
|
||||
for (int j = 0; j < neighbors1.length; j++) {
|
||||
if (neighbors1[j] == null) {
|
||||
if (blocksLight(neighbors1[j], neighbors[i].getBlock().isTransparent())) {
|
||||
vis = false;
|
||||
break;
|
||||
}
|
||||
@ -232,7 +232,8 @@ public class Chunk {
|
||||
int px = bi.getX()&15;
|
||||
int py = bi.getZ()&15;
|
||||
for (int i = 0; i < neighbors.length; i++) {
|
||||
if (neighbors[i] == null && (j != 0 || i != 4)
|
||||
if (blocksLight(neighbors[i], bi.getBlock().isTransparent())
|
||||
&& (j != 0 || i != 4)
|
||||
&& (px != 0 || i != 0 || chx0)
|
||||
&& (px != 15 || i != 1 || chx1)
|
||||
&& (py != 0 || i != 3 || chy0)
|
||||
@ -259,7 +260,7 @@ public class Chunk {
|
||||
if(ch.contains(inst0)) {
|
||||
continue;
|
||||
}
|
||||
if (inst0.getNeighbor(neighbor[k]) == null) {
|
||||
if (blocksLight(inst0.getNeighbor(neighbor[k]), inst0.getBlock().isTransparent())) {
|
||||
ch.revealBlock(inst0);
|
||||
continue;
|
||||
}
|
||||
@ -270,6 +271,13 @@ public class Chunk {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean blocksLight(BlockInstance bi, boolean transparent) {
|
||||
if(bi == null || (bi.getBlock().isTransparent() && !transparent)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// This function only allows a less than 50% of the underground to be ores.
|
||||
public BlockInstance selectOre(float rand, int height) {
|
||||
float chance1 = 0.0F;
|
||||
|
Loading…
x
Reference in New Issue
Block a user