Skip to content

Commit 008b033

Browse files
authored
Merge pull request #58 from dshadowwolf/master-1.11.2
Master 1.11.2
2 parents db25704 + b7518c5 commit 008b033

File tree

4 files changed

+46
-29
lines changed

4 files changed

+46
-29
lines changed

build.gradle

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -34,19 +34,15 @@ javadoc {
3434

3535
description = 'OreSpawn'
3636
def mod_file = getModFile()
37-
def mc_version = '1.11.2'
38-
39-
ext {
40-
short_version = getVersion('VERSION', mod_file)
41-
}
42-
43-
version = mc_version + '-' + short_version
37+
def mc_version = "1.11.2"
38+
def short_version = getVersion("VERSION", mod_file)
39+
version = mc_version + "-" + short_version
4440
if (System.getenv().BUILD_NUMBER) {
4541
version += '.' + System.getenv().BUILD_NUMBER
4642
}
47-
group = 'com.mcmoddev'
48-
archivesBaseName = 'OreSpawn'
49-
sourceCompatibility = targetCompatibility = '1.8'
43+
group = "com.mcmoddev"
44+
archivesBaseName = "OreSpawn"
45+
sourceCompatibility = targetCompatibility = "1.8"
5046

5147
class Secrets {
5248
def data = null
@@ -73,12 +69,10 @@ if (secretFile.exists()) {
7369
}
7470

7571
minecraft {
76-
version = '1.11.2-13.20.0.2228'
77-
runDir = 'run'
78-
mappings = 'stable_32'
79-
// coreMod = corePlugin
80-
// clientJvmArgs = ["-Dfml.coreMods.load=$corePlugin"]
81-
// serverJvmArgs = ["-Dfml.coreMods.load=$corePlugin"]
72+
version = "1.11.2-13.20.0.2228"
73+
runDir = "run"
74+
mappings = "stable_32"
75+
// coreMod = ""
8276
makeObfSourceJar = false
8377
}
8478

@@ -236,12 +230,12 @@ publishing {
236230
curseforge {
237231
apiKey = secret.curseforgeAPIKey
238232
project {
239-
id = '245586'
240-
changelog = file('CHANGELOG.txt')
241-
releaseType = 'release'
242-
addGameVersion(project.mc_version)
243-
def projName = 'OreSpawn'
244-
def displayVersion = getVersion('VERSION', mod_file)
233+
id = "245586"
234+
changelog = file("CHANGELOG.txt")
235+
releaseType = "alpha"
236+
addGameVersion("1.11")
237+
def projName = "OreSpawn"
238+
def displayVersion = getVersion("VERSION", mod_file)
245239
if (System.getenv().BUILD_NUMBER) {
246240
displayVersion += '.' + System.getenv().BUILD_NUMBER
247241
}

src/main/java/com/mcmoddev/orespawn/EventHandlers.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ public EventHandlers() {
3737

3838
@SubscribeEvent
3939
public void onGenerateMinable(OreGenEvent.GenerateMinable event) {
40-
event.setResult(Event.Result.DENY);
40+
if( Config.getBoolean(Constants.RETROGEN_KEY) ) {
41+
event.setResult(Event.Result.DENY);
42+
}
4143
}
4244

4345
@SubscribeEvent

src/main/java/com/mcmoddev/orespawn/commands/ClearChunkCommand.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ public void execute(MinecraftServer server, ICommandSender sender, String[] args
3939
for (int z = chunkPos.getZStart(); z <= chunkPos.getZEnd(); z++) {
4040
BlockPos pos = new BlockPos(x, y, z);
4141
Block block = player.world.getBlockState(pos).getBlock();
42-
4342
if (OreSpawnWorldGen.getSpawnBlocks().contains(block)) {
4443
player.world.setBlockToAir(pos);
4544
}

src/main/java/com/mcmoddev/orespawn/impl/features/DefaultFeatureGenerator.java

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,13 @@ public void generate(ChunkPos pos, World world, IChunkGenerator chunkGenerator,
4444
int chunkZ = pos.z;
4545
Vec3i chunkCoord = new Vec3i(chunkX, chunkZ, world.provider.getDimension());
4646
Map<BlockPos,IBlockState> cache = retrieveCache(chunkCoord);
47-
for(Entry<BlockPos,IBlockState> ent : cache.entrySet()){
48-
spawn(cache.get(ent.getKey()),world,ent.getKey(),world.provider.getDimension(),false,replaceBlock);
47+
48+
if( !cache.isEmpty() ) { // if there is something in the cache, try to spawn it
49+
for(Entry<BlockPos,IBlockState> ent : cache.entrySet()){
50+
spawn(cache.get(ent.getKey()),world,ent.getKey(),world.provider.getDimension(),false,replaceBlock);
51+
}
4952
}
53+
5054
// now to ore spawn
5155

5256
int blockX = chunkX * 16 + 8;
@@ -94,20 +98,38 @@ public void generate(ChunkPos pos, World world, IChunkGenerator chunkGenerator,
9498
new Vec3i( 0, 0, 1),new Vec3i( 1, 0, 1),
9599
new Vec3i( 0, 1, 1),new Vec3i( 1, 1, 1)
96100
};
101+
102+
private static final Vec3i[] offsets = {
103+
new Vec3i(-1,-1,-1),new Vec3i( 0,-1,-1),new Vec3i( 1,-1,-1),
104+
new Vec3i(-1, 0,-1),new Vec3i( 0, 0,-1),new Vec3i( 1, 0,-1),
105+
new Vec3i(-1, 1,-1),new Vec3i( 0, 1,-1),new Vec3i( 1, 1,-1),
106+
107+
new Vec3i(-1,-1, 0),new Vec3i( 0,-1, 0),new Vec3i( 1,-1, 0),
108+
new Vec3i(-1, 0, 0),new Vec3i( 0, 0, 0),new Vec3i( 1, 0, 0),
109+
new Vec3i(-1, 1, 0),new Vec3i( 0, 1, 0),new Vec3i( 1, 1, 0),
110+
111+
new Vec3i(-1,-1, 1),new Vec3i( 0,-1, 1),new Vec3i( 1,-1, 1),
112+
new Vec3i(-1, 0, 1),new Vec3i( 0, 0, 1),new Vec3i( 1, 0, 1),
113+
new Vec3i(-1, 1, 1),new Vec3i( 0, 1, 1),new Vec3i( 1, 1, 1)
114+
};
115+
97116
private static final int[] offsetIndexRef = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26};
98117
private static final int[] offsetIndexRef_small = {0,1,2,3,4,5,6,7};
99118

100119
public static void spawnOre( BlockPos blockPos, IBlockState oreBlock, int quantity, World world, Random prng, IBlockState replaceBlock) {
101120
int count = quantity;
102-
int lutType = quantity <= 8?offsetIndexRef_small.length:offsetIndexRef.length;
103-
int[] lut = quantity <= 8?offsetIndexRef_small:offsetIndexRef;
121+
int lutType = (quantity < 8)?offsetIndexRef_small.length:offsetIndexRef.length;
122+
int[] lut = (quantity < 8)?offsetIndexRef_small:offsetIndexRef;
123+
Vec3i[] offs = new Vec3i[lutType];
124+
125+
System.arraycopy((quantity < 8)?offsets_small:offsets, 0, offs, 0, lutType);
104126

105127
if( quantity < 27 ) {
106128
int[] scrambledLUT = new int[lutType];
107129
System.arraycopy(lut, 0, scrambledLUT, 0, scrambledLUT.length);
108130
scramble(scrambledLUT,prng);
109131
while(count > 0){
110-
spawn(oreBlock,world,blockPos.add(offsets_small[scrambledLUT[--count]]),world.provider.getDimension(),true,replaceBlock);
132+
spawn(oreBlock,world,blockPos.add(offs[scrambledLUT[--count]]),world.provider.getDimension(),true,replaceBlock);
111133
}
112134
return;
113135
}

0 commit comments

Comments
 (0)