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

Commit 1fe1ecd

Browse files
committed
Fix licensing
2 parents b05b46d + 2f18cbf commit 1fe1ecd

275 files changed

Lines changed: 11672 additions & 464 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: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
.settings
99
.project
1010
*.launch
11+
.recommenders
1112

1213
# Intellij/Idea
1314
.factorypath

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: 5 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.1.1"
15+
static def baseVersion = "0.3.0"
1616
static def mcVersion = "1.14.4"
1717
static def yarnVersion = "+build.15"
1818
}
@@ -60,6 +60,7 @@ allprojects {
6060

6161
implementation 'com.patchworkmc:patchwork-eventbus:0.1.2:all'
6262
implementation 'com.google.code.findbugs:jsr305:3.0.2'
63+
implementation 'org.apache.logging.log4j:log4j-core:2.10.0'
6364

6465
// For EventBus
6566
implementation 'org.ow2.asm:asm:6.2'
@@ -230,7 +231,9 @@ repositories {
230231
dirs 'jars'
231232
}
232233
mavenCentral()
234+
maven { url 'https://dl.bintray.com/patchworkmc/Patchwork-Maven/' }
233235
}
236+
234237
dependencies {
235238
afterEvaluate {
236239
subprojects.each {
@@ -248,6 +251,7 @@ dependencies {
248251
implementation 'com.electronwill.night-config:toml:3.6.2'
249252
include 'com.electronwill.night-config:core:3.6.2'
250253
include 'com.electronwill.night-config:toml:3.6.2'
254+
include 'com.patchworkmc:patchwork-eventbus:0.1.2:all'
251255

252256
fileTree(dir: 'jars', include: '*.jar').each {
253257
String baseName = it.name.replace(".jar", "")

checkstyle.xml

Lines changed: 7 additions & 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"/>-->
@@ -170,5 +170,11 @@
170170
<module name="AtclauseOrder">
171171
<property name="tagOrder" value="@param,@return,@throws,@deprecated"/>
172172
</module>
173+
<!--Some checks are broken (*ahem* lambda returns)-->
174+
<module name="SuppressionCommentFilter">
175+
<property name="offCommentFormat" value="CHECKSTYLE.OFF\: ([\w\|]+)"/>
176+
<property name="onCommentFormat" value="CHECKSTYLE.ON\: ([\w\|]+)"/>
177+
<property name="checkFormat" value="$1"/>
178+
</module>
173179
</module>
174180
</module>
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)