mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-23 21:38:00 +01:00
Add moar structures
This commit is contained in:
parent
6bec00ab57
commit
f72a80be54
9 changed files with 104 additions and 5 deletions
|
@ -66,8 +66,10 @@ import com.minelittlepony.unicopia.player.PlayerSpeciesList;
|
|||
import com.minelittlepony.unicopia.power.PowersRegistry;
|
||||
import com.minelittlepony.unicopia.spell.SpellRegistry;
|
||||
import com.minelittlepony.unicopia.structure.CloudDungeon;
|
||||
import com.minelittlepony.unicopia.structure.GroundDungeon;
|
||||
import com.minelittlepony.unicopia.util.crafting.CraftingManager;
|
||||
import com.minelittlepony.unicopia.world.CloudGen;
|
||||
import com.minelittlepony.unicopia.world.StructuresGen;
|
||||
import com.minelittlepony.unicopia.world.UWorld;
|
||||
|
||||
@Mod(
|
||||
|
@ -145,7 +147,9 @@ public class Unicopia implements IGuiHandler {
|
|||
UItems.fixRecipes();
|
||||
|
||||
MapGenStructureIO.registerStructure(CloudGen.Start.class, "unicopia:clouds");
|
||||
MapGenStructureIO.registerStructure(StructuresGen.Start.class, "unicopia:ruins");
|
||||
MapGenStructureIO.registerStructureComponent(CloudDungeon.class, "unicopia:cloud_dungeon");
|
||||
MapGenStructureIO.registerStructureComponent(GroundDungeon.class, "unicopia:ground_dungeon");
|
||||
}
|
||||
|
||||
public static CraftingManager getCraftingManager() {
|
||||
|
|
|
@ -13,7 +13,8 @@ import net.minecraft.world.gen.structure.template.TemplateManager;
|
|||
|
||||
public class CloudDungeon extends TemplateBasedFeature {
|
||||
|
||||
private static final ResourceLocation STRUCTURE = new ResourceLocation(Unicopia.MODID, "cloud/temple_small");
|
||||
private static final ResourceLocation TEMPLE = new ResourceLocation(Unicopia.MODID, "cloud/temple_small");
|
||||
private static final ResourceLocation HOUSE = new ResourceLocation(Unicopia.MODID, "cloud/house_small");
|
||||
|
||||
public CloudDungeon() {
|
||||
}
|
||||
|
@ -25,7 +26,11 @@ public class CloudDungeon extends TemplateBasedFeature {
|
|||
@Override
|
||||
public boolean addComponentParts(World world, BlockPos startPos, TemplateManager templates, PlacementSettings placement) {
|
||||
|
||||
applyTemplate(world, startPos, templates, placement, STRUCTURE);
|
||||
if (world.rand.nextBoolean()) {
|
||||
applyTemplate(world, startPos, templates, placement, TEMPLE);
|
||||
} else {
|
||||
applyTemplate(world, startPos, templates, placement, HOUSE);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
package com.minelittlepony.unicopia.structure;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import com.minelittlepony.unicopia.Unicopia;
|
||||
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.gen.structure.template.PlacementSettings;
|
||||
import net.minecraft.world.gen.structure.template.TemplateManager;
|
||||
|
||||
public class GroundDungeon extends TemplateBasedFeature {
|
||||
|
||||
private static final ResourceLocation TOWER = new ResourceLocation(Unicopia.MODID, "ground/tower");
|
||||
private static final ResourceLocation TEMPLE_1 = new ResourceLocation(Unicopia.MODID, "ground/temple_with_book");
|
||||
|
||||
public GroundDungeon() {
|
||||
}
|
||||
|
||||
public GroundDungeon(Random rand, int x, int z) {
|
||||
super(rand, x, 0, z, 7, 5, 8);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addComponentParts(World world, BlockPos startPos, TemplateManager templates, PlacementSettings placement) {
|
||||
|
||||
if (world.rand.nextBoolean()) {
|
||||
applyTemplate(world, startPos, templates, placement, TOWER);
|
||||
} else {
|
||||
applyTemplate(world, startPos, templates, placement, TEMPLE_1);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
package com.minelittlepony.unicopia.world;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import com.minelittlepony.unicopia.structure.AbstractFeature;
|
||||
import com.minelittlepony.unicopia.structure.GroundDungeon;
|
||||
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.gen.structure.MapGenScatteredFeature;
|
||||
import net.minecraft.world.gen.structure.StructureBoundingBox;
|
||||
import net.minecraft.world.gen.structure.StructureStart;
|
||||
|
||||
public class StructuresGen extends MapGenScatteredFeature {
|
||||
|
||||
@Override
|
||||
public String getStructureName() {
|
||||
return "unicopia:ruins";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSwampHut(BlockPos pos) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected StructureStart getStructureStart(int chunkX, int chunkZ) {
|
||||
return new Start(world, rand, chunkX, chunkZ);
|
||||
}
|
||||
|
||||
public static class Start extends AbstractFeature.Start {
|
||||
public Start() {
|
||||
|
||||
}
|
||||
|
||||
public Start(World world, Random rand, int x, int z) {
|
||||
super(world, rand, x, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addComponents(World world, Random rand, int x, int z, Biome biome) {
|
||||
components.add(new GroundDungeon(rand, x * 16, z * 16));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generateStructure(World world, Random rand, StructureBoundingBox bounds) {
|
||||
super.generateStructure(world, rand, bounds);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -43,7 +43,8 @@ public class UWorld implements IWorldGenerator {
|
|||
}
|
||||
}
|
||||
|
||||
private CloudGen cloudStructureGen = new CloudGen();
|
||||
private CloudGen cloudsGen = new CloudGen();
|
||||
private StructuresGen structuresGen = new StructuresGen();
|
||||
|
||||
public void init() {
|
||||
GameRegistry.registerWorldGenerator(this, 1);
|
||||
|
@ -54,7 +55,8 @@ public class UWorld implements IWorldGenerator {
|
|||
if (world.getWorldInfo().isMapFeaturesEnabled()) {
|
||||
ChunkPos pos = new ChunkPos(chunkX, chunkZ);
|
||||
|
||||
cloudStructureGen.generateStructure(world, world.rand, pos);
|
||||
cloudsGen.generateStructure(world, world.rand, pos);
|
||||
structuresGen.generateStructure(world, world.rand, pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -65,7 +67,8 @@ public class UWorld implements IWorldGenerator {
|
|||
if (world.getWorldInfo().isMapFeaturesEnabled()) {
|
||||
ChunkPrimer primer = new ChunkPrimer();
|
||||
|
||||
cloudStructureGen.generate(world, chunkX, chunkZ, primer);
|
||||
cloudsGen.generate(world, chunkX, chunkZ, primer);
|
||||
structuresGen.generate(world, chunkX, chunkZ, primer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
src/main/resources/assets/unicopia/structures/ground/tower.nbt
Normal file
BIN
src/main/resources/assets/unicopia/structures/ground/tower.nbt
Normal file
Binary file not shown.
Loading…
Reference in a new issue