Split up and reorganise WizardryUtilities

This commit is contained in:
Electroblob77
2020-06-13 23:29:01 +01:00
parent 57e96458d5
commit 238b9d04bb
189 changed files with 1724 additions and 1731 deletions
@@ -1,6 +1,6 @@
package electroblob.wizardry.worldgen;
import electroblob.wizardry.util.WizardryUtilities;
import electroblob.wizardry.util.BlockUtils;
import net.minecraft.block.Block;
import net.minecraft.block.BlockPlanks;
import net.minecraft.block.BlockWoodSlab;
@@ -75,13 +75,13 @@ public class WoodTypeTemplateProcessor implements ITemplateProcessor {
return new Template.BlockInfo(info.pos, info.blockState.withProperty(BlockWoodSlab.VARIANT, woodType), info.tileentityData);
// This is a mess, no wonder the flattening happened
}else if(DOORS.containsValue(info.blockState.getBlock())){
return new Template.BlockInfo(info.pos, WizardryUtilities.copyState(DOORS.get(woodType), info.blockState), info.tileentityData);
return new Template.BlockInfo(info.pos, BlockUtils.copyState(DOORS.get(woodType), info.blockState), info.tileentityData);
}else if(STAIRS.containsValue(info.blockState.getBlock())){
return new Template.BlockInfo(info.pos, WizardryUtilities.copyState(STAIRS.get(woodType), info.blockState), info.tileentityData);
return new Template.BlockInfo(info.pos, BlockUtils.copyState(STAIRS.get(woodType), info.blockState), info.tileentityData);
}else if(FENCES.containsValue(info.blockState.getBlock())){
return new Template.BlockInfo(info.pos, WizardryUtilities.copyState(FENCES.get(woodType), info.blockState), info.tileentityData);
return new Template.BlockInfo(info.pos, BlockUtils.copyState(FENCES.get(woodType), info.blockState), info.tileentityData);
}else if(FENCE_GATES.containsValue(info.blockState.getBlock())){
return new Template.BlockInfo(info.pos, WizardryUtilities.copyState(FENCE_GATES.get(woodType), info.blockState), info.tileentityData);
return new Template.BlockInfo(info.pos, BlockUtils.copyState(FENCE_GATES.get(woodType), info.blockState), info.tileentityData);
}
return info;
@@ -3,8 +3,8 @@ package electroblob.wizardry.worldgen;
import com.google.common.math.Quantiles;
import electroblob.wizardry.Wizardry;
import electroblob.wizardry.registry.WizardryAdvancementTriggers;
import electroblob.wizardry.util.BlockUtils;
import electroblob.wizardry.util.NBTExtras;
import electroblob.wizardry.util.WizardryUtilities;
import it.unimi.dsi.fastutil.longs.Long2ObjectMap;
import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap;
import net.minecraft.block.Block;
@@ -147,8 +147,8 @@ public abstract class WorldGenSurfaceStructure implements IWorldGenerator {
// Check if we're at the top of the world, and if so just randomise the y pos (accounts for 'cavern' dimensions)
if(centre.getY() >= world.getActualHeight()) centre = new BlockPos(centre.getX(), random.nextInt(world.getActualHeight()), centre.getZ());
Integer startingHeight = WizardryUtilities.getNearestSurface(world, centre, EnumFacing.UP, 32, true,
WizardryUtilities.SurfaceCriteria.COLLIDABLE_IGNORING_TREES);
Integer startingHeight = BlockUtils.getNearestSurface(world, centre, EnumFacing.UP, 32, true,
BlockUtils.SurfaceCriteria.COLLIDABLE_IGNORING_TREES);
if(startingHeight == null) return null;
@@ -167,8 +167,8 @@ public abstract class WorldGenSurfaceStructure implements IWorldGenerator {
// exactly what is needed here since it is used for placing villages and stuff, and doesn't include leaves
// or other foliage.
BlockPos pos = origin.add(i / size.getZ(), 0, i % size.getZ());
Integer floor = WizardryUtilities.getNearestSurface(world, pos.up(startingHeight), EnumFacing.UP, 32, true,
WizardryUtilities.SurfaceCriteria.COLLIDABLE_IGNORING_TREES);
Integer floor = BlockUtils.getNearestSurface(world, pos.up(startingHeight), EnumFacing.UP, 32, true,
BlockUtils.SurfaceCriteria.COLLIDABLE_IGNORING_TREES);
floorHeights[i] = floor == null ? 0 : floor; // Very unlikely that floor is null
// ^ That method gets the top solid block. Most non-solid blocks are ok to have around the structure,
// with the exception of liquids, so if there are too many the position is deemed unsuitable.
@@ -336,7 +336,7 @@ public abstract class WorldGenSurfaceStructure implements IWorldGenerator {
Block below = world.getBlockState(pos.down()).getBlock();
if(block instanceof BlockLog){
if(below != Blocks.GRASS && below != Blocks.DIRT && !WizardryUtilities.isTreeBlock(world, pos.down())){
if(below != Blocks.GRASS && below != Blocks.DIRT && !BlockUtils.isTreeBlock(world, pos.down())){
world.setBlockToAir(pos);
changed = true;
}
@@ -5,7 +5,7 @@ import electroblob.wizardry.Wizardry;
import electroblob.wizardry.entity.living.EntityEvilWizard;
import electroblob.wizardry.entity.living.EntityWizard;
import electroblob.wizardry.integration.antiqueatlas.WizardryAntiqueAtlasIntegration;
import electroblob.wizardry.util.WizardryUtilities;
import electroblob.wizardry.util.GeometryUtils;
import net.minecraft.block.BlockPlanks;
import net.minecraft.block.BlockStainedHardenedClay;
import net.minecraft.block.state.IBlockState;
@@ -110,7 +110,7 @@ public class WorldGenWizardTower extends WorldGenSurfaceStructure {
for(Map.Entry<BlockPos, String> entry : dataBlocks.entrySet()){
Vec3d vec = WizardryUtilities.getCentre(entry.getKey());
Vec3d vec = GeometryUtils.getCentre(entry.getKey());
if(entry.getValue().equals(WIZARD_DATA_BLOCK_TAG)){