Commit graph

211 commits

Author SHA1 Message Date
StevenRS11
8bbd1384c5 finished changes to monolith spawning 2013-06-24 00:34:21 -04:00
StevenRS11
e847794e8d fixed save killing change, awaiting further fix 2013-06-24 00:11:14 -04:00
StevenRS11
d5caa918c8 monolith spawning via end portal frame blocks 2013-06-23 23:49:54 -04:00
StevenRS11
ea74f712fd Re-worked monolith spawning code
Looks from the top of the world down now, should be more consistent.
2013-06-23 22:34:53 -04:00
SenseiKiwi
7a90dcb28b Improved PocketGenerator
Improved code in PocketGenerator. Restricted Monolith generation to the
chunk in which populate() is being applied. We should not be generating
Monoliths outside that chunk. Changed condition that would exit the
function if the next available space for a Monolith was above Y = 245.
Exiting the function at that point made no sense.

I've realized that this placement algorithm has probably been patched up
several times and that's resulted in nonsensical code. For instance, the
loop continues as long as you continue finding higher points to place
Monoliths. That would suggest you intended to make columns of them. But
since the loop chooses random columns on each iteration goes back to Y =
0, you're really just jumping around and placing Monoliths in random
places, while using irrelevant checks to decide whether to continue. I
really recommend coming up with a different algorithm. I haven't
replaced it completely in case it would break something.
2013-06-23 16:17:04 -04:00
SenseiKiwi
1ca11f4df3 Removed Recursion from PocketGenerator
Rewrote PocketGenerator.populate() to remove the recursive call to
itself.
2013-06-23 03:03:40 -04:00
SenseiKiwi
ffcb3aa74a Minor Change
Completed renaming pocketGenerator as PocketGenerator.
2013-06-23 02:54:28 -04:00
SenseiKiwi
c6e6ff6db2 Minor Change
Just need to make an intermediate commit for renaming PocketGenerator.
Technical issues...
2013-06-23 02:53:10 -04:00
SenseiKiwi
0a6f6c9615 Cleaned up PocketGenerator
Cleaned up some of the code in PocketGenerator. Seeded the generation of
Monoliths as a function of the world seed. All of our randomized
selections should be functions of the world seed so people can exchange
seeds with cool DD features. I will rename the file to have proper
capitalization in the next commit. Then I have to fix Monolith spawning.

