Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/1.12-WIP' into 1.12-WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
Waterpicker committed Jan 7, 2019
2 parents 5004b30 + 9e4cb48 commit 22e41f5
Showing 1 changed file with 17 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,27 @@

public final class PocketGenerator {

public static Pocket generatePocketFromTemplate(int dim, PocketTemplate pocketTemplate, VirtualLocation virtualLocation, boolean setup) {
private static Pocket prepareAndPlacePocket(int dim, PocketTemplate pocketTemplate, VirtualLocation virtualLocation, boolean setup) {
DimDoors.log.info("Generating pocket from template " + pocketTemplate.getId() + " at virtual location " + virtualLocation);

PocketRegistry registry = PocketRegistry.instance(dim);
Pocket pocket = registry.newPocket();
pocketTemplate.place(pocket, setup);
pocket.setVirtualLocation(virtualLocation);
Pocket pocket = PocketRegistry.instance(dim).newPocket();
pocketTemplate.place(pocket, setup);
pocket.setVirtualLocation(virtualLocation);
return pocket;
}

public static Pocket generatePocketFromTemplate(int dim, PocketTemplate pocketTemplate, VirtualLocation virtualLocation, boolean setup) {
Pocket pocket = prepareAndPlacePocket(dim, pocketTemplate, virtualLocation, setup);
if (setup) pocketTemplate.setup(pocket, null, null);
return pocket;
}

public static Pocket generatePocketFromTemplate(int dim, PocketTemplate pocketTemplate, VirtualLocation virtualLocation, VirtualTarget linkTo, LinkProperties linkProperties) {
Pocket pocket = prepareAndPlacePocket(dim, pocketTemplate, virtualLocation, true);
pocketTemplate.setup(pocket, linkTo, linkProperties);
return pocket;
}

public static Pocket generatePrivatePocket(VirtualLocation virtualLocation) {
PocketTemplate pocketTemplate = SchematicHandler.INSTANCE.getPersonalPocketTemplate();
return generatePocketFromTemplate(ModDimensions.getPrivateDim(), pocketTemplate, virtualLocation, true);
Expand All @@ -32,9 +42,7 @@ public static Pocket generatePrivatePocket(VirtualLocation virtualLocation) {
// TODO: size of public pockets should increase with depth
public static Pocket generatePublicPocket(VirtualLocation virtualLocation, VirtualTarget linkTo, LinkProperties linkProperties) {
PocketTemplate pocketTemplate = SchematicHandler.INSTANCE.getPublicPocketTemplate();
Pocket pocket = generatePocketFromTemplate(ModDimensions.getPublicDim(), pocketTemplate, virtualLocation, false);
pocketTemplate.setup(pocket, linkTo, linkProperties);
return pocket;
return generatePocketFromTemplate(ModDimensions.getPublicDim(), pocketTemplate, virtualLocation, linkTo, linkProperties);
}

/**
Expand All @@ -50,8 +58,6 @@ public static Pocket generateDungeonPocket(VirtualLocation virtualLocation, Virt
String group = random.nextFloat() < netherProbability ? "nether" : "ruins";
PocketTemplate pocketTemplate = SchematicHandler.INSTANCE.getRandomTemplate(group, depth, ModConfig.pockets.maxPocketSize, false);

Pocket pocket = generatePocketFromTemplate(ModDimensions.getDungeonDim(), pocketTemplate, virtualLocation, false);
pocketTemplate.setup(pocket, linkTo, linkProperties);
return pocket;
return generatePocketFromTemplate(ModDimensions.getDungeonDim(), pocketTemplate, virtualLocation, linkTo, linkProperties);
}
}

0 comments on commit 22e41f5

Please sign in to comment.