Skip to content
This repository was archived by the owner on Jun 3, 2024. It is now read-only.

Commit f69db6a

Browse files
author
IceCryptonym
committed
Fix merge conflicts
2 parents 568c5ba + aca009f commit f69db6a

200 files changed

Lines changed: 5096 additions & 513 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 0 additions & 35 deletions
This file was deleted.

HEADER

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Minecraft Forge, Patchwork Project
2-
Copyright (c) 2016-2019, 2019
2+
Copyright (c) 2016-2020, 2019-2020
33

44
This library is free software; you can redistribute it and/or
55
modify it under the terms of the GNU Lesser General Public

build.gradle

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ plugins {
1212
def ENV = System.getenv()
1313

1414
class Globals {
15-
static def baseVersion = "0.2.0"
15+
static def baseVersion = "0.3.0"
1616
static def mcVersion = "1.14.4"
1717
static def yarnVersion = "+build.15"
1818
}
@@ -232,6 +232,7 @@ repositories {
232232
mavenCentral()
233233
maven { url 'https://dl.bintray.com/patchworkmc/Patchwork-Maven/' }
234234
}
235+
235236
dependencies {
236237
afterEvaluate {
237238
subprojects.each {

checkstyle.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@
161161
<module name="PackageName">
162162
<!-- require a package either in patchwork or forge -->
163163
<property name="format"
164-
value="^com\.patchworkmc|^net.minecraftforge"/>
164+
value="^com\.patchworkmc|^net\.minecraftforge|^cpw\.mods\.modlauncher\.api"/>
165165
</module>
166166

167167
<!--<module name="InvalidJavadocPosition"/>-->
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
/*
2+
* Minecraft Forge, Patchwork Project
3+
* Copyright (c) 2016-2020, 2019-2020
4+
*
5+
* This library is free software; you can redistribute it and/or
6+
* modify it under the terms of the GNU Lesser General Public
7+
* License as published by the Free Software Foundation version 2.1
8+
* of the License.
9+
*
10+
* This library is distributed in the hope that it will be useful,
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13+
* Lesser General Public License for more details.
14+
*
15+
* You should have received a copy of the GNU Lesser General Public
16+
* License along with this library; if not, write to the Free Software
17+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18+
*/
19+
20+
package com.patchworkmc.impl.biomes;
21+
22+
import java.util.Iterator;
23+
import java.util.Set;
24+
25+
import com.google.common.collect.Sets;
26+
27+
import net.minecraft.util.registry.Registry;
28+
import net.minecraft.world.biome.Biome;
29+
import net.minecraft.world.biome.Biomes;
30+
31+
import net.fabricmc.api.ModInitializer;
32+
import net.fabricmc.fabric.api.biomes.v1.OverworldBiomes;
33+
import net.fabricmc.fabric.api.event.registry.RegistryEntryAddedCallback;
34+
import net.fabricmc.fabric.api.event.server.ServerStartCallback;
35+
36+
public final class PatchworkBiomes implements ModInitializer {
37+
private static Set<Biome> failedBiomes = Sets.newHashSet();
38+
39+
@Override
40+
public void onInitialize() {
41+
Registry.BIOME.forEach(PatchworkBiomes::addRivers);
42+
RegistryEntryAddedCallback.event(Registry.BIOME).register((rawid, id, biome) -> {
43+
addRivers(biome);
44+
updateFailedBiomes();
45+
});
46+
ServerStartCallback.EVENT.register(server -> updateFailedBiomes());
47+
}
48+
49+
private static void addRivers(Biome biome) {
50+
Biome river = ((RiverSupplier) biome).getRiver();
51+
52+
if (river == null) {
53+
failedBiomes.add(biome);
54+
return;
55+
}
56+
57+
setRiverIfNotDefault(biome, river);
58+
}
59+
60+
private static void updateFailedBiomes() {
61+
if (!failedBiomes.isEmpty()) {
62+
Iterator<Biome> iterator = failedBiomes.iterator();
63+
64+
while (iterator.hasNext()) {
65+
Biome biome = iterator.next();
66+
Biome river = ((RiverSupplier) biome).getRiver();
67+
68+
if (river == null) {
69+
continue;
70+
}
71+
72+
iterator.remove();
73+
74+
setRiverIfNotDefault(biome, river);
75+
}
76+
}
77+
}
78+
79+
private static void setRiverIfNotDefault(Biome biome, Biome river) {
80+
if (river != getDefaultRiver(biome)) {
81+
OverworldBiomes.setRiverBiome(biome, river);
82+
}
83+
}
84+
85+
public static Biome getDefaultRiver(Biome biome) {
86+
if (biome == Biomes.SNOWY_TUNDRA) {
87+
return Biomes.FROZEN_RIVER;
88+
} else if (biome == Biomes.MUSHROOM_FIELDS || biome == Biomes.MUSHROOM_FIELD_SHORE) {
89+
return Biomes.MUSHROOM_FIELD_SHORE;
90+
}
91+
92+
return Biomes.RIVER;
93+
}
94+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
* Minecraft Forge, Patchwork Project
3+
* Copyright (c) 2016-2020, 2019-2020
4+
*
5+
* This library is free software; you can redistribute it and/or
6+
* modify it under the terms of the GNU Lesser General Public
7+
* License as published by the Free Software Foundation version 2.1
8+
* of the License.
9+
*
10+
* This library is distributed in the hope that it will be useful,
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13+
* Lesser General Public License for more details.
14+
*
15+
* You should have received a copy of the GNU Lesser General Public
16+
* License along with this library; if not, write to the Free Software
17+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18+
*/
19+
20+
package com.patchworkmc.impl.biomes;
21+
22+
import net.minecraft.world.biome.Biome;
23+
24+
public interface RiverSupplier {
25+
Biome getRiver();
26+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
* Minecraft Forge, Patchwork Project
3+
* Copyright (c) 2016-2020, 2019-2020
4+
*
5+
* This library is free software; you can redistribute it and/or
6+
* modify it under the terms of the GNU Lesser General Public
7+
* License as published by the Free Software Foundation version 2.1
8+
* of the License.
9+
*
10+
* This library is distributed in the hope that it will be useful,
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13+
* Lesser General Public License for more details.
14+
*
15+
* You should have received a copy of the GNU Lesser General Public
16+
* License along with this library; if not, write to the Free Software
17+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18+
*/
19+
20+
package com.patchworkmc.mixin.biomes;
21+
22+
import org.spongepowered.asm.mixin.Mixin;
23+
24+
import net.minecraft.world.biome.Biome;
25+
26+
import com.patchworkmc.impl.biomes.RiverSupplier;
27+
import com.patchworkmc.impl.biomes.PatchworkBiomes;
28+
29+
@Mixin(Biome.class)
30+
public class MixinBiome implements RiverSupplier {
31+
@Override
32+
public Biome getRiver() {
33+
Biome self = (Biome) (Object) this;
34+
return PatchworkBiomes.getDefaultRiver(self);
35+
}
36+
}

patchwork-biomes/src/main/java/net/minecraftforge/common/BiomeDictionary.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* Minecraft Forge, Patchwork Project
3-
* Copyright (c) 2016-2019, 2019
3+
* Copyright (c) 2016-2020, 2019-2020
44
*
55
* This library is free software; you can redistribute it and/or
66
* modify it under the terms of the GNU Lesser General Public

patchwork-biomes/src/main/java/net/minecraftforge/common/BiomeManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* Minecraft Forge, Patchwork Project
3-
* Copyright (c) 2016-2019, 2019
3+
* Copyright (c) 2016-2020, 2019-2020
44
*
55
* This library is free software; you can redistribute it and/or
66
* modify it under the terms of the GNU Lesser General Public

patchwork-biomes/src/main/resources/fabric.mod.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,14 @@
1717
"patchwork-fml": "*"
1818
},
1919
"description": "Implementation of the Forge Biomes API.",
20+
"entrypoints": {
21+
"main": [
22+
"com.patchworkmc.impl.biomes.PatchworkBiomes"
23+
]
24+
},
25+
"mixins": [
26+
"patchwork-biomes.mixins.json"
27+
],
2028
"custom": {
2129
"modmenu:api": true,
2230
"modmenu:parent": "patchwork"

0 commit comments

Comments
 (0)