Skip to content

Commit

Permalink
Remove Extra ModPlatform Classes, Add getConfigPath to PlatformHandler
Browse files Browse the repository at this point in the history
Signed-off-by: Joseph T. McQuigg <[email protected]>
  • Loading branch information
JT122406 committed Jul 31, 2024
1 parent c646cd4 commit e9aa67d
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 59 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
- Fix sandy farmland not having a loottable
- Remove Vanilla Igloos from Shattered Glacier
- Fix a bunch of Leaves drops
- Remove Extra ModPlatform Classes, Add getConfigPath to PlatformHandler

# 1.0.2-Beta
- Fix Golden Apple from Green Apple Recipe overriding Vanilla Recipe
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import net.potionstudios.biomeswevegone.world.level.block.custom.BWGFarmLandBlock;
import org.jetbrains.annotations.NotNull;

import java.nio.file.Path;
import java.util.ArrayList;
import java.util.ServiceLoader;
import java.util.function.Supplier;
Expand All @@ -42,6 +43,12 @@ public interface PlatformHandler {
*/
String getPlatformName();

/**
* Gets the path to the config directory
* @return The path to the config directory
*/
Path configPath();

/**
* Registers an entity with the specified parameters
* @see EntityType
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package net.potionstudios.biomeswevegone.world.level.levelgen.biome;


import com.google.common.base.Suppliers;
import com.mojang.datafixers.util.Pair;
import com.mojang.serialization.Codec;
Expand All @@ -18,7 +17,7 @@
import net.minecraft.core.registries.Registries;
import net.minecraft.resources.ResourceKey;
import net.minecraft.world.level.biome.Biome;
import net.potionstudios.biomeswevegone.platform.ModPlatform;
import net.potionstudios.biomeswevegone.PlatformHandler;
import org.jetbrains.annotations.NotNull;

import java.io.IOException;
Expand All @@ -29,7 +28,7 @@

public record BWGWorldGenConfig(Map<ResourceKey<Biome>, Boolean> enabledBiomes, int regionWeight) {

public static final Path PATH = ModPlatform.INSTANCE.configPath().resolve("world_generation.json5");
public static final Path PATH = PlatformHandler.PLATFORM_HANDLER.configPath().resolve("world_generation.json5");

@NotNull
public static Supplier<BWGWorldGenConfig> INSTANCE = Suppliers.memoize(BWGWorldGenConfig::getOrCreateConfigFromDisk);
Expand Down Expand Up @@ -107,6 +106,4 @@ private static void createDefaultFile(BWGWorldGenConfig defaultWorldGenConfig) {
throw new RuntimeException(e);
}
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import net.fabricmc.fabric.api.object.builder.v1.block.type.WoodTypeBuilder;
import net.fabricmc.fabric.api.object.builder.v1.entity.FabricEntityTypeBuilder;
import net.fabricmc.fabric.api.particle.v1.FabricParticleTypes;
import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.Util;
import net.minecraft.core.Holder;
import net.minecraft.core.Registry;
Expand All @@ -31,6 +32,7 @@
import net.potionstudios.biomeswevegone.PlatformHandler;
import org.jetbrains.annotations.NotNull;

import java.nio.file.Path;
import java.util.ArrayList;
import java.util.function.Supplier;

Expand All @@ -41,6 +43,11 @@ public String getPlatformName() {
return "Fabric";
}

@Override
public Path configPath() {
return FabricLoader.getInstance().getConfigDir().resolve(BiomesWeveGone.MOD_ID);
}

@Override
public <E extends Entity> Supplier<EntityType<E>> registerEntity(String id, EntityType.EntityFactory<E> factory, MobCategory category, float width, float height) {
EntityType<E> entity = FabricEntityTypeBuilder.create(category, factory).dimensions(EntityDimensions.scalable(width, height)).build();
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import net.minecraft.world.level.material.Fluid;
import net.minecraftforge.common.ForgeSpawnEggItem;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.fml.loading.FMLPaths;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.RegistryObject;
Expand All @@ -42,6 +43,7 @@
import net.potionstudios.biomeswevegone.world.level.block.wood.BWGWood;
import org.jetbrains.annotations.NotNull;

import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Map;
import java.util.Objects;
Expand All @@ -54,6 +56,11 @@ public String getPlatformName() {
return "Forge";
}

@Override
public Path configPath() {
return FMLPaths.CONFIGDIR.get().resolve(BiomesWeveGone.MOD_ID);
}

private static final DeferredRegister<EntityType<?>> ENTITY_TYPES = DeferredRegister.create(ForgeRegistries.ENTITY_TYPES, BiomesWeveGone.MOD_ID);

@Override
Expand Down

This file was deleted.

0 comments on commit e9aa67d

Please sign in to comment.