Fixed wrong custom spawn point
This commit is contained in:
parent
bfbaebe7b2
commit
57191936dc
4 changed files with 28 additions and 17 deletions
|
@ -56,20 +56,7 @@ public abstract class ChorusFlowerBlockMixin extends Block {
|
||||||
int i = state.getValue(ChorusFlowerBlock.AGE);
|
int i = state.getValue(ChorusFlowerBlock.AGE);
|
||||||
if (i < 5) {
|
if (i < 5) {
|
||||||
this.placeGrownFlower(world, up, i + 1);
|
this.placeGrownFlower(world, up, i + 1);
|
||||||
if (GeneratorOptions.changeChorusPlant()) {
|
BlocksHelper.setWithoutUpdate(world, pos, plant.defaultBlockState().setValue(ChorusPlantBlock.UP, true).setValue(ChorusPlantBlock.DOWN, true));
|
||||||
BlocksHelper.setWithoutUpdate(
|
|
||||||
world,
|
|
||||||
pos,
|
|
||||||
plant.defaultBlockState().setValue(ChorusPlantBlock.UP, true).setValue(ChorusPlantBlock.DOWN, true)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
BlocksHelper.setWithoutUpdate(
|
|
||||||
world,
|
|
||||||
pos,
|
|
||||||
plant.defaultBlockState().setValue(ChorusPlantBlock.UP, true).setValue(ChorusPlantBlock.DOWN, true)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
info.cancel();
|
info.cancel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,6 @@ import java.util.Optional;
|
||||||
|
|
||||||
@Mixin(Player.class)
|
@Mixin(Player.class)
|
||||||
public abstract class PlayerMixin extends LivingEntity {
|
public abstract class PlayerMixin extends LivingEntity {
|
||||||
|
|
||||||
protected PlayerMixin(EntityType<? extends LivingEntity> entityType, Level level) {
|
protected PlayerMixin(EntityType<? extends LivingEntity> entityType, Level level) {
|
||||||
super(entityType, level);
|
super(entityType, level);
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,12 +55,32 @@ public abstract class ServerLevelMixin extends Level {
|
||||||
private void be_getSharedSpawnPos(CallbackInfoReturnable<BlockPos> info) {
|
private void be_getSharedSpawnPos(CallbackInfoReturnable<BlockPos> info) {
|
||||||
if (GeneratorOptions.changeSpawn()) {
|
if (GeneratorOptions.changeSpawn()) {
|
||||||
if (ServerLevel.class.cast(this).dimension() == Level.END) {
|
if (ServerLevel.class.cast(this).dimension() == Level.END) {
|
||||||
info.setReturnValue(GeneratorOptions.getSpawn());
|
BlockPos pos = GeneratorOptions.getSpawn();
|
||||||
info.cancel();
|
info.setReturnValue(pos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Inject(method = "makeObsidianPlatform", at = @At("HEAD"), cancellable = true)
|
||||||
|
private static void be_createObsidianPlatform(ServerLevel serverLevel, CallbackInfo info) {
|
||||||
|
if (!GeneratorOptions.generateObsidianPlatform()) {
|
||||||
|
info.cancel();
|
||||||
|
}
|
||||||
|
else if (GeneratorOptions.changeSpawn()) {
|
||||||
|
BlockPos blockPos = GeneratorOptions.getSpawn();
|
||||||
|
int i = blockPos.getX();
|
||||||
|
int j = blockPos.getY() - 2;
|
||||||
|
int k = blockPos.getZ();
|
||||||
|
BlockPos.betweenClosed(i - 2, j + 1, k - 2, i + 2, j + 3, k + 2).forEach((blockPosx) -> {
|
||||||
|
serverLevel.setBlockAndUpdate(blockPosx, Blocks.AIR.defaultBlockState());
|
||||||
|
});
|
||||||
|
BlockPos.betweenClosed(i - 2, j, k - 2, i + 2, j, k + 2).forEach((blockPosx) -> {
|
||||||
|
serverLevel.setBlockAndUpdate(blockPosx, Blocks.OBSIDIAN.defaultBlockState());
|
||||||
|
});
|
||||||
|
info.cancel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@ModifyArg(method = "tickChunk", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/level/ServerLevel;setBlockAndUpdate(Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;)Z"))
|
@ModifyArg(method = "tickChunk", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/level/ServerLevel;setBlockAndUpdate(Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;)Z"))
|
||||||
private BlockState be_modifyTickState(BlockPos pos, BlockState state) {
|
private BlockState be_modifyTickState(BlockPos pos, BlockState state) {
|
||||||
if (state.is(Blocks.ICE)) {
|
if (state.is(Blocks.ICE)) {
|
||||||
|
|
|
@ -74,6 +74,11 @@ public abstract class ServerPlayerMixin extends Player implements TeleportingEnt
|
||||||
getXRot()
|
getXRot()
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
else if (GeneratorOptions.changeSpawn() && destination.dimension() == Level.END) {
|
||||||
|
BlockPos spawn = GeneratorOptions.getSpawn();
|
||||||
|
Vec3 pos = new Vec3(spawn.getX() + 0.5, spawn.getY(), spawn.getZ() + 0.5);
|
||||||
|
info.setReturnValue(new PortalInfo(pos, Vec3.ZERO, 90.0F, 0.0F));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject(method = "changeDimension", at = @At("HEAD"), cancellable = true)
|
@Inject(method = "changeDimension", at = @At("HEAD"), cancellable = true)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue