Fix some null substitutions

This commit is contained in:
Brady 2019-09-26 18:52:29 -05:00
parent 595f5a35e0
commit f8f214ca90
No known key found for this signature in database
GPG Key ID: 73A788379A197567
3 changed files with 12 additions and 0 deletions

View File

@ -30,6 +30,10 @@ public enum RelativeGoalBlock implements IDatatypePost<GoalBlock, BetterBlockPos
@Override
public GoalBlock apply(IDatatypeContext ctx, BetterBlockPos origin) throws CommandException {
if (origin == null) {
origin = BetterBlockPos.ORIGIN;
}
final ArgConsumer consumer = ctx.getConsumer();
return new GoalBlock(
MathHelper.floor(consumer.getDatatypePost(RelativeCoordinate.INSTANCE, (double) origin.x)),

View File

@ -30,6 +30,10 @@ public enum RelativeGoalXZ implements IDatatypePost<GoalXZ, BetterBlockPos> {
@Override
public GoalXZ apply(IDatatypeContext ctx, BetterBlockPos origin) throws CommandException {
if (origin == null) {
origin = BetterBlockPos.ORIGIN;
}
final ArgConsumer consumer = ctx.getConsumer();
return new GoalXZ(
MathHelper.floor(consumer.getDatatypePost(RelativeCoordinate.INSTANCE, (double) origin.x)),

View File

@ -30,6 +30,10 @@ public enum RelativeGoalYLevel implements IDatatypePost<GoalYLevel, BetterBlockP
@Override
public GoalYLevel apply(IDatatypeContext ctx, BetterBlockPos origin) throws CommandException {
if (origin == null) {
origin = BetterBlockPos.ORIGIN;
}
return new GoalYLevel(
MathHelper.floor(ctx.getConsumer().getDatatypePost(RelativeCoordinate.INSTANCE, (double) origin.y))
);