From a3d1d506bab9d5244b9b425ad67c51c85bc0dd44 Mon Sep 17 00:00:00 2001 From: gottsch <17928819+gottsch@users.noreply.github.com> Date: Wed, 22 Apr 2020 08:41:47 -0400 Subject: [PATCH] fix server crash on wither tree gen --- Treasure2-1.12.2/gradle.properties | 2 +- .../someguyssoftware/treasure2/Treasure.java | 2 +- .../generator/oasis/DesertOasisGenerator.java | 5 ++++- .../worldgen/WitherTreeWorldGenerator.java | 17 +++++++++++------ Treasure2-1.12.2/src/resources/mcmod.info | 2 +- Treasure2-1.12.2/update.json | 7 ++++--- 6 files changed, 22 insertions(+), 13 deletions(-) diff --git a/Treasure2-1.12.2/gradle.properties b/Treasure2-1.12.2/gradle.properties index b6f553e89..86536bd8c 100644 --- a/Treasure2-1.12.2/gradle.properties +++ b/Treasure2-1.12.2/gradle.properties @@ -7,7 +7,7 @@ package_group=someguyssoftware.treasure2 # user alpha, beta, or v (for version) mod_version_type=v -mod_version=1.11.0 +mod_version=1.11.1 #versions mc_version=1.12.2 diff --git a/Treasure2-1.12.2/src/com/someguyssoftware/treasure2/Treasure.java b/Treasure2-1.12.2/src/com/someguyssoftware/treasure2/Treasure.java index 7591bcd50..18208506e 100644 --- a/Treasure2-1.12.2/src/com/someguyssoftware/treasure2/Treasure.java +++ b/Treasure2-1.12.2/src/com/someguyssoftware/treasure2/Treasure.java @@ -89,7 +89,7 @@ public class Treasure extends AbstractMod { // constants public static final String MODID = "treasure2"; protected static final String NAME = "Treasure2"; - protected static final String VERSION = "1.11.0"; + protected static final String VERSION = "1.11.1"; public static final String UPDATE_JSON_URL = "https://raw.githubusercontent.com/gottsch/gottsch-minecraft-Treasure/master/Treasure2-1.12.2/update.json"; diff --git a/Treasure2-1.12.2/src/com/someguyssoftware/treasure2/generator/oasis/DesertOasisGenerator.java b/Treasure2-1.12.2/src/com/someguyssoftware/treasure2/generator/oasis/DesertOasisGenerator.java index daef3ce47..0a418beda 100644 --- a/Treasure2-1.12.2/src/com/someguyssoftware/treasure2/generator/oasis/DesertOasisGenerator.java +++ b/Treasure2-1.12.2/src/com/someguyssoftware/treasure2/generator/oasis/DesertOasisGenerator.java @@ -79,7 +79,10 @@ public GeneratorResult generate(World world, Random random, ICoor // determine size of oasis int radius = RandomHelper.randomInt(random, MIN_OASIS_RADIUS, MAX_OASIS_RADIUS); // min of 8, so diameter = 16, area = 16x16, same as chunk AxisAlignedBB oasisBounds = new AxisAlignedBB(coords.add(-radius, 0, -radius).toPos() , coords.add(radius, 0, radius).toPos()); - ICoords centerCoords = new Coords(oasisBounds.getCenter()); + int width = Math.abs((int) (oasisBounds.maxX - oasisBounds.minX)); + int depth = Math.abs((int) (oasisBounds.maxZ - oasisBounds.minZ)); + ICoords centerCoords = new Coords((int)(oasisBounds.minX + width * 0.5D), (int)oasisBounds.minY, (int)(oasisBounds.minZ + depth * 0.5D)); + centerCoords = WorldInfo.getDryLandSurfaceCoords(world, centerCoords); generateBase(world, random, coords, radius); diff --git a/Treasure2-1.12.2/src/com/someguyssoftware/treasure2/worldgen/WitherTreeWorldGenerator.java b/Treasure2-1.12.2/src/com/someguyssoftware/treasure2/worldgen/WitherTreeWorldGenerator.java index 3a05734cb..d8b46aa6e 100644 --- a/Treasure2-1.12.2/src/com/someguyssoftware/treasure2/worldgen/WitherTreeWorldGenerator.java +++ b/Treasure2-1.12.2/src/com/someguyssoftware/treasure2/worldgen/WitherTreeWorldGenerator.java @@ -44,11 +44,14 @@ import net.minecraft.util.EnumFacing; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; import net.minecraft.world.biome.Biome; import net.minecraft.world.chunk.IChunkProvider; import net.minecraft.world.gen.IChunkGenerator; import net.minecraftforge.common.BiomeDictionary; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; /** * @@ -370,16 +373,17 @@ public GeneratorResult generate(World world, Random random, ICoor } private void buildScrub(World world, Random random, AxisAlignedBB witherGroveSize) { - ICoords centerCoords = new Coords(witherGroveSize.getCenter()); +// Treasure.logger.debug("adding scrub ..."); int width = Math.abs((int) (witherGroveSize.maxX - witherGroveSize.minX)); int depth = Math.abs((int) (witherGroveSize.maxZ - witherGroveSize.minZ)); + ICoords centerCoords = new Coords((int)(witherGroveSize.minX + width * 0.5D), (int)witherGroveSize.minY, (int)(witherGroveSize.minZ + depth * 0.5D)); - for (int rockIndex = 0; rockIndex < RandomHelper.randomInt(MIN_SCRUB, MAX_SCRUB); rockIndex++) { + for (int scrubIndex = 0; scrubIndex < RandomHelper.randomInt(MIN_SCRUB, MAX_SCRUB); scrubIndex++) { int xOffset = (int) (random.nextFloat() * width - (width/2)); int zOffset = (int) (random.nextFloat() * depth - (depth/2)); ICoords surfaceCoords = WorldInfo.getDryLandSurfaceCoords(world, centerCoords.add(xOffset, 0, zOffset).withY(255)); - +// Treasure.logger.debug("adding scrub at -> {}", surfaceCoords.toShortString()); // check if current block is a dirt, podzol, coarse dirt or sand Block supportBlock = world.getBlockState(surfaceCoords.down(1).toPos()).getBlock(); if (supportBlock == Blocks.DIRT || supportBlock == Blocks.SAND) { @@ -395,10 +399,11 @@ private void buildScrub(World world, Random random, AxisAlignedBB witherGroveSiz } private void buildRocks(World world, Random random, AxisAlignedBB witherGroveSize) { - ICoords centerCoords = new Coords(witherGroveSize.getCenter()); +// Treasure.logger.debug("adding rocks ..."); int width = Math.abs((int) (witherGroveSize.maxX - witherGroveSize.minX)); int depth = Math.abs((int) (witherGroveSize.maxZ - witherGroveSize.minZ)); - + ICoords centerCoords = new Coords((int)(witherGroveSize.minX + width * 0.5D), (int)witherGroveSize.minY, (int)(witherGroveSize.minZ + depth * 0.5D)); + for (int rockIndex = 0; rockIndex < RandomHelper.randomInt(MIN_ROCKS, MAX_ROCKS); rockIndex++) { // randomize a position within the aabb int xOffset = (int) (random.nextFloat() * width - (width/2)); @@ -406,7 +411,7 @@ private void buildRocks(World world, Random random, AxisAlignedBB witherGroveSiz ICoords rocksCoords = WorldInfo.getDryLandSurfaceCoords(world, centerCoords.add(xOffset, 0, zOffset).withY(255)); rocksCoords = rocksCoords.down(1); - +//Treasure.logger.debug("adding rocks at -> {}", rocksCoords.toShortString()); // check if current block is a tree or any treasure block if (world.getBlockState(rocksCoords.toPos()).getBlock() instanceof ITreasureBlock) { continue; diff --git a/Treasure2-1.12.2/src/resources/mcmod.info b/Treasure2-1.12.2/src/resources/mcmod.info index e66ce3eca..2e8ee09f3 100644 --- a/Treasure2-1.12.2/src/resources/mcmod.info +++ b/Treasure2-1.12.2/src/resources/mcmod.info @@ -3,7 +3,7 @@ "modid": "treasure2", "name": "Treasure2!", "description": "", - "version": "1.11.0", + "version": "1.11.1", "mcversion": "1.12.2", "url": "", "updateUrl": "", diff --git a/Treasure2-1.12.2/update.json b/Treasure2-1.12.2/update.json index 65be7bd8e..0e4fdaea5 100644 --- a/Treasure2-1.12.2/update.json +++ b/Treasure2-1.12.2/update.json @@ -1,8 +1,8 @@ { "homepage": "https://minecraft.curseforge.com/projects/treasure2", "promos": { - "1.12.2-latest": "1.11.0", - "1.12.2-recommended": "1.11.0" + "1.12.2-latest": "1.11.1", + "1.12.2-recommended": "1.11.1" }, "1.12.2": { "0.5.0": "alpha release", @@ -36,7 +36,8 @@ "1.8.0": "Added Decay System.\nAdded 8 surface structures.\nAdded SpawnRuins command.\nFixed/enable other spawn commands.\nAdded Spanish translation.\nAdded Russian translation.\nFixed the number of uses a Key has.\nRemoved Lombok library.\nFixed solid base check for Surface/Submerged ruins.\nFixed Wither Tree crash bug.\nUsing GottschCore v1.10.0.\n", "1.9.0": "Added Spider Chest.\nAdded recipes for all grave/tombstones.\nFixed config white/black lists on change.\nAll logging config options require mc restart.\nAdded config whitelist for dimensions.\nAdded ability to pass template holder into IRuinGenerators.\nUpdated all SpawnCommands to work from Command blocks.\nAdding fill blocks for under structures so there isnt any overhang when on cliffs etc.\nUsing GottschCore v1.11.0.\nAdded 2 surface structures.\nFixed *huge* bug with decay processor not picking the correct rule.\n", "1.10.0": "Replaced fog blocks with mist particles around gravestone and wither trees.\nAdded Bound Soul mob.\nAdded Collapsing Trap Pit.\nAdded 2 submerged structures.\nAdded beached shipwrecks.\nAdded skeleton, zombie and creeper heads to epic loot table.\nAdded config option to turn off gem ores gen.\nAdded config option to toggle default decay ruleset file enforcement.\nAdded config option to turn off starting book.\nUpdated spanish lang file.\nUsing GottschCore 1.12.1", - "1.11.0": "Added Viking Chest.\nAdded some environmentals to Wither Tree grove.\nAdded Oasis framework and added Desert Oasis.\nAdded 2 surface structures.\nFixed Collpasing Trap Pit in deserts.\nRegistered Ruby and Sapphire with OreDict as gemRuby, gemSappphire.\nFixed loot table error.\nFixed Wither Chest bug.\nResized pearls textures to look more like pearls and less like snowballs." + "1.11.0": "Added Viking Chest.\nAdded some environmentals to Wither Tree grove.\nAdded Oasis framework and added Desert Oasis.\nAdded 2 surface structures.\nFixed Collpasing Trap Pit in deserts.\nRegistered Ruby and Sapphire with OreDict as gemRuby, gemSappphire.\nFixed loot table error.\nFixed Wither Chest bug.\nResized pearls textures to look more like pearls and less like snowballs.", + "1.11.1": "Fixed server error on Wither tree gen." } }