From f138f6e4a220a76e78d00407daa9980a9286fc62 Mon Sep 17 00:00:00 2001 From: Jared Hewitt Date: Tue, 6 Dec 2016 22:28:46 -0500 Subject: [PATCH] Updated build for Forge 1.11-13.19.1.2188 successfully compiles and runs. --- build.gradle | 2 +- src/main/java/CustomOreGen/FMLInterface.java | 2 +- .../java/CustomOreGen/Server/MapGenCloud.java | 7 +++++++ .../CustomOreGen/Server/MapGenClusters.java | 6 ++++++ .../Server/MapGenOreDistribution.java | 17 +++++++++++---- .../java/CustomOreGen/Server/MapGenVeins.java | 6 ++++++ .../CustomOreGen/Util/BiomeDescriptor.java | 21 +++++++++++++++---- src/main/resources/config/modules/Vanilla.xml | 4 ++-- 8 files changed, 53 insertions(+), 12 deletions(-) diff --git a/build.gradle b/build.gradle index d29399ab..c69ff057 100644 --- a/build.gradle +++ b/build.gradle @@ -30,7 +30,7 @@ compileJava { } minecraft { - version = "1.10.2-12.18.2.2099" + version = "1.11-13.19.1.2188" runDir = "run" mappings = "snapshot_nodoc_20161009" replace '@VERSION@', version diff --git a/src/main/java/CustomOreGen/FMLInterface.java b/src/main/java/CustomOreGen/FMLInterface.java index 296f0dd7..ea134259 100644 --- a/src/main/java/CustomOreGen/FMLInterface.java +++ b/src/main/java/CustomOreGen/FMLInterface.java @@ -32,7 +32,7 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -@Mod(modid="customoregen", useMetadata=true, version="@VERSION@", acceptedMinecraftVersions="[1.10]") +@Mod(modid="customoregen", name="Custom Ore Generation", useMetadata=true, version="1.11-1.4.2", acceptedMinecraftVersions="[1.11]") public class FMLInterface implements IWorldGenerator { @Instance("customoregen") diff --git a/src/main/java/CustomOreGen/Server/MapGenCloud.java b/src/main/java/CustomOreGen/Server/MapGenCloud.java index 6378195f..943ce42c 100644 --- a/src/main/java/CustomOreGen/Server/MapGenCloud.java +++ b/src/main/java/CustomOreGen/Server/MapGenCloud.java @@ -11,6 +11,7 @@ import CustomOreGen.Util.PDist.Type; import CustomOreGen.Util.Transform; import CustomOreGen.Util.WireframeShapes; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.world.World; import net.minecraft.world.gen.structure.StructureBoundingBox; @@ -330,4 +331,10 @@ public double getAverageOreCount() { double aboveNoiseCutoff = (1 - simplex.cdf(this.orVolumeNoiseCutoff.mean)); return v * this.orDensity.pdist.mean * aboveNoiseCutoff; } + + //@Override + public BlockPos getClosestStrongholdPos(World worldIn, BlockPos pos, boolean p_180706_3_) { + return null; + } + } diff --git a/src/main/java/CustomOreGen/Server/MapGenClusters.java b/src/main/java/CustomOreGen/Server/MapGenClusters.java index 2cc9c892..db88a90e 100644 --- a/src/main/java/CustomOreGen/Server/MapGenClusters.java +++ b/src/main/java/CustomOreGen/Server/MapGenClusters.java @@ -11,6 +11,7 @@ import CustomOreGen.Util.Transform; import CustomOreGen.Util.VolumeHelper; import CustomOreGen.Util.WireframeShapes; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.world.World; import net.minecraft.world.gen.structure.StructureBoundingBox; @@ -230,4 +231,9 @@ public double getAverageOreCount() { return volume; } + //@Override + public BlockPos getClosestStrongholdPos(World worldIn, BlockPos pos, boolean p_180706_3_) { + return null; + } + } diff --git a/src/main/java/CustomOreGen/Server/MapGenOreDistribution.java b/src/main/java/CustomOreGen/Server/MapGenOreDistribution.java index 39f5a304..bf179660 100644 --- a/src/main/java/CustomOreGen/Server/MapGenOreDistribution.java +++ b/src/main/java/CustomOreGen/Server/MapGenOreDistribution.java @@ -31,6 +31,7 @@ import net.minecraft.world.gen.structure.StructureBoundingBox; import net.minecraft.world.gen.structure.StructureComponent; import net.minecraft.world.gen.structure.StructureStart; +import net.minecraft.world.gen.structure.template.TemplateManager; public abstract class MapGenOreDistribution extends MapGenStructure implements IOreDistribution { @@ -569,7 +570,11 @@ public BlockPos getNearestStructure(World world, BlockPos pos) for (StructureComponent vc : (List)vs.getComponents()) { if (vc.getComponentType() == 0) { - BlockPos center = vc.getBoundingBoxCenter(); + StructureBoundingBox bb = vc.getBoundingBox(); + int xIn = bb.minX + (bb.maxX - bb.minX + 1) / 2; + int yIn = bb.minY + (bb.maxY - bb.minY + 1) / 2; + int zIn = bb.minZ + (bb.maxZ - bb.minZ + 1) / 2; + BlockPos center = new BlockPos(xIn, yIn, zIn); int dist2 = (center.getX() - pos.getX()) * (center.getX() - pos.getX()) + (center.getZ() - pos.getZ()) * (center.getZ() - pos.getZ()); @@ -728,8 +733,12 @@ public void buildWireframes() for (StructureComponent comp : this.getComponents()) { StructureBoundingBox bb = comp.getBoundingBox(); - int cX = bb.getCenter().getX() / 16; - int cZ = bb.getCenter().getZ() / 16; + int xIn = bb.minX + (bb.maxX - bb.minX + 1) / 2; + int yIn = bb.minY + (bb.maxY - bb.minY + 1) / 2; + int zIn = bb.minZ + (bb.maxZ - bb.minZ + 1) / 2; + BlockPos center = new BlockPos(xIn, yIn, zIn); + int cX = center.getX() / 16; + int cZ = center.getZ() / 16; long key = (long)cX << 32 | (long)cZ & 4294967295L; builder = debuggingGeometryMap.get(key); @@ -881,7 +890,7 @@ protected void writeStructureToNBT(NBTTagCompound tagCompound) { } @Override - protected void readStructureFromNBT(NBTTagCompound tagCompound) { + protected void readStructureFromNBT(NBTTagCompound tagCompound, TemplateManager p_143011_2_) { // TODO Auto-generated method stub } diff --git a/src/main/java/CustomOreGen/Server/MapGenVeins.java b/src/main/java/CustomOreGen/Server/MapGenVeins.java index ec23d639..d66e3e16 100644 --- a/src/main/java/CustomOreGen/Server/MapGenVeins.java +++ b/src/main/java/CustomOreGen/Server/MapGenVeins.java @@ -11,6 +11,7 @@ import CustomOreGen.Util.Transform; import CustomOreGen.Util.VolumeHelper; import CustomOreGen.Util.WireframeShapes; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.world.World; import net.minecraft.world.gen.structure.StructureBoundingBox; @@ -784,4 +785,9 @@ public double getAverageOreCount() { return this.orDensity.mean * totalVolume; } + //@Override + public BlockPos getClosestStrongholdPos(World worldIn, BlockPos pos, boolean p_180706_3_) { + return null; + } + } diff --git a/src/main/java/CustomOreGen/Util/BiomeDescriptor.java b/src/main/java/CustomOreGen/Util/BiomeDescriptor.java index e3f42df4..cefb9c28 100644 --- a/src/main/java/CustomOreGen/Util/BiomeDescriptor.java +++ b/src/main/java/CustomOreGen/Util/BiomeDescriptor.java @@ -2,17 +2,20 @@ import java.util.Collections; import java.util.Hashtable; +import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.Random; +import java.util.Set; import java.util.regex.Matcher; import java.util.regex.Pattern; import CustomOreGen.Server.DistributionSettingMap.Copyable; import net.minecraft.world.biome.Biome; import net.minecraftforge.common.BiomeDictionary; +import net.minecraftforge.common.BiomeDictionary.Type; public class BiomeDescriptor implements Copyable { @@ -131,10 +134,19 @@ protected float matchingWeight(Biome biome) continue; if (desc.describesType) { - BiomeDictionary.Type type = BiomeDictionary.Type.valueOf(desc.description.toUpperCase()); - // instead of this, because we do not want to add a new type if it does not exist: - //BiomeDictionary.Type type = BiomeDictionary.Type.getType(desc.description); - if (BiomeDictionary.isBiomeOfType(biome, type)) + //BiomeDictionary.Type type = BiomeDictionary.Type.valueOf(desc.description.toUpperCase()); + // The above no longer works, because Type is no longer an enum, and so we are stuck + // with the following: + BiomeDictionary.Type type = null; + Set types = BiomeDictionary.getTypes(biome); + Iterator it = types.iterator(); + while (it.hasNext()) { + BiomeDictionary.Type nextType = it.next(); + if (nextType.getName() == desc.description.toUpperCase()) { + type = nextType; + } + } + if (BiomeDictionary.hasType(biome, type)) { totalWeight += desc.weight; } @@ -364,6 +376,7 @@ public boolean isCompatible(Biome biome) { biome.getHeightVariation() >= minHeightVariation && biome.getHeightVariation() <= maxHeightVariation; } + } } diff --git a/src/main/resources/config/modules/Vanilla.xml b/src/main/resources/config/modules/Vanilla.xml index c34dff36..3e9b8106 100644 --- a/src/main/resources/config/modules/Vanilla.xml +++ b/src/main/resources/config/modules/Vanilla.xml @@ -37,11 +37,11 @@ - + Should Custom Ore Generation use the Substitution Pass to remove all instances of Vanilla ore from the world? If the mod's oregen can be turned off in its configuration, then it's recommended to do so, as the substitution pass can slow the game significantly. If this option is disabled without disabling the mod's own ore generation, you'll end up with two oregens working at once, flooding the world with ore. Enabled by default to ensure the ores are completely removed.