mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-04-05 07:16:10 +00:00
fix server issues
This commit is contained in:
@@ -37,10 +37,12 @@ configure<LoomGradleExtension> {
|
||||
}
|
||||
|
||||
tasks.register<RemapJarTask>("remapShadedJar") {
|
||||
dependsOn("shadowJar")
|
||||
setProperty("input", file("build/libs/Terra-fabric-${version}-shaded.jar"))
|
||||
setProperty("addNestedDependencies", false)
|
||||
setProperty("remapAccessWidener", true)
|
||||
val shadowJar = tasks.getByName<ShadowJar>("shadowJar")
|
||||
dependsOn(shadowJar)
|
||||
input.set(shadowJar.archiveFile)
|
||||
archiveFileName.set(shadowJar.archiveFileName.get().replace(Regex("-shaded\\.jar$"), "shaded-mapped.jar"))
|
||||
addNestedDependencies.set(true)
|
||||
remapAccessWidener.set(true)
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
@@ -30,6 +30,8 @@ import com.dfsek.terra.config.lang.LangUtil;
|
||||
import com.dfsek.terra.config.lang.Language;
|
||||
import com.dfsek.terra.config.pack.ConfigPack;
|
||||
import com.dfsek.terra.fabric.inventory.FabricItemHandle;
|
||||
import com.dfsek.terra.fabric.mixin.BiomeEffectsAccessor;
|
||||
import com.dfsek.terra.fabric.mixin.GeneratorTypeAccessor;
|
||||
import com.dfsek.terra.fabric.world.FabricBiome;
|
||||
import com.dfsek.terra.fabric.world.FabricTree;
|
||||
import com.dfsek.terra.fabric.world.FabricWorldHandle;
|
||||
@@ -234,17 +236,19 @@ public class TerraFabricPlugin implements TerraPlugin, ModInitializer {
|
||||
generationSettings.surfaceBuilder(SurfaceBuilder.DEFAULT.withConfig(new TernarySurfaceConfig(Blocks.GRASS_BLOCK.getDefaultState(), Blocks.DIRT.getDefaultState(), Blocks.GRAVEL.getDefaultState()))); // It needs a surfacebuilder, even though we dont use it.
|
||||
generationSettings.feature(GenerationStep.Feature.VEGETAL_DECORATION, POPULATOR_CONFIGURED_FEATURE);
|
||||
|
||||
BiomeEffectsAccessor biomeEffectsAccessor = (BiomeEffectsAccessor) vanilla.getEffects();
|
||||
|
||||
BiomeEffects.Builder effects = new BiomeEffects.Builder()
|
||||
.waterColor(vanilla.getWaterColor())
|
||||
.waterFogColor(vanilla.getWaterFogColor())
|
||||
.fogColor(vanilla.getFogColor())
|
||||
.skyColor(vanilla.getSkyColor())
|
||||
.grassColorModifier(vanilla.getEffects().getGrassColorModifier());
|
||||
if(vanilla.getEffects().getGrassColor().isPresent()) {
|
||||
effects.grassColor(vanilla.getEffects().getGrassColor().get());
|
||||
.waterColor(biomeEffectsAccessor.getWaterColor())
|
||||
.waterFogColor(biomeEffectsAccessor.getWaterFogColor())
|
||||
.fogColor(biomeEffectsAccessor.getFogColor())
|
||||
.skyColor(biomeEffectsAccessor.getSkyColor())
|
||||
.grassColorModifier(biomeEffectsAccessor.getGrassColorModifier());
|
||||
if(biomeEffectsAccessor.getGrassColor().isPresent()) {
|
||||
effects.grassColor(biomeEffectsAccessor.getGrassColor().get());
|
||||
}
|
||||
if(vanilla.getEffects().getFoliageColor().isPresent()) {
|
||||
effects.foliageColor(vanilla.getEffects().getFoliageColor().get());
|
||||
if(biomeEffectsAccessor.getFoliageColor().isPresent()) {
|
||||
effects.foliageColor(biomeEffectsAccessor.getFoliageColor().get());
|
||||
}
|
||||
|
||||
return (new Biome.Builder())
|
||||
@@ -296,8 +300,8 @@ public class TerraFabricPlugin implements TerraPlugin, ModInitializer {
|
||||
}
|
||||
};
|
||||
//noinspection ConstantConditions
|
||||
generatorType.translationKey = (new LiteralText("Terra:" + pack.getTemplate().getID()));
|
||||
GeneratorType.VALUES.add(generatorType);
|
||||
((GeneratorTypeAccessor) generatorType).setTranslationKey(new LiteralText("Terra:" + pack.getTemplate().getID()));
|
||||
GeneratorTypeAccessor.getVALUES().add(generatorType);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.dfsek.terra.fabric.mixin;
|
||||
|
||||
import net.minecraft.world.biome.BiomeEffects;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
@Mixin(BiomeEffects.class)
|
||||
public interface BiomeEffectsAccessor {
|
||||
@Accessor
|
||||
int getFogColor();
|
||||
|
||||
@Accessor
|
||||
int getWaterColor();
|
||||
|
||||
@Accessor
|
||||
int getWaterFogColor();
|
||||
|
||||
@Accessor
|
||||
int getSkyColor();
|
||||
|
||||
@Accessor
|
||||
Optional<Integer> getFoliageColor();
|
||||
|
||||
@Accessor
|
||||
Optional<Integer> getGrassColor();
|
||||
|
||||
@Accessor
|
||||
BiomeEffects.GrassColorModifier getGrassColorModifier();
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.dfsek.terra.fabric.mixin;
|
||||
|
||||
import net.minecraft.client.world.GeneratorType;
|
||||
import net.minecraft.text.Text;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Mutable;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mixin(GeneratorType.class)
|
||||
public interface GeneratorTypeAccessor {
|
||||
@Accessor
|
||||
static List<GeneratorType> getVALUES() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Accessor
|
||||
Text getTranslationKey();
|
||||
|
||||
@Mutable
|
||||
@Accessor
|
||||
void setTranslationKey(Text translationKey);
|
||||
}
|
||||
@@ -20,6 +20,7 @@
|
||||
]
|
||||
},
|
||||
"mixins": [
|
||||
"terra.mixins.json"
|
||||
],
|
||||
"depends": {
|
||||
"fabricloader": ">=0.7.4",
|
||||
|
||||
@@ -2,16 +2,8 @@ accessWidener v1 named
|
||||
|
||||
extendable method net/minecraft/client/world/GeneratorType <init> (Ljava/lang/String;)V
|
||||
|
||||
accessible field net/minecraft/client/world/GeneratorType translationKey Lnet/minecraft/text/Text;
|
||||
mutable field net/minecraft/client/world/GeneratorType translationKey Lnet/minecraft/text/Text;
|
||||
|
||||
accessible field net/minecraft/client/world/GeneratorType VALUES Ljava/util/List;
|
||||
|
||||
accessible field net/minecraft/server/world/ServerWorld worldProperties Lnet/minecraft/world/level/ServerWorldProperties;
|
||||
|
||||
accessible method net/minecraft/world/MobSpawnerLogic getEntityId ()Lnet/minecraft/util/Identifier;
|
||||
|
||||
accessible field net/minecraft/state/State PROPERTY_MAP_PRINTER Ljava/util/function/Function;
|
||||
|
||||
accessible method net/minecraft/block/entity/LootableContainerBlockEntity setInvStackList (Lnet/minecraft/util/collection/DefaultedList;)V
|
||||
accessible method net/minecraft/block/entity/LootableContainerBlockEntity getInvStackList ()Lnet/minecraft/util/collection/DefaultedList;
|
||||
accessible field net/minecraft/state/State PROPERTY_MAP_PRINTER Ljava/util/function/Function;
|
||||
16
platforms/fabric/src/main/resources/terra.mixins.json
Normal file
16
platforms/fabric/src/main/resources/terra.mixins.json
Normal file
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"required": true,
|
||||
"minVersion": "0.8",
|
||||
"package": "com.dfsek.terra.fabric.mixin",
|
||||
"compatibilityLevel": "JAVA_8",
|
||||
"mixins": [
|
||||
"BiomeEffectsAccessor"
|
||||
],
|
||||
"client": [
|
||||
"GeneratorTypeAccessor"
|
||||
],
|
||||
"server": [],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user