Grass tiles have regained the ability to disappear under blocks
- Test:Grass now (again) randomly disappears under opaque blocks - Fixed a truly egregious bug in AbstractContextRO.pop() - Fixed BlockContext.pushRelative(AbsRelation) - Some changes in toString methods in contexts
This commit is contained in:
parent
a03c783fc9
commit
78a1c25554
@ -46,7 +46,7 @@ public interface BlockDataContext
|
||||
|
||||
@Override
|
||||
default BlockDataContext pushRelative(AbsRelation direction) {
|
||||
return push(direction.getVector());
|
||||
return push(getLocation().add_(direction.getVector()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -45,7 +45,7 @@ public interface BlockDataContextRO
|
||||
|
||||
@Override
|
||||
default BlockDataContextRO pushRelative(AbsRelation direction) {
|
||||
return push(direction.getVector());
|
||||
return push(getLocation().add_(direction.getVector()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -58,7 +58,8 @@ public abstract class AbstractContextRO<
|
||||
throw new IllegalStateException("Cannot pop(): already top frame");
|
||||
}
|
||||
|
||||
frame = frameStack.pop();
|
||||
frameStack.pop();
|
||||
frame = frameStack.peek();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -149,7 +149,7 @@ public interface BlockGenericContextRO<
|
||||
|
||||
@Override
|
||||
default BlockGenericContextRO<B, T, E> pushRelative(AbsRelation direction) {
|
||||
return push(direction.getVector());
|
||||
return push(getLocation().add_(direction.getVector()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -92,7 +92,7 @@ public interface BlockGenericContextWO<
|
||||
|
||||
@Override
|
||||
default BlockGenericContextWO<B, T, E> pushRelative(AbsRelation direction) {
|
||||
return push(direction.getVector());
|
||||
return push(getLocation().add_(direction.getVector()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -146,7 +146,7 @@ class WorldContexts {
|
||||
* @see #pop()
|
||||
*/
|
||||
default Block pushRelative(AbsRelation direction) {
|
||||
return push(direction.getVector());
|
||||
return push(getLocation().add_(direction.getVector()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -41,7 +41,7 @@ public interface ServerBlockContext extends BlockDataContext, ServerWorldContext
|
||||
|
||||
@Override
|
||||
default ServerBlockContext.Logic pushRelative(AbsRelation direction) {
|
||||
return push(direction.getVector());
|
||||
return push(getLocation().add_(direction.getVector()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -71,7 +71,7 @@ public interface ServerBlockContext extends BlockDataContext, ServerWorldContext
|
||||
|
||||
@Override
|
||||
default ServerBlockContext pushRelative(AbsRelation direction) {
|
||||
return push(direction.getVector());
|
||||
return push(getLocation().add_(direction.getVector()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -46,7 +46,7 @@ public interface ServerBlockContextRO extends ServerWorldContextRO, BlockDataCon
|
||||
|
||||
@Override
|
||||
default ServerBlockContextRO.Logic pushRelative(AbsRelation direction) {
|
||||
return push(direction.getVector());
|
||||
return push(getLocation().add_(direction.getVector()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -76,7 +76,7 @@ public interface ServerBlockContextRO extends ServerWorldContextRO, BlockDataCon
|
||||
|
||||
@Override
|
||||
default ServerBlockContextRO pushRelative(AbsRelation direction) {
|
||||
return push(direction.getVector());
|
||||
return push(getLocation().add_(direction.getVector()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -29,7 +29,7 @@ public interface DefaultServerContextBuilders {
|
||||
|
||||
DefaultServerContext build();
|
||||
|
||||
public interface Empty /* does not extend RSCB */ {
|
||||
public interface Empty /* does not extend DSCB */ {
|
||||
|
||||
WithWorld in(Server server, WorldData world);
|
||||
|
||||
|
@ -150,7 +150,7 @@ class DefaultServerContextImpl extends DefaultServerContext
|
||||
switch (getRole()) {
|
||||
case TILE:
|
||||
result = String.format(
|
||||
"ServerTileContext[x=%d, y=%d, z=%d, %s, index=%d]",
|
||||
"ServerTileContext [x=%+4d, y=%+4d, z=%+4d, %s, index=%d]",
|
||||
frame.location.x,
|
||||
frame.location.y,
|
||||
frame.location.z,
|
||||
@ -160,16 +160,16 @@ class DefaultServerContextImpl extends DefaultServerContext
|
||||
break;
|
||||
case TILE_STACK:
|
||||
result = String
|
||||
.format("ServerBlockFaceContext[x=%d, y=%d, z=%d, %s]", frame.location.x, frame.location.y, frame.location.z, frame.face);
|
||||
.format("ServerBlockFaceContext [x=%+4d, y=%+4d, z=%+4d, %s]", frame.location.x, frame.location.y, frame.location.z, frame.face);
|
||||
break;
|
||||
case LOCATION:
|
||||
result = String.format("ServerBlockContext[x=%d, y=%d, z=%d]", frame.location.x, frame.location.y, frame.location.z);
|
||||
result = String.format("ServerBlockContext [x=%+4d, y=%+4d, z=%+4d]", frame.location.x, frame.location.y, frame.location.z);
|
||||
break;
|
||||
case WORLD:
|
||||
result = String.format("ServerWorldContext");
|
||||
result = "ServerWorldContext";
|
||||
break;
|
||||
default:
|
||||
result = "Uninitialized ReusableServerContext";
|
||||
result = "Uninitialized DefaultServerContext";
|
||||
break;
|
||||
}
|
||||
|
||||
@ -188,7 +188,6 @@ class DefaultServerContextImpl extends DefaultServerContext
|
||||
public Empty reuse() {
|
||||
|
||||
server = null;
|
||||
// worldLogic = null;
|
||||
world = null;
|
||||
|
||||
while (isSubcontexting()) {
|
||||
|
@ -52,6 +52,11 @@ public abstract class FilterServerContext implements ServerTileContext {
|
||||
return parent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getClass().getSimpleName() + " [" + parent + "]";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLayer() {
|
||||
return parent.getLayer();
|
||||
|
@ -178,12 +178,16 @@ public class TickChunk extends Evaluation {
|
||||
ServerTileContext tileContext = context.push(i);
|
||||
|
||||
TileLogic logic = tileContext.logic().getTile();
|
||||
if (!(logic instanceof TickableTile))
|
||||
return;
|
||||
if (!(logic instanceof TickableTile)) {
|
||||
tileContext.pop();
|
||||
continue;
|
||||
}
|
||||
TickableTile tickable = (TickableTile) logic;
|
||||
|
||||
if (tickable.getTickingPolicy(tileContext) != TickingPolicy.RANDOM)
|
||||
return;
|
||||
if (tickable.getTickingPolicy(tileContext) != TickingPolicy.RANDOM) {
|
||||
tileContext.pop();
|
||||
continue;
|
||||
}
|
||||
tickable.tick(tileContext);
|
||||
|
||||
tileContext.pop();
|
||||
|
@ -49,9 +49,7 @@ public class HangingTileLogic extends TileLogic implements UpdateableTile {
|
||||
|
||||
context.pushOpposite();
|
||||
BlockLogic complHost = context.logic().getBlock();
|
||||
boolean result = complHost == null || !complHost.isSolid(context, context.getFace());
|
||||
context.pop();
|
||||
return result;
|
||||
return context.popAndReturn(complHost == null || !complHost.isSolid(context, context.getFace()));
|
||||
}
|
||||
|
||||
public boolean canBeSquashed(ServerTileContextRO context) {
|
||||
|
@ -50,7 +50,7 @@ public class TestTileLogicGrass extends HangingTileLogic implements TickableTile
|
||||
@Override
|
||||
public void tick(ServerTileContext context) {
|
||||
if (!isLocationSuitable(context)) {
|
||||
// context.removeThisTile();
|
||||
context.removeTile();
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user