Also, don't use recursion as a way to loop functions if you could simply
have a loop. I'm referring to the way PocketGenerator.populate() calls
itself. Completely unnecessary.
2013-06-23 02:49:25 -04:00
SenseiKiwi
82b8c93c8b Minor Change to DungeonHelper
Minor change to DungeonHelper. Added the dash character to the
characters allowed in schematic names.
2013-06-22 19:14:17 -04:00
SenseiKiwi
bbb39da808 Fixed Bugs in DungeonHelper
1. Added converting dungeon type names to lowercase before adding them
to dungeonTypeMapping (a HashMap that associates dungeon type strings
with their lists). Keeping the original casing was causing a
NullPointerException when the HashMap returned null and we expected to
receive a non-null list.
2. Added code to strip out the file extension of a schematic in
validateSchematicName(). The extension was getting dragged along with
the dungeon's weight, which would cause parsing to fail and the name was
considered invalid. This means that none of the custom dungeons were
being registered for generation since the system saw them as badly
tagged. They also wouldn't generate Monoliths even if tagged as closed
because we would ignore the tags.
3. Changed a comparison for the "open" tag to be case insensitive.
4. Minor changes
2013-06-22 14:27:59 -04:00
SenseiKiwi
248f14971e Fixed Empty Dungeon Guide Bug
Fixed the bug that caused "How_to_add_dungeons.txt" to be copied as an
empty file. The reason was very subtle. Also moved the file to a
different directory.
2013-06-20 04:47:16 -04:00
SenseiKiwi
58b72b3b5a Added temporary debug prints to copyfile
Added temporary debug prints to copyfile
2013-06-20 03:31:40 -04:00
SenseiKiwi
7e76ccebfb Added Rift Blade Rift Creation Setting
Added a property in our config that enables or disables the Rift Blade's
ability to create new rifts. It can still open existing rifts even if
that ability is disabled. I tested that to be certain. If the ability is
disabled, the Rift Blade blocks on right-click instead of charging like
a bow.
2013-06-18 23:04:36 -04:00
SenseiKiwi
cac45814a9 Merge remote-tracking branch 'upstream/master' into R1.4.0-improvements 2013-06-18 22:43:15 -04:00
SenseiKiwi
6393c240d6 Fixed minor bug
Fixed a mistake with the schematic paths of somethingBroke and defaultUp
- they were written incorrectly and so they would never load properly.
2013-06-18 22:39:03 -04:00
StevenRS11
77965d7d0d Patched bug with dungeon selection on old worlds 2013-06-18 18:08:19 -04:00
SenseiKiwi
a628f3c63b Fixed Bug in RiftGenerator
Fixed a small bug. DDProperties.WorldRiftGenerationEnabled is supposed
to control whether rifts and gateways generate outside of Limbo. I
assume that rifts and gateways are always supposed to generate in Limbo
given the wording of that description. However, if the flag was set to
false, we would also disable rift generation in Limbo. I've fixed this
by ignoring that flag if we detect that the chunk is in Limbo.
2013-06-18 13:34:03 -04:00
SenseiKiwi
ecaa90a438 Partially Overhauled Commands
Partially overhauled our command classes. Added DDCommandBase - it
extends CommandBase and acts as a new base class for our commands. It
removes a little redundancy in our code and provides increased
convenience. Removed the static fields for our commands in
mod_pocketDim. There was no point in keeping them when nothing was using
them. Changed in-game command names to be shorter yet relevant.
Converted all commands to singletons so proper instances can be
retrieved if necessary. Migrated some of the custom dungeon start/ending
logic to DungeonHelper and made customDungeonStatus private. Except for
data objects, we shouldn't be exposing state variables like that without
any kind of checks. I've rewritten the code in some commands but it's
been quite tiring. Still need to fix up lots of things.
2013-06-18 10:23:31 -04:00
SenseiKiwi
45e039573b Renamed Command Classes, Deleted Unused Class
Renamed some of the command classes to change "Dim" to "Dimension". I'm
a firm believer in writing most things out except when it would be
absurd. Also deleted CommandPrintDungeonData because it didn't do
anything. We can always add it again if we want it.
2013-06-18 06:50:10 -04:00
SenseiKiwi
e37312e733 Trivial changes
Trivial changes.
2013-06-18 02:27:36 -04:00
SenseiKiwi
438b251d8f Optimized Weighted Random Dungeon Selection
Optimized the selection of random dungeons with weights applied. We now
have a class called WeightedContainer for taping into Minecraft's
weighted selection code without having to extend the WeightedRandomItem
class. Using that, we no longer need to keep a list with duplicate
dungeons to achieve weighted selection, so I removed that variable.
2013-06-17 22:26:39 -04:00
SenseiKiwi
b9f95a284a Added a comment
Just added a comment in DungeonHelper.
2013-06-17 06:34:35 -04:00
SenseiKiwi
30960acffa Fixed Tutorial Listing Bug and Improved Listing
Fixed the bug that caused the dungeon creation tutorial to be listed as
a schematic. We were listing all files in the custom schematic directory
as a schematic, even though that file wasn't. I added filtering so that
we only look at files that end with ".schematic". Also improved dungeon
listing by sorting the name list in alphabetical order. That makes the
list much easier to read through.
2013-06-17 06:31:53 -04:00
SenseiKiwi
17c9118126 Fixed Dungeon Listing and Formatting Bugs
Added a workaround so that the dungeon list produced by
CommandAddDungeonRift does not have repeated names. Also cleaned up the
code a bit - it's a mess in there. Part of the rewrite eliminated the
bug that caused some dungeon names to be preceded by a backslash (or
slash). I've noticed a different bug now - the dungeon tutorial file is
being included in the list of dungeons. I'll be fixing that in the next
commit.
2013-06-17 06:18:15 -04:00
SenseiKiwi
3b88d3a116 Cleaned up ItemStableFabric
Cleaned up the indentation of ItemStableFabric and corrected some faulty
String comparisons.
2013-06-17 05:53:11 -04:00
SenseiKiwi
654a479692 Improved Gateway and Rift Generation
Added checks for the material that a gateway is being built upon. Now
gateways no longer generate on top of trees. Combined with multiple
generation attempts, there is a good chance that they will find a gap
between trees to generate at ground level. I also added checks to stop
gateways and rifts from generating on top of the Nether's bedrock.
2013-06-17 05:40:35 -04:00
SenseiKiwi
e7b064e3cb Fixed Gen Directionality Bug and Minor Tweak
I fixed a subtle bug in RiftGenerator. The code for picking random
coordinates on the surface of a chunk would subtract a random amount
from the coordinate of the chunk's corner. Unfortunately, subtracting
meant that we would almost always generate coordinates OUTSIDE the
intended chunk. The correct calculation was to add, not subtract. This
meant that if you walked in a direction in which our gateways were
generated outside of existing chunks, then their data would be lost and
no gateways would generate!

To reproduce this bug, max out the chance of generating gateways and fly
in the direction that decreases X and Z. You must fly into new chunks.
After passing the gateways produced when you spawn (if this is a new
world) you'll see that gateways don't generate on the landscape.
However, if you change directions, they'll begin generating again.

In addition to fixing that bug, I also tweaked all the block setting
calls in RiftGenerator so that they'll trigger block updates and send
update packets to the client. I think triggering block updates will
prevent unusual problems with floating sand, gravel, etc.
2013-06-17 03:38:10 -04:00
SenseiKiwi
4ceace1b47 Added retrying on Rift Gateway generation
Added a loop that allows RiftGenerator to retry generating a gateway if
it picks an invalid location for it. It has a limited number of tries
before it gives up and doesn't generate a gateway. I haven't added the
logic for avoiding generating on top of trees, but that'll be easy to
add now.
2013-06-17 03:20:00 -04:00
StevenRS11
c4665e0737 Fixed dungeon entrance not updating client. 2013-06-16 22:10:52 -04:00
StevenRS11
8e771d4047 tweaked generation of the platform a bit 2013-06-16 16:03:10 -04:00
SenseiKiwi
cf2246061c Trivial Changes
Made trivial changes to DungeonHelper. Just some spacing and a note to
check something in the future. Need to commit to change branches.
2013-06-16 14:40:26 -04:00
SenseiKiwi
b2f5c4ea4e Overhauled RiftGenerator
Overhauled RIftGenerator. The code is significantly more readable now.
It's commented and much more compact. I also removed all fields from
RiftGenerator - they were unnecessary and using them increased the risk
of buggy code. Made the code rely solely on the Random instance provided
by MC, meaning our rifts and gateways will be tied to the world seed.
Tweaked the code slightly so that clusters of rifts and gateways can
never generate in the same chunk. This was previously possible, although
highly unlikely. It's a work of art now. <3
2013-06-16 14:36:32 -04:00
SenseiKiwi
8dce8c1c26 Renamed all singleton create() to initialize()
Renamed the create() function of DDProperties and DungeonHelper to
initialize(). Why? Because it was bugging me. <.< That is all.
2013-06-16 12:06:21 -04:00
SenseiKiwi
f542941074 Replaced Hashtable with HashMap
Replaced all instances of Hashtable in our code with HashMap. I had
never given that much thought until Steven mentioned it. HashMap is a
better alternative for our code.
2013-06-16 11:06:08 -04:00
SenseiKiwi
63be7fefc1 Tweaked Dungeon Tutorial Copy Code
Tweaked the code that copies the dungeon export tutorial. I'm not sure
it worked all the time before. It didn't seem quite right. I've
confirmed it's working better now. Also cleaned up copyfile a little.
2013-06-16 10:54:03 -04:00
SenseiKiwi
697b0da59f Fixed Configuration and Rift Generation Bugs
Although fields were created in DDProperties for Monolith spawning and
Rift generation, they were mislabeled as reading the "World Rift
Generation Enabled" property. I gave them proper names. I also changed
the fields and names to be more intuitive and rewrote the descriptions.
For instance, "MonolithSpawnDensity" is a misnomer because as density
increases, there should be more Monoliths, not less. Now the properties
clearly state how they affect a feature. I rewrote the conditions that
used each property to correspond with those simplified descriptions and
gave the properties default values that will match the generation rates
seen before.

I also made the rift generation code less cryptic and fixed a bug; there
was a check that compared if a dimension was a pocket dimension by its
name to prevent rift generation. That name check was wrong - it would
never work. Now we check if the provider is an instance of
pocketProvider. That will continue working even if we change the way
that pocket dimensions are named.
2013-06-16 09:57:51 -04:00
SenseiKiwi
61297c3a3a Improved DungeonHelper
Separated exportDungeon() from registerCustomDungeon() - exporting a
dungeon no longer automatically registers it. Also changed
exportDungeon() so that it returns a boolean indicating success or
failure, instead of an instance of DungeonGenerator that was never being
used. I modified CommandEndDungeonCreation so that it can warn you if
exporting the dungeon failed (if exportDungeon() returned false), and
also, to register the dungeon after it's exported since it's no longer
automatic.
2013-06-16 05:59:53 -04:00
SenseiKiwi
a95b282814 Cleaned references in mod_pocketDim
Cleaned references in mod_pocketDim
2013-06-16 05:18:17 -04:00
SenseiKiwi
256384b455 Merging upstream changes
Merging upstream changes
2013-06-16 04:56:27 -04:00
StevenRS11
5e107f37f9 a few last tweaks 2013-06-16 03:40:46 -04:00
StevenRS11
cd4679c8fd configurable rift gen and monolith spawn density 2013-06-16 02:59:02 -04:00
SenseiKiwi
1bb8ddc1c4 Merging in upstream changes 2013-06-16 02:46:39 -04:00
StevenRS11
0752c032d3 merged SenseiKiwi changes 2013-06-16 01:50:23 -04:00
StevenRS11
a2eb4cf524 Fixed limbo return, schematic crash 2013-06-16 01:44:05 -04:00
SenseiKiwi
af555bbac8 Merge remote-tracking branch 'upstream/master' into R1.4.0-improvements 2013-06-16 01:30:50 -04:00
SenseiKiwi
8e200da01b Fixed minor bug
Fixed a bug with an uninitialized variable in DungeonHelper. Oops!
2013-06-16 01:30:13 -04:00
SenseiKiwi
d2259c3f5d Reintegrated initialization code for DungeonHelper
I had previously removed the function calls in mod_pocketDim to migrate
them to DungeonHelper. Completed the migration now.
2013-06-16 01:13:06 -04:00
SenseiKiwi
f56893018d Changed DungeonHelper into a singleton
Changed DungeonHelper into a singleton. Changed code in other classes to
interface with it properly.
2013-06-16 01:00:05 -04:00
StevenRS11
cb9c996861 monolith spawn and NPE in SchematicLoader fixes 2013-06-16 00:32:10 -04:00