Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

7.2 update #56

Merged
merged 20 commits into from
May 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ dependencies {
implementation("org.apache.logging.log4j:log4j-1.2-api:${log4jVersion}")
include(implementation("org.apache.commons:commons-lang3:3.12.0"))

modImplementation "ModMenu:ModMenu:${project.mod_menu_version}"
// modImplementation "ModMenu:ModMenu:${project.mod_menu_version}"
}

java {
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
org.gradle.jvmargs=-Xmx2G

# BTA
bta_version=7.1_01
bta_version=7.2-pre1

# Loader & Mod Menu
loader_version=0.15.6-babric.5-bta
mod_menu_version=2.0.5

# Mod
mod_version=3.5.4
mod_version=4.0.0
mod_group=turniplabs
mod_name=halplibe

25 changes: 4 additions & 21 deletions src/main/java/turniplabs/halplibe/HalpLibe.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,54 +4,38 @@
import net.fabricmc.api.ModInitializer;
import net.fabricmc.loader.api.FabricLoader;
import net.fabricmc.loader.api.entrypoint.PreLaunchEntrypoint;
import net.minecraft.core.Global;
import net.minecraft.core.block.Block;
import net.minecraft.core.block.BlockLanternFirefly;
import net.minecraft.core.data.gamerule.GameRuleBoolean;
import net.minecraft.core.data.gamerule.GameRules;
import net.minecraft.core.data.registry.Registries;
import net.minecraft.core.data.registry.recipe.RecipeNamespace;
import net.minecraft.core.item.Item;
import net.minecraft.core.item.ItemStack;
import net.minecraft.core.util.helper.DyeColor;
import net.minecraft.core.world.biome.Biome;
import net.minecraft.core.world.biome.Biomes;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import turniplabs.halplibe.helper.*;
import turniplabs.halplibe.helper.AchievementHelper;
import turniplabs.halplibe.helper.ModVersionHelper;
import turniplabs.halplibe.helper.NetworkHelper;
import turniplabs.halplibe.util.RecipeEntrypoint;
import turniplabs.halplibe.util.TomlConfigHandler;
import turniplabs.halplibe.util.achievements.AchievementPage;
import turniplabs.halplibe.util.achievements.VanillaAchievementsPage;
import turniplabs.halplibe.util.toml.Toml;
import turniplabs.halplibe.util.version.PacketModList;

import java.util.HashMap;

public class HalpLibe implements ModInitializer, PreLaunchEntrypoint, RecipeEntrypoint {
public static final String MOD_ID = "halplibe";
public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID);
public static boolean isClient = FabricLoader.getInstance().getEnvironmentType().equals(EnvType.CLIENT);
public static boolean sendModlist;
public static final boolean isClient = FabricLoader.getInstance().getEnvironmentType().equals(EnvType.CLIENT);
public static boolean exportRecipes;
public static boolean compatibilityMode;
public static final TomlConfigHandler CONFIG;
static {
Toml toml = new Toml();
toml.addCategory("Experimental");
toml.addEntry("Experimental.AtlasWidth", "Dynamically resized the Terrain and Item atlases, value must be an integer greater than or equal to 32",32);
toml.addEntry("Experimental.RequireTextures", "Require texture to exist on startup", false);
toml.addEntry("Experimental.CompatibilityMode", "Attempt allowing compatibility with older halplibe versions", true);
toml.addCategory("Network");
toml.addEntry("Network.SendModlistPack", "This sends a modlist packet to clients that join the server when enabled, however it may cause issues if the clients do not have halplibe installed", true);
toml.addCategory("Debug");
toml.addEntry("Debug.ExportRecipes", "Writes all the loaded game recipes to dumpRecipes after startup", false);


CONFIG = new TomlConfigHandler(MOD_ID, toml);

Global.TEXTURE_ATLAS_WIDTH_TILES = Math.max(32, CONFIG.getInt("Experimental.AtlasWidth"));
sendModlist = CONFIG.getBoolean("Network.SendModlistPack");
exportRecipes = CONFIG.getBoolean("Debug.ExportRecipes");
compatibilityMode = CONFIG.getBoolean("Experimental.CompatibilityMode");

Expand Down Expand Up @@ -104,7 +88,6 @@ public void onInitialize() {
@Override
public void onPreLaunch() {
// Initializes halp statics first
NetworkHelper.register(PacketModList.class, false, true); // Register Halplibe packets first
}

@Override
Expand Down
27 changes: 2 additions & 25 deletions src/main/java/turniplabs/halplibe/helper/ArmorHelper.java
Original file line number Diff line number Diff line change
@@ -1,32 +1,11 @@
package turniplabs.halplibe.helper;

import net.minecraft.core.item.material.ArmorMaterial;
import net.minecraft.core.util.collection.NamespaceID;
import net.minecraft.core.util.helper.DamageType;
import turniplabs.halplibe.util.ArmorMaterialMixinInterface;

abstract public class ArmorHelper {

/**
* Damage parameters can be more than 100%. Armor durability will be a bit different from in-game.
* Put armor textures in <i>armor/</i>
* @param name name of the armor used for its texture files
* @param durability durability of your armor
* @param combat combat damage reduction in percent
* @param blast blast damage reduction in percent
* @param fire fire damage reduction in percent
* @param fall fall damage reduction in percent
*/
@Deprecated
public static ArmorMaterial createArmorMaterial(String name, int durability, float combat, float blast, float fire, float fall) {
ArmorMaterial armorMaterial = new ArmorMaterial(name, ArmorMaterial.getArmorMaterials().size()-1, durability)
.withProtectionPercentage(DamageType.COMBAT, combat)
.withProtectionPercentage(DamageType.BLAST, blast)
.withProtectionPercentage(DamageType.FIRE, fire)
.withProtectionPercentage(DamageType.FALL, fall);

return ArmorMaterial.register(armorMaterial);
}

/**
* Damage parameters can be more than 100%. Armor durability will be a bit different from in-game.
* @param name name of the armor used for its texture files
Expand All @@ -38,14 +17,12 @@ public static ArmorMaterial createArmorMaterial(String name, int durability, flo
*/
@SuppressWarnings("unused") // API function
public static ArmorMaterial createArmorMaterial(String modId, String name, int durability, float combat, float blast, float fire, float fall) {
ArmorMaterial armorMaterial = new ArmorMaterial(name, ArmorMaterial.getArmorMaterials().size()-1, durability)
ArmorMaterial armorMaterial = new ArmorMaterial(new NamespaceID(modId, name), ArmorMaterial.getArmorMaterials().size()-1, durability)
.withProtectionPercentage(DamageType.COMBAT, combat)
.withProtectionPercentage(DamageType.BLAST, blast)
.withProtectionPercentage(DamageType.FIRE, fire)
.withProtectionPercentage(DamageType.FALL, fall);

((ArmorMaterialMixinInterface) armorMaterial).halplibe$SetModId(modId);

return ArmorMaterial.register(armorMaterial);
}
}
Loading
Loading