use of ivorius.reccomplex.world.gen.feature.structure.MapGenStructureHook in project RecurrentComplex by Ivorforce.
the class RCTerrainGenEventHandler method onInitMapGen.
@SubscribeEvent
public void onInitMapGen(InitMapGenEvent event) {
if (RCConfig.decorationHacks) {
InitMapGenEvent.EventType type = event.getType();
// All need to inherit from the base type
MapGenStructureHook hook;
switch(type) {
case OCEAN_MONUMENT:
hook = new MapGenStructureHook((MapGenStructure) event.getNewGen(), RCBiomeDecorator.DecorationType.OCEAN_MONUMENT);
event.setNewGen(new StructureOceanMonument() {
@Override
public String getStructureName() {
return hook.getStructureName();
}
@Override
public boolean generateStructure(World worldIn, Random randomIn, ChunkPos chunkCoord) {
return hook.generateStructure(worldIn, randomIn, chunkCoord);
}
@Override
public boolean isInsideStructure(BlockPos pos) {
return hook.isInsideStructure(pos);
}
@Override
public boolean isPositionInStructure(World worldIn, BlockPos pos) {
return hook.isPositionInStructure(worldIn, pos);
}
@Override
@Nullable
public BlockPos getNearestStructurePos(World worldIn, BlockPos pos, boolean findUnexplored) {
return hook.getNearestStructurePos(worldIn, pos, findUnexplored);
}
@Override
public void generate(World worldIn, int x, int z, ChunkPrimer primer) {
hook.generate(worldIn, x, z, primer);
}
});
break;
case SCATTERED_FEATURE:
hook = new MapGenStructureHook((MapGenStructure) event.getNewGen(), RCBiomeDecorator.DecorationType.SCATTERED_FEATURE);
event.setNewGen(new MapGenScatteredFeature() {
@Override
public String getStructureName() {
return hook.getStructureName();
}
@Override
public boolean generateStructure(World worldIn, Random randomIn, ChunkPos chunkCoord) {
return hook.generateStructure(worldIn, randomIn, chunkCoord);
}
@Override
public boolean isInsideStructure(BlockPos pos) {
return hook.isInsideStructure(pos);
}
@Override
public boolean isPositionInStructure(World worldIn, BlockPos pos) {
return hook.isPositionInStructure(worldIn, pos);
}
@Override
@Nullable
public BlockPos getNearestStructurePos(World worldIn, BlockPos pos, boolean findUnexplored) {
return hook.getNearestStructurePos(worldIn, pos, findUnexplored);
}
@Override
public void generate(World worldIn, int x, int z, ChunkPrimer primer) {
hook.generate(worldIn, x, z, primer);
}
});
break;
case VILLAGE:
hook = new MapGenStructureHook((MapGenStructure) event.getNewGen(), RCBiomeDecorator.DecorationType.VILLAGE);
event.setNewGen(new MapGenVillage() {
@Override
public String getStructureName() {
return hook.getStructureName();
}
@Override
public boolean generateStructure(World worldIn, Random randomIn, ChunkPos chunkCoord) {
return hook.generateStructure(worldIn, randomIn, chunkCoord);
}
@Override
public boolean isInsideStructure(BlockPos pos) {
return hook.isInsideStructure(pos);
}
@Override
public boolean isPositionInStructure(World worldIn, BlockPos pos) {
return hook.isPositionInStructure(worldIn, pos);
}
@Override
@Nullable
public BlockPos getNearestStructurePos(World worldIn, BlockPos pos, boolean findUnexplored) {
return hook.getNearestStructurePos(worldIn, pos, findUnexplored);
}
@Override
public void generate(World worldIn, int x, int z, ChunkPrimer primer) {
hook.generate(worldIn, x, z, primer);
}
});
break;
case NETHER_BRIDGE:
hook = new MapGenStructureHook((MapGenStructure) event.getNewGen(), RCBiomeDecorator.DecorationType.NETHER_BRIDGE);
event.setNewGen(new MapGenNetherBridge() {
@Override
public String getStructureName() {
return hook.getStructureName();
}
@Override
public boolean generateStructure(World worldIn, Random randomIn, ChunkPos chunkCoord) {
return hook.generateStructure(worldIn, randomIn, chunkCoord);
}
@Override
public boolean isInsideStructure(BlockPos pos) {
return hook.isInsideStructure(pos);
}
@Override
public boolean isPositionInStructure(World worldIn, BlockPos pos) {
return hook.isPositionInStructure(worldIn, pos);
}
@Override
@Nullable
public BlockPos getNearestStructurePos(World worldIn, BlockPos pos, boolean findUnexplored) {
return hook.getNearestStructurePos(worldIn, pos, findUnexplored);
}
@Override
public void generate(World worldIn, int x, int z, ChunkPrimer primer) {
hook.generate(worldIn, x, z, primer);
}
});
break;
case STRONGHOLD:
hook = new MapGenStructureHook((MapGenStructure) event.getNewGen(), RCBiomeDecorator.DecorationType.STRONGHOLD);
event.setNewGen(new MapGenStronghold() {
@Override
public String getStructureName() {
return hook.getStructureName();
}
@Override
public boolean generateStructure(World worldIn, Random randomIn, ChunkPos chunkCoord) {
return hook.generateStructure(worldIn, randomIn, chunkCoord);
}
@Override
public boolean isInsideStructure(BlockPos pos) {
return hook.isInsideStructure(pos);
}
@Override
public boolean isPositionInStructure(World worldIn, BlockPos pos) {
return hook.isPositionInStructure(worldIn, pos);
}
@Override
@Nullable
public BlockPos getNearestStructurePos(World worldIn, BlockPos pos, boolean findUnexplored) {
return hook.getNearestStructurePos(worldIn, pos, findUnexplored);
}
@Override
public void generate(World worldIn, int x, int z, ChunkPrimer primer) {
hook.generate(worldIn, x, z, primer);
}
});
break;
case MINESHAFT:
hook = new MapGenStructureHook((MapGenStructure) event.getNewGen(), RCBiomeDecorator.DecorationType.MINESHAFT);
event.setNewGen(new MapGenMineshaft() {
@Override
public String getStructureName() {
return hook.getStructureName();
}
@Override
public boolean generateStructure(World worldIn, Random randomIn, ChunkPos chunkCoord) {
return hook.generateStructure(worldIn, randomIn, chunkCoord);
}
@Override
public boolean isInsideStructure(BlockPos pos) {
return hook.isInsideStructure(pos);
}
@Override
public boolean isPositionInStructure(World worldIn, BlockPos pos) {
return hook.isPositionInStructure(worldIn, pos);
}
@Override
@Nullable
public BlockPos getNearestStructurePos(World worldIn, BlockPos pos, boolean findUnexplored) {
return hook.getNearestStructurePos(worldIn, pos, findUnexplored);
}
@Override
public void generate(World worldIn, int x, int z, ChunkPrimer primer) {
hook.generate(worldIn, x, z, primer);
}
});
break;
}
}
}
Aggregations