the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
1#include "stdafx.h"
2#include "TheEndBiomeDecorator.h"
3#include "net.minecraft.world.level.h"
4#include "net.minecraft.world.level.tile.h"
5#include "net.minecraft.world.level.levelgen.feature.h"
6#include "net.minecraft.world.entity.boss.enderdragon.h"
7
8
9// Spike centre positions, calculated using
10// for(int i=0;i<8;i++)
11// {
12// int x=40 * Mth::cos(2*(-PI+(PI/8)*i));
13// int z=40* Mth::sin(2*(-PI+(PI/8)*i));
14// }
15
16
17TheEndBiomeDecorator::SPIKE TheEndBiomeDecorator::SpikeValA[8]=
18{
19 // The chunk that the spike is in has to be the smallest x and z that any part of it is in
20 // a chunk(x,z) will only be post-processed when the chunks (x+1,z), (x,z+1) and (x+1,z+1) are also loaded
21
22 // first two values are the smallest x and z of the chunk that the feature is in - so the centre point minus the radius
23 { 32, -16, 40, 0, 2 },// smallest block - 38,-2
24 { 16, 16, 28, 28, 2 },// smallest block - 26,26
25 { -16, 32, 0, 40, 2 },// smallest block - -2,38
26 { -32, 16, -28, 28, 3 },// smallest block - -31,26
27 { -48, -16, -40, 0, 3 },// smallest block - -43,-3
28 { -32, -32, -28, -28, 3 },// smallest block - -31,-31
29 { -16, -48, 0, -40, 4 },// smallest block - -4,-44
30 { 16, -32, 28, -28, 4 },// smallest block - 24,-32
31};
32
33
34TheEndBiomeDecorator::TheEndBiomeDecorator(Biome *biome) : BiomeDecorator(biome)
35{
36 spikeFeature = new SpikeFeature(Tile::endStone_Id);
37 endPodiumFeature = new EndPodiumFeature(Tile::endStone_Id);
38}
39
40void TheEndBiomeDecorator::decorate()
41{
42 decorateOres();
43
44 // this will only set the y to the top y of the chunks already processed...
45 int y = level->getTopSolidBlock(xo+8, zo+8);
46 if(y>level->GetHighestY()) level->SetHighestY(y);
47
48 // 4J-PB - editing to place 8 spikes in a circle, with increasing height
49
50 // are we within the chunk with a spike?
51 for(int i=0;i<8;i++)
52 {
53 if((xo == SpikeValA[i].iChunkX) && (zo == SpikeValA[i].iChunkZ))
54 {
55 // in the right chunk
56 spikeFeature->placeWithIndex(level, random, SpikeValA[i].x, level->GetHighestY(), SpikeValA[i].z,i,SpikeValA[i].radius);
57 }
58 }
59 if (xo == 0 && zo == 0)
60 {
61 shared_ptr<EnderDragon> enderDragon = shared_ptr<EnderDragon>(new EnderDragon(level));
62 enderDragon->AddParts(); // 4J added
63 enderDragon->moveTo(0, 128, 0, random->nextFloat() * 360, 0);
64 level->addEntity(enderDragon);
65 }
66
67 // end podium radius is 4, position is 0,0, so chunk needs to be the -16,-16 one since this guarantees that all chunks required for the podium are loaded
68 if (xo == -16 && zo == -16)
69 {
70 endPodiumFeature->place(level, random, 0, level->seaLevel, 0);
71 }
72}