Skip to content

Commit

Permalink
Clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
Cadiboo committed Jun 13, 2024
1 parent d47a019 commit f6cffa9
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 68 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,38 +6,6 @@
import net.minecraft.world.level.block.state.BlockState;

public interface IPlatform {

/**
* Gets the name of the current platform
*
* @return The name of the current platform.
*/
String getPlatformName();

/**
* Checks if a mod with the given id is loaded.
*
* @param modId The mod to check if it is loaded.
* @return True if the mod is loaded, false otherwise.
*/
boolean isModLoaded(String modId);

/**
* Check if the game is currently in a development environment.
*
* @return True if in a development environment, false otherwise.
*/
boolean isDevelopmentEnvironment();

/**
* Gets the name of the environment type as a string.
*
* @return The name of the environment type.
*/
default String getEnvironmentName() {
return isDevelopmentEnvironment() ? "development" : "production";
}

IBlockStateSerializer blockStateSerializer();

boolean isPlant(BlockState state);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,29 +1,11 @@
package io.github.cadiboo.nocubes.platform;

import io.github.cadiboo.nocubes.client.render.struct.Color;
import io.github.cadiboo.nocubes.util.IBlockStateSerializer;
import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.network.chat.Component;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.level.block.state.BlockState;

public class FabricPlatform implements IPlatform {

@Override
public String getPlatformName() {
return "Fabric";
}

@Override
public boolean isModLoaded(String modId) {
return FabricLoader.getInstance().isModLoaded(modId);
}

@Override
public boolean isDevelopmentEnvironment() {
return FabricLoader.getInstance().isDevelopmentEnvironment();
}

@Override
public IBlockStateSerializer blockStateSerializer() {
return new IBlockStateSerializer() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,8 @@
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraftforge.common.IPlantable;
import net.minecraftforge.fml.ModList;
import net.minecraftforge.fml.config.ConfigTracker;
import net.minecraftforge.fml.config.ModConfig;
import net.minecraftforge.fml.loading.FMLLoader;
import net.minecraftforge.registries.ForgeRegistries;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
Expand All @@ -33,25 +31,9 @@
import java.util.stream.Collectors;

public class ForgePlatform implements IPlatform {

private static final Logger LOG = LogManager.getLogger();
private static final BlockStateArgument PARSER = new BlockStateArgument(CommandBuildContext.simple(VanillaRegistries.createLookup(), FeatureFlags.REGISTRY.allFlags()));

@Override
public String getPlatformName() {
return "Forge";
}

@Override
public boolean isModLoaded(String modId) {
return ModList.get().isLoaded(modId);
}

@Override
public boolean isDevelopmentEnvironment() {
return !FMLLoader.isProduction();
}

@Override
public IBlockStateSerializer blockStateSerializer() {

Expand Down

0 comments on commit f6cffa9

Please sign in to comment.