Rename and cleanup

This commit is contained in:
paulevsGitch 2020-10-30 22:09:13 +03:00
parent 37cd89d3f2
commit 581c04c4a2
8 changed files with 15 additions and 26 deletions

View file

@ -5,12 +5,10 @@ import java.util.Random;
import net.fabricmc.api.EnvType; import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment; import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks; import net.minecraft.block.Blocks;
import net.minecraft.block.NetherPortalBlock; import net.minecraft.block.NetherPortalBlock;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.server.world.ServerWorld; import net.minecraft.server.world.ServerWorld;
import net.minecraft.sound.SoundCategory; import net.minecraft.sound.SoundCategory;
@ -21,7 +19,6 @@ import net.minecraft.util.registry.Registry;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.WorldAccess; import net.minecraft.world.WorldAccess;
import net.minecraft.world.dimension.DimensionType; import net.minecraft.world.dimension.DimensionType;
import ru.betterend.client.render.ERenderLayer; import ru.betterend.client.render.ERenderLayer;
import ru.betterend.interfaces.IRenderTypeable; import ru.betterend.interfaces.IRenderTypeable;
import ru.betterend.interfaces.TeleportingEntity; import ru.betterend.interfaces.TeleportingEntity;

View file

@ -23,7 +23,6 @@ import net.minecraft.world.BlockView;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.WorldAccess; import net.minecraft.world.WorldAccess;
import net.minecraft.world.explosion.Explosion; import net.minecraft.world.explosion.Explosion;
import ru.betterend.blocks.basis.BlockPedestal; import ru.betterend.blocks.basis.BlockPedestal;
import ru.betterend.blocks.entities.PedestalBlockEntity; import ru.betterend.blocks.entities.PedestalBlockEntity;
import ru.betterend.registry.EndBlocks; import ru.betterend.registry.EndBlocks;

View file

@ -1,13 +1,11 @@
package ru.betterend.blocks; package ru.betterend.blocks;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks; import net.minecraft.block.Blocks;
import net.minecraft.state.StateManager; import net.minecraft.state.StateManager;
import net.minecraft.state.property.BooleanProperty; import net.minecraft.state.property.BooleanProperty;
import ru.betterend.blocks.basis.BlockBase; import ru.betterend.blocks.basis.BlockBase;
import ru.betterend.registry.EndBlocks; import ru.betterend.registry.EndBlocks;

View file

@ -8,7 +8,6 @@ import java.util.Map;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockEntityProvider; import net.minecraft.block.BlockEntityProvider;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
@ -34,7 +33,6 @@ import net.minecraft.util.shape.VoxelShapes;
import net.minecraft.world.BlockView; import net.minecraft.world.BlockView;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.WorldAccess; import net.minecraft.world.WorldAccess;
import ru.betterend.blocks.BlockProperties; import ru.betterend.blocks.BlockProperties;
import ru.betterend.blocks.BlockProperties.PedestalState; import ru.betterend.blocks.BlockProperties.PedestalState;
import ru.betterend.blocks.entities.PedestalBlockEntity; import ru.betterend.blocks.entities.PedestalBlockEntity;

View file

@ -10,7 +10,6 @@ import net.minecraft.network.packet.s2c.play.BlockEntityUpdateS2CPacket;
import net.minecraft.util.Tickable; import net.minecraft.util.Tickable;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
import ru.betterend.registry.EndBlockEntities; import ru.betterend.registry.EndBlockEntities;
import ru.betterend.util.EternalRitual; import ru.betterend.util.EternalRitual;

View file

@ -9,7 +9,6 @@ import net.minecraft.util.Identifier;
import net.minecraft.world.biome.Biome; import net.minecraft.world.biome.Biome;
import net.minecraft.world.gen.GenerationStep; import net.minecraft.world.gen.GenerationStep;
import net.minecraft.world.gen.feature.ConfiguredFeature; import net.minecraft.world.gen.feature.ConfiguredFeature;
import ru.betterend.world.features.BlueVineFeature; import ru.betterend.world.features.BlueVineFeature;
import ru.betterend.world.features.CavePlantFeature; import ru.betterend.world.features.CavePlantFeature;
import ru.betterend.world.features.DoublePlantFeature; import ru.betterend.world.features.DoublePlantFeature;

View file

@ -22,7 +22,6 @@ import net.minecraft.world.Heightmap;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.dimension.DimensionType; import net.minecraft.world.dimension.DimensionType;
import net.minecraft.world.gen.feature.ConfiguredFeatures; import net.minecraft.world.gen.feature.ConfiguredFeatures;
import ru.betterend.blocks.BlockProperties; import ru.betterend.blocks.BlockProperties;
import ru.betterend.blocks.EndPortalBlock; import ru.betterend.blocks.EndPortalBlock;
import ru.betterend.blocks.RunedFlavolite; import ru.betterend.blocks.RunedFlavolite;
@ -31,20 +30,20 @@ import ru.betterend.registry.EndBlocks;
import ru.betterend.registry.EndTags; import ru.betterend.registry.EndTags;
public class EternalRitual { public class EternalRitual {
private final static Set<Point> structureMap = Sets.newHashSet( private final static Set<Point> STRUCTURE_MAP = Sets.newHashSet(
new Point(-4, -5), new Point(-4, 5), new Point(-6, 0), new Point(-4, -5), new Point(-4, 5), new Point(-6, 0),
new Point(4, -5), new Point(4, 5), new Point(6, 0)); new Point(4, -5), new Point(4, 5), new Point(6, 0));
private final static Set<Point> frameMap = Sets.newHashSet( private final static Set<Point> FRAME_MAP = Sets.newHashSet(
new Point(0, 0), new Point(0, 6), new Point(1, 0), new Point(0, 0), new Point(0, 6), new Point(1, 0),
new Point(1, 6), new Point(2, 1), new Point(2, 5), new Point(1, 6), new Point(2, 1), new Point(2, 5),
new Point(3, 2), new Point(3, 3), new Point(3, 4)); new Point(3, 2), new Point(3, 3), new Point(3, 4));
private final static Set<Point> portalMap = Sets.newHashSet( private final static Set<Point> PORTAL_MAP = Sets.newHashSet(
new Point(0, 0), new Point(0, 1), new Point(0, 2), new Point(0, 0), new Point(0, 1), new Point(0, 2),
new Point(0, 3), new Point(0, 4), new Point(1, 0), new Point(0, 3), new Point(0, 4), new Point(1, 0),
new Point(1, 1), new Point(1, 2), new Point(1, 3), new Point(1, 1), new Point(1, 2), new Point(1, 3),
new Point(1, 4), new Point(2, 1), new Point(2, 2), new Point(1, 4), new Point(2, 1), new Point(2, 2),
new Point(2, 3)); new Point(2, 3));
private final static Set<Point> baseMap = Sets.newHashSet( private final static Set<Point> BASE_MAP = Sets.newHashSet(
new Point(3, 0), new Point(2, 0), new Point(2, 1), new Point(1, 1), new Point(3, 0), new Point(2, 0), new Point(2, 1), new Point(1, 1),
new Point(1, 2), new Point(0, 1), new Point(0, 2)); new Point(1, 2), new Point(0, 1), new Point(0, 2));
@ -93,7 +92,7 @@ public class EternalRitual {
moveY = Direction.EAST; moveY = Direction.EAST;
} }
boolean valid = this.checkFrame(); boolean valid = this.checkFrame();
for (Point pos : structureMap) { for (Point pos : STRUCTURE_MAP) {
BlockPos.Mutable checkPos = center.mutableCopy(); BlockPos.Mutable checkPos = center.mutableCopy();
checkPos.move(moveX, pos.x).move(moveY, pos.y); checkPos.move(moveX, pos.x).move(moveY, pos.y);
valid &= this.isActive(checkPos); valid &= this.isActive(checkPos);
@ -107,7 +106,7 @@ public class EternalRitual {
BlockPos framePos = center.down(); BlockPos framePos = center.down();
Direction moveDir = Direction.Axis.X == axis ? Direction.NORTH: Direction.EAST; Direction moveDir = Direction.Axis.X == axis ? Direction.NORTH: Direction.EAST;
boolean valid = true; boolean valid = true;
for (Point point : frameMap) { for (Point point : FRAME_MAP) {
BlockPos pos = framePos.offset(moveDir, point.x).offset(Direction.UP, point.y); BlockPos pos = framePos.offset(moveDir, point.x).offset(Direction.UP, point.y);
BlockState state = world.getBlockState(pos); BlockState state = world.getBlockState(pos);
valid &= state.getBlock() instanceof RunedFlavolite; valid &= state.getBlock() instanceof RunedFlavolite;
@ -138,7 +137,7 @@ public class EternalRitual {
BlockPos framePos = center.down(); BlockPos framePos = center.down();
Direction moveDir = Direction.Axis.X == axis ? Direction.NORTH: Direction.EAST; Direction moveDir = Direction.Axis.X == axis ? Direction.NORTH: Direction.EAST;
BlockState frame = FRAME.getDefaultState().with(ACTIVE, true); BlockState frame = FRAME.getDefaultState().with(ACTIVE, true);
frameMap.forEach(point -> { FRAME_MAP.forEach(point -> {
BlockPos pos = framePos.offset(moveDir, point.x).offset(Direction.UP, point.y); BlockPos pos = framePos.offset(moveDir, point.x).offset(Direction.UP, point.y);
BlockState state = world.getBlockState(pos); BlockState state = world.getBlockState(pos);
if (state.contains(ACTIVE) && !state.get(ACTIVE)) { if (state.contains(ACTIVE) && !state.get(ACTIVE)) {
@ -152,7 +151,7 @@ public class EternalRitual {
}); });
Direction.Axis portalAxis = Direction.Axis.X == axis ? Direction.Axis.Z : Direction.Axis.X; Direction.Axis portalAxis = Direction.Axis.X == axis ? Direction.Axis.Z : Direction.Axis.X;
BlockState portal = PORTAL.getDefaultState().with(EndPortalBlock.AXIS, portalAxis); BlockState portal = PORTAL.getDefaultState().with(EndPortalBlock.AXIS, portalAxis);
portalMap.forEach(point -> { PORTAL_MAP.forEach(point -> {
BlockPos pos = center.offset(moveDir, point.x).offset(Direction.UP, point.y); BlockPos pos = center.offset(moveDir, point.x).offset(Direction.UP, point.y);
if (!world.getBlockState(pos).isOf(PORTAL)) { if (!world.getBlockState(pos).isOf(PORTAL)) {
world.setBlockState(pos, portal); world.setBlockState(pos, portal);
@ -174,7 +173,7 @@ public class EternalRitual {
private void removePortal(World world, BlockPos center) { private void removePortal(World world, BlockPos center) {
BlockPos framePos = center.down(); BlockPos framePos = center.down();
Direction moveDir = Direction.Axis.X == axis ? Direction.NORTH: Direction.EAST; Direction moveDir = Direction.Axis.X == axis ? Direction.NORTH: Direction.EAST;
frameMap.forEach(point -> { FRAME_MAP.forEach(point -> {
BlockPos pos = framePos.offset(moveDir, point.x).offset(Direction.UP, point.y); BlockPos pos = framePos.offset(moveDir, point.x).offset(Direction.UP, point.y);
BlockState state = world.getBlockState(pos); BlockState state = world.getBlockState(pos);
if (state.isOf(FRAME) && state.get(ACTIVE)) { if (state.isOf(FRAME) && state.get(ACTIVE)) {
@ -186,7 +185,7 @@ public class EternalRitual {
world.setBlockState(pos, state.with(ACTIVE, false)); world.setBlockState(pos, state.with(ACTIVE, false));
} }
}); });
portalMap.forEach(point -> { PORTAL_MAP.forEach(point -> {
BlockPos pos = center.offset(moveDir, point.x).offset(Direction.UP, point.y); BlockPos pos = center.offset(moveDir, point.x).offset(Direction.UP, point.y);
if (world.getBlockState(pos).isOf(PORTAL)) { if (world.getBlockState(pos).isOf(PORTAL)) {
world.removeBlock(pos, false); world.removeBlock(pos, false);
@ -292,14 +291,14 @@ public class EternalRitual {
BlockPos framePos = center.down(); BlockPos framePos = center.down();
Direction moveDir = Direction.Axis.X == axis ? Direction.EAST: Direction.NORTH; Direction moveDir = Direction.Axis.X == axis ? Direction.EAST: Direction.NORTH;
BlockState frame = FRAME.getDefaultState().with(ACTIVE, true); BlockState frame = FRAME.getDefaultState().with(ACTIVE, true);
frameMap.forEach(point -> { FRAME_MAP.forEach(point -> {
BlockPos pos = framePos.offset(moveDir, point.x).offset(Direction.UP, point.y); BlockPos pos = framePos.offset(moveDir, point.x).offset(Direction.UP, point.y);
world.setBlockState(pos, frame); world.setBlockState(pos, frame);
pos = framePos.offset(moveDir, -point.x).offset(Direction.UP, point.y); pos = framePos.offset(moveDir, -point.x).offset(Direction.UP, point.y);
world.setBlockState(pos, frame); world.setBlockState(pos, frame);
}); });
BlockState portal = PORTAL.getDefaultState().with(EndPortalBlock.AXIS, axis); BlockState portal = PORTAL.getDefaultState().with(EndPortalBlock.AXIS, axis);
portalMap.forEach(point -> { PORTAL_MAP.forEach(point -> {
BlockPos pos = center.offset(moveDir, point.x).offset(Direction.UP, point.y); BlockPos pos = center.offset(moveDir, point.x).offset(Direction.UP, point.y);
world.setBlockState(pos, portal); world.setBlockState(pos, portal);
pos = center.offset(moveDir, -point.x).offset(Direction.UP, point.y); pos = center.offset(moveDir, -point.x).offset(Direction.UP, point.y);
@ -311,7 +310,7 @@ public class EternalRitual {
private static void generateBase(World world, BlockPos center, Direction moveX) { private static void generateBase(World world, BlockPos center, Direction moveX) {
BlockState base = BASE.getDefaultState(); BlockState base = BASE.getDefaultState();
Direction moveY = moveX.rotateYClockwise(); Direction moveY = moveX.rotateYClockwise();
baseMap.forEach(point -> { BASE_MAP.forEach(point -> {
BlockPos pos = center.offset(moveX, point.x).offset(moveY, point.y); BlockPos pos = center.offset(moveX, point.x).offset(moveY, point.y);
world.setBlockState(pos, base); world.setBlockState(pos, base);
pos = center.offset(moveX, -point.x).offset(moveY, point.y); pos = center.offset(moveX, -point.x).offset(moveY, point.y);
@ -327,7 +326,7 @@ public class EternalRitual {
Direction moveDir = Direction.Axis.X == axis ? Direction.NORTH: Direction.EAST; Direction moveDir = Direction.Axis.X == axis ? Direction.NORTH: Direction.EAST;
for (BlockPos checkPos : BlockPos.iterate(center.offset(moveDir.rotateYClockwise()), for (BlockPos checkPos : BlockPos.iterate(center.offset(moveDir.rotateYClockwise()),
center.offset(moveDir.rotateYCounterclockwise()))) { center.offset(moveDir.rotateYCounterclockwise()))) {
for (Point point : portalMap) { for (Point point : PORTAL_MAP) {
BlockPos pos = checkPos.offset(moveDir, point.x).offset(Direction.UP, point.y); BlockPos pos = checkPos.offset(moveDir, point.x).offset(Direction.UP, point.y);
if (!world.getBlockState(pos).isAir()) return false; if (!world.getBlockState(pos).isAir()) return false;
pos = checkPos.offset(moveDir, -point.x).offset(Direction.UP, point.y); pos = checkPos.offset(moveDir, -point.x).offset(Direction.UP, point.y);

View file

@ -1,8 +1,8 @@
package ru.betterend.world.processors; package ru.betterend.world.processors;
import net.minecraft.structure.Structure.StructureBlockInfo;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks; import net.minecraft.block.Blocks;
import net.minecraft.structure.Structure.StructureBlockInfo;
import net.minecraft.structure.StructurePlacementData; import net.minecraft.structure.StructurePlacementData;
import net.minecraft.structure.processor.StructureProcessor; import net.minecraft.structure.processor.StructureProcessor;
import net.minecraft.structure.processor.StructureProcessorType; import net.minecraft.structure.processor.StructureProcessorType;