Skip to content

Commit

Permalink
migrated to VintageCore
Browse files Browse the repository at this point in the history
  • Loading branch information
CrossVas committed Nov 29, 2024
1 parent b870ac6 commit 88ad1e2
Show file tree
Hide file tree
Showing 32 changed files with 172 additions and 967 deletions.
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ dependencies {
// modImplementation files("libs/")
// coremodImplementation files("libs/")

modImplementation files("libs/VintageCore-1.5.2-1.0.3-dev.jar")
modImplementation files("libs/industrialcraft-2_1.117.385-lf.jar")
modImplementation files("libs/gregtechmod311.jar")
modImplementation files("libs/buildcraft-A-3.7.2.jar")
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Sets default memory used for gradle commands. Can be overridden by user or command line properties.
# This is required to provide enough memory for the Minecraft decompilation process.
mod_version = 1.5.2-2.2.2t
mod_version = 1.5.2-2.2.2u
modid = gravisuite
minecraft = 1.5.2
minecraft_forge = 1.5.2-7.8.1.738
Binary file added libs/VintageCore-1.5.2-1.0.3-dev.jar
Binary file not shown.
21 changes: 18 additions & 3 deletions src/main/java/reforged/mods/gravisuite/GraviSuite.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.registry.LanguageRegistry;
import mods.vintage.core.helpers.BlockHelper;
import mods.vintage.core.platform.lang.ILangProvider;
import mods.vintage.core.platform.lang.LangManager;
import net.minecraft.block.Block;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
Expand All @@ -18,16 +21,17 @@
import reforged.mods.gravisuite.network.NetworkHandler;
import reforged.mods.gravisuite.network.NetworkHandlerClient;
import reforged.mods.gravisuite.proxy.CommonProxy;
import reforged.mods.gravisuite.utils.Helpers;
import reforged.mods.gravisuite.utils.Refs;

import java.util.Arrays;
import java.util.List;
import java.util.logging.Logger;

@Mod(modid = Refs.id, name = Refs.name, version = Refs.version, acceptedMinecraftVersions = Refs.mc, dependencies = Refs.deps)
@NetworkMod(clientSideRequired = true,
clientPacketHandlerSpec = @NetworkMod.SidedPacketHandler(channels = { Refs.id }, packetHandler = NetworkHandlerClient.class),
serverPacketHandlerSpec = @NetworkMod.SidedPacketHandler(channels = { Refs.id }, packetHandler = NetworkHandler.class))
public class GraviSuite {
public class GraviSuite implements ILangProvider {

@SidedProxy(clientSide = Refs.client, serverSide = Refs.common)
public static CommonProxy proxy;
Expand Down Expand Up @@ -59,6 +63,7 @@ public GraviSuite() {
public void preInit(FMLPreInitializationEvent e) {
proxy.preInit(e);
GraviSuiteData.init();
LangManager.THIS.registerLangProvider(this);
}

@Mod.Init
Expand All @@ -75,7 +80,7 @@ public void postInit(FMLPostInitializationEvent e) {
public void onRightClick(PlayerInteractEvent e) {
if (GraviSuiteConfig.inspect_mode && e.entityPlayer.getHeldItem() != null) {
if (e.action == PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK && e.entityPlayer.getHeldItem().getItem() == Item.stick) {
Block block = Helpers.getBlock(e.entity.worldObj, e.x, e.y, e.z);
Block block = BlockHelper.getBlock(e.entity.worldObj, e.x, e.y, e.z);
int metadata = e.entityPlayer.worldObj.getBlockMetadata(e.x, e.y, e.z);
if (block != null) {
logger.info("Block: " + block.getLocalizedName() + " | Class Name: " + block.getClass().getName());
Expand All @@ -84,4 +89,14 @@ public void onRightClick(PlayerInteractEvent e) {
}
}
}

@Override
public String getModid() {
return Refs.id;
}

@Override
public List<String> getLocalizationList() {
return Arrays.asList(GraviSuiteConfig.langs);
}
}
6 changes: 2 additions & 4 deletions src/main/java/reforged/mods/gravisuite/GraviSuiteConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ public class GraviSuiteConfig {

public static Configuration id_config;
public static Configuration main_config;
public static String additional_languages;
public static String default_language;
public static String[] langs;
public static String[] logs;
public static String[] leaves;

Expand Down Expand Up @@ -94,8 +93,7 @@ public static void initConfig() {

log_wrench = getBoolean(Refs.general, "enable_wrench_logging", log_wrench, "Should GraviTool Wrench be logged? [Debug purposes only!]");
inspect_mode = getBoolean(Refs.general, "enable_inspect_mode", inspect_mode, "Enable inspect mode. Helps identify block name, class and metadata.");
default_language = getString(Refs.general, "default_language", "en_US,ru_RU", "Default Language. DO NOT CHANGE THIS! Use additional_languages field instead!");
additional_languages = getString(Refs.general, "additional_languages", "", "Additional supported localizations. Place your <name>.lang file in config/gravisuite/lang folder and list <name> here. Format: no spaces, comma separated. Ex: <name>,<name>");
langs = getString(Refs.general, "localizations", new String[] { "en_US", "ru_RU" }, "Supported localizations. Place your <name>.lang file in config/gravisuite/lang folder or inside mods/gravisuite/lang inside modJar");
magnet_range = getInt(Refs.general, "magnet_range", 1, 16, magnet_range, "Magnet Range.");
magnet_max_capacity = getInt(Refs.general, "magnet_max_capacity", 1, Integer.MAX_VALUE, magnet_max_capacity, "Magnet Attraction Capacity.");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import ic2.api.item.Items;
import ic2.api.recipe.Recipes;
import mods.vintage.core.helpers.RecipeHelper;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import reforged.mods.gravisuite.utils.Helpers;
Expand Down Expand Up @@ -54,7 +55,7 @@ public static void initRecipes() {
'D', Items.getItem("glassFiberCableItem"),
'F', Items.getItem("advancedCircuit"));

Helpers.removeRecipeByOutput(Items.getItem("quantumBodyarmor"));
RecipeHelper.removeRecipeByOutput(Items.getItem("quantumBodyarmor"));
Recipes.advRecipes.addRecipe(Items.getItem("quantumBodyarmor"),
"ANA", "ILI", "IAI",
'A', Items.getItem("advancedAlloy"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@

import cpw.mods.fml.common.TickType;
import ic2.core.audio.AudioSource;
import mods.vintage.core.platform.events.tick.TickEvents;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import reforged.mods.gravisuite.GraviSuite;
import reforged.mods.gravisuite.audio.IAudioProvider;
import reforged.mods.gravisuite.events.tick.TickEvents;
import reforged.mods.gravisuite.utils.Refs;

import java.util.EnumSet;

Expand All @@ -17,6 +18,10 @@ public class AudioHandler extends TickEvents.PlayerTickEvent {
boolean USED;
AudioSource AUDIO_SOURCE;

public AudioHandler() {
super(Refs.id);
}

@Override
public void tickStart(EnumSet<TickType> enumSet, Object... objects) {
if (shouldTick(enumSet)) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
package reforged.mods.gravisuite.events.client;

import cpw.mods.fml.common.TickType;
import mods.vintage.core.platform.events.tick.TickEvents;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import reforged.mods.gravisuite.GraviSuite;
import reforged.mods.gravisuite.events.tick.TickEvents;
import reforged.mods.gravisuite.items.armors.ItemAdvancedQuant;
import reforged.mods.gravisuite.proxy.CommonProxy;
import reforged.mods.gravisuite.utils.Refs;

import java.util.EnumSet;

Expand All @@ -16,6 +17,10 @@ public class ClientArmorHandler extends TickEvents.PlayerTickEvent {

public static boolean firstLoad = false;

public ClientArmorHandler() {
super(Refs.id);
}

@Override
public void tickStart(EnumSet<TickType> enumSet, Object... objects) {
if (shouldTick(enumSet)) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
package reforged.mods.gravisuite.events.client;

import cpw.mods.fml.common.TickType;
import mods.vintage.core.platform.events.tick.TickEvents;
import reforged.mods.gravisuite.GraviSuite;
import reforged.mods.gravisuite.events.tick.TickEvents;
import reforged.mods.gravisuite.utils.Refs;

import java.util.EnumSet;

public class KeyboardHandler extends TickEvents.ClientTickEvent {

public static final KeyboardHandler THIS = new KeyboardHandler();

public KeyboardHandler() {
super(Refs.id);
}

@Override
public void tickStart(EnumSet<TickType> enumSet, Object... objects) {
if (shouldTick(enumSet)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@
import cpw.mods.fml.common.TickType;
import ic2.api.item.IElectricItem;
import ic2.core.IC2;
import mods.vintage.core.platform.events.tick.TickEvents;
import mods.vintage.core.platform.lang.FormattedTranslator;
import mods.vintage.core.platform.lang.Translator;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import reforged.mods.gravisuite.GraviSuiteConfig;
import reforged.mods.gravisuite.events.tick.TickEvents;
import reforged.mods.gravisuite.items.armors.ItemAdvancedQuant;
import reforged.mods.gravisuite.items.armors.base.ItemBaseJetpack;
import reforged.mods.gravisuite.utils.Helpers;
import reforged.mods.gravisuite.utils.LangHelper;
import reforged.mods.gravisuite.utils.Refs;
import reforged.mods.gravisuite.utils.TextFormatter;

import java.util.EnumSet;

Expand All @@ -30,6 +30,10 @@ public class OverlayHandler extends TickEvents.RenderTickEvent {

public static Minecraft mc = Minecraft.getMinecraft();

public OverlayHandler() {
super(Refs.id);
}

@Override
public void tickEnd(EnumSet<TickType> type, Object... objects) {
if (shouldTick(type)) {
Expand All @@ -56,7 +60,7 @@ public void renderOverlay(Minecraft mc) {
}

// ENERGY STATUS
String energyToDisplay = Refs.energy_level_gold + " " + getEnergyTextColor(charge) + TextFormatter.WHITE.literal("%");
String energyToDisplay = Refs.energy_level_gold + " " + getEnergyTextColor(charge) + FormattedTranslator.WHITE.literal("%");

// HOVER MODE STATUS

Expand Down Expand Up @@ -141,10 +145,10 @@ public void renderOverlay(Minecraft mc) {
if (armor.getItem() instanceof ItemBaseJetpack) {
int xPos = scaledRes.getScaledWidth() / 2;
int yPos = scaledRes.getScaledHeight() - 85;
String quick_change = LangHelper.format(Refs.quick_charge);
String quick_change = Translator.format(Refs.quick_charge);
int width = mc.fontRenderer.getStringWidth(quick_change);
if (tag.getBoolean(ItemBaseJetpack.NBT_ACTIVE) && IC2.keyboard.isAltKeyDown(player)) {
mc.ingameGUI.drawString(mc.fontRenderer, TextFormatter.GREEN.format(Refs.quick_charge), xPos - width / 2, yPos, 0);
mc.ingameGUI.drawString(mc.fontRenderer, FormattedTranslator.GREEN.format(Refs.quick_charge), xPos - width / 2, yPos, 0);
}
}
}
Expand All @@ -171,21 +175,21 @@ private int getXOffset(String value) {
}

public static String getEnergyTextColor(int energyLevel) {
TextFormatter colorCode = TextFormatter.WHITE; // white
FormattedTranslator colorCode = FormattedTranslator.WHITE; // white
if (energyLevel >= 90) {
colorCode = TextFormatter.GREEN; // green
colorCode = FormattedTranslator.GREEN; // green
}
if ((energyLevel <= 90) && (energyLevel > 75)) {
colorCode = TextFormatter.YELLOW; // yellow
colorCode = FormattedTranslator.YELLOW; // yellow
}
if ((energyLevel <= 75) && (energyLevel > 50)) {
colorCode = TextFormatter.GOLD; // gold
colorCode = FormattedTranslator.GOLD; // gold
}
if ((energyLevel <= 50) && (energyLevel > 35)) {
colorCode = TextFormatter.RED; // red
colorCode = FormattedTranslator.RED; // red
}
if (energyLevel <= 35) {
colorCode = TextFormatter.DARK_RED; // dark_red
colorCode = FormattedTranslator.DARK_RED; // dark_red
}
return colorCode.literal(String.valueOf(energyLevel));
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package reforged.mods.gravisuite.events.server;

import cpw.mods.fml.common.TickType;
import mods.vintage.core.platform.events.tick.TickEvents;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import reforged.mods.gravisuite.events.tick.TickEvents;
import reforged.mods.gravisuite.items.armors.ItemAdvancedQuant;
import reforged.mods.gravisuite.proxy.CommonProxy;
import reforged.mods.gravisuite.utils.Refs;

import java.util.EnumSet;

Expand All @@ -15,6 +16,10 @@ public class ServerArmorHandler extends TickEvents.PlayerTickEvent {

public static boolean firstLoad = false;

public ServerArmorHandler() {
super(Refs.id);
}

@Override
public void tickStart(EnumSet<TickType> enumSet, Object... objects) {
if (shouldTick(enumSet)) {
Expand Down

This file was deleted.

42 changes: 0 additions & 42 deletions src/main/java/reforged/mods/gravisuite/events/tick/TickEvents.java

This file was deleted.

Loading

0 comments on commit 88ad1e2

Please sign in to comment.