WIP: End portals
This commit is contained in:
parent
28d501f351
commit
1d098eb7c2
5 changed files with 129 additions and 2 deletions
|
@ -5,6 +5,7 @@ import java.util.Random;
|
|||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.NetherPortalBlock;
|
||||
|
@ -14,14 +15,17 @@ import net.minecraft.sound.SoundCategory;
|
|||
import net.minecraft.sound.SoundEvents;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.registry.BuiltinRegistries;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.world.Heightmap;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldAccess;
|
||||
import net.minecraft.world.dimension.DimensionType;
|
||||
import ru.betterend.client.ERenderLayer;
|
||||
import ru.betterend.client.IRenderTypeable;
|
||||
import ru.betterend.registry.ParticleRegistry;
|
||||
|
||||
public class EndPortalBlock extends NetherPortalBlock implements IRenderTypeable {
|
||||
|
||||
public EndPortalBlock() {
|
||||
super(FabricBlockSettings.copyOf(Blocks.NETHER_PORTAL).luminance(state -> {
|
||||
return 12;
|
||||
|
@ -58,10 +62,24 @@ public class EndPortalBlock extends NetherPortalBlock implements IRenderTypeable
|
|||
|
||||
@Override
|
||||
public void onEntityCollision(BlockState state, World world, BlockPos pos, Entity entity) {
|
||||
BlockPos exitPos = this.findExitPos(world, pos);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ERenderLayer getRenderLayer() {
|
||||
return ERenderLayer.TRANSLUCENT;
|
||||
}
|
||||
|
||||
private BlockPos findExitPos(World world, BlockPos pos) {
|
||||
if (world.getRegistryKey().equals(World.OVERWORLD)) {
|
||||
BlockPos basePos = pos.mutableCopy().set(pos.getX() * 8, pos.getY() * 8, pos.getZ() * 8);
|
||||
int height = world.getTopY(Heightmap.Type.MOTION_BLOCKING_NO_LEAVES, basePos.getX(), basePos.getZ());
|
||||
BlockPos.iterate(basePos.add(-16, -pos.getY() + 1, -16), basePos.add(16, height, 16)).forEach(position -> {
|
||||
|
||||
});
|
||||
} else {
|
||||
|
||||
}
|
||||
return pos;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue