Merge remote-tracking branch 'origin/1.12-WIP' into 1.12-WIP
This commit is contained in:
commit
22e41f5131
1 changed files with 17 additions and 11 deletions
|
@ -13,17 +13,27 @@ import java.util.Random;
|
||||||
|
|
||||||
public final class PocketGenerator {
|
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);
|
DimDoors.log.info("Generating pocket from template " + pocketTemplate.getId() + " at virtual location " + virtualLocation);
|
||||||
|
|
||||||
PocketRegistry registry = PocketRegistry.instance(dim);
|
Pocket pocket = PocketRegistry.instance(dim).newPocket();
|
||||||
Pocket pocket = registry.newPocket();
|
|
||||||
pocketTemplate.place(pocket, setup);
|
pocketTemplate.place(pocket, setup);
|
||||||
pocket.setVirtualLocation(virtualLocation);
|
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);
|
if (setup) pocketTemplate.setup(pocket, null, null);
|
||||||
return pocket;
|
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) {
|
public static Pocket generatePrivatePocket(VirtualLocation virtualLocation) {
|
||||||
PocketTemplate pocketTemplate = SchematicHandler.INSTANCE.getPersonalPocketTemplate();
|
PocketTemplate pocketTemplate = SchematicHandler.INSTANCE.getPersonalPocketTemplate();
|
||||||
return generatePocketFromTemplate(ModDimensions.getPrivateDim(), pocketTemplate, virtualLocation, true);
|
return generatePocketFromTemplate(ModDimensions.getPrivateDim(), pocketTemplate, virtualLocation, true);
|
||||||
|
@ -32,9 +42,7 @@ public final class PocketGenerator {
|
||||||
// TODO: size of public pockets should increase with depth
|
// TODO: size of public pockets should increase with depth
|
||||||
public static Pocket generatePublicPocket(VirtualLocation virtualLocation, VirtualTarget linkTo, LinkProperties linkProperties) {
|
public static Pocket generatePublicPocket(VirtualLocation virtualLocation, VirtualTarget linkTo, LinkProperties linkProperties) {
|
||||||
PocketTemplate pocketTemplate = SchematicHandler.INSTANCE.getPublicPocketTemplate();
|
PocketTemplate pocketTemplate = SchematicHandler.INSTANCE.getPublicPocketTemplate();
|
||||||
Pocket pocket = generatePocketFromTemplate(ModDimensions.getPublicDim(), pocketTemplate, virtualLocation, false);
|
return generatePocketFromTemplate(ModDimensions.getPublicDim(), pocketTemplate, virtualLocation, linkTo, linkProperties);
|
||||||
pocketTemplate.setup(pocket, linkTo, linkProperties);
|
|
||||||
return pocket;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -50,8 +58,6 @@ public final class PocketGenerator {
|
||||||
String group = random.nextFloat() < netherProbability ? "nether" : "ruins";
|
String group = random.nextFloat() < netherProbability ? "nether" : "ruins";
|
||||||
PocketTemplate pocketTemplate = SchematicHandler.INSTANCE.getRandomTemplate(group, depth, ModConfig.pockets.maxPocketSize, false);
|
PocketTemplate pocketTemplate = SchematicHandler.INSTANCE.getRandomTemplate(group, depth, ModConfig.pockets.maxPocketSize, false);
|
||||||
|
|
||||||
Pocket pocket = generatePocketFromTemplate(ModDimensions.getDungeonDim(), pocketTemplate, virtualLocation, false);
|
return generatePocketFromTemplate(ModDimensions.getDungeonDim(), pocketTemplate, virtualLocation, linkTo, linkProperties);
|
||||||
pocketTemplate.setup(pocket, linkTo, linkProperties);
|
|
||||||
return pocket;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue