[5] Initial implementation of some attribute stuff. Nothing in this commit actually works but the game still launches! Will need to move item and armor stuff to a more generic file as well to make it less unique so it can be used broadly. Directory structure extended to add items and resources

[5] **WORKING** add custom item and item group to game. primarily metaljacket items not added yet - but example item works.

[5] initial add of custom blocks

[5] Made adding blocks more dynamic - tested to work

[5] Fixed metal jacket armor & created correct texture files to not break game. TEXTURES ARE RANDOM ON WEARING AS I DONT HAVE AN ACTUAL TEXTURE YET

[5] Started attribute tree stuff
This commit is contained in:
Jkibbels 2024-08-24 22:21:57 -04:00
parent 88eaeeaeef
commit 3716111b4a
5 changed files with 128 additions and 0 deletions

View File

@ -0,0 +1,44 @@
/*
*
* AbstractNode
*
* This is the general definition of everything that is allowed inside a node and is called by our system
*
*
*/
package jesse.keeblarcraft.AttributeMgr.Nodes;
import java.util.HashMap;
import java.util.List;
abstract public class AbstractNode {
/////////////////////////////////////////////////////////////////////////////
/// @fn GetNodeTitle
///
/// @brief The title of your node/skill!
/////////////////////////////////////////////////////////////////////////////
abstract String GetNodeTitle();
/////////////////////////////////////////////////////////////////////////////
/// @fn GetNodeDescription
///
/// @brief This will become the hover-over text display of a skill in
/// the skill tree
/////////////////////////////////////////////////////////////////////////////
abstract String GetNodeDescription();
/////////////////////////////////////////////////////////////////////////////
/// @fn GetDetails
///
/// @brief This is the general details that may be displayed inside the
/// GUI when the skill tree becomes available to a player. The
/// object is suggested to be treated as such:
///
/// KEY (String) -> The title of an effect/attribute
/// VAL (List<String>) -> Treated as a list of description
/// attributes. 1 string per description
/////////////////////////////////////////////////////////////////////////////
abstract HashMap<String, List<String>> GetDetails();
}

View File

@ -0,0 +1,51 @@
package jesse.keeblarcraft.AttributeMgr.Nodes;
import java.util.HashMap;
import java.util.List;
import jesse.keeblarcraft.Armor.MetalJacketArmor;
import jesse.keeblarcraft.CustomItems.ItemManager;
import net.minecraft.item.ArmorItem;
import net.minecraft.item.Item;
public final class MetalJacket_Node extends AbstractNode {
// This is the custom armor set that players will receive if no armor is on & attribute is equipped
public final Item jacketHelm = new ArmorItem(MetalJacketArmor.INSTANCE, ArmorItem.Type.HELMET, new Item.Settings());
public final Item jacketChest = new ArmorItem(MetalJacketArmor.INSTANCE, ArmorItem.Type.CHESTPLATE, new Item.Settings());
public final Item jacketLegs = new ArmorItem(MetalJacketArmor.INSTANCE, ArmorItem.Type.LEGGINGS, new Item.Settings());
public final Item jacketBoots = new ArmorItem(MetalJacketArmor.INSTANCE, ArmorItem.Type.BOOTS, new Item.Settings());
public MetalJacket_Node() {
// Finally register items with game
ItemManager.RegisterItem("metaljacket_helmet",jacketHelm);
ItemManager.RegisterItem("metaljacket_chestplate",jacketChest);
ItemManager.RegisterItem("metaljacket_leggings",jacketLegs);
ItemManager.RegisterItem("metaljacket_boots",jacketBoots);
}
@Override
String GetNodeTitle() {
return "MetalJacket";
}
// Short description of node on hover-event in GUI
@Override
String GetNodeDescription() {
return "MetalJacket affects armor value modifiers or gives player base armor when none is worn";
}
// Detailed description of node on click-event in GUI
@Override
HashMap<String, List<String>> GetDetails() {
HashMap<String, List<String>> ret = new HashMap<String, List<String>>();
// Filling out description item stuff here
ret.put("durability", List.of (
"Gives player a base armor set with 3 protection and resistance",
"If armor is being worn, this attribute multiplies each pieces armor value by 120% (rounding up to nearest integer)"
));
return ret;
}
}

View File

@ -0,0 +1,4 @@
package jesse.keeblarcraft.AttributeMgr;
public class SkillTree {
}

View File

@ -1,4 +1,8 @@
<<<<<<<< HEAD:src/main/java/jesse/keeblarcraft/EventMgr/ServerTickListener.java
package jesse.keeblarcraft.EventMgr; package jesse.keeblarcraft.EventMgr;
========
package jesse.keeblarcraft.Utils;
>>>>>>>> d94f405 ([5] Initial implementation of some attribute stuff. Nothing in this commit actually works but the game still launches! Will need to move item and armor stuff to a more generic file as well to make it less unique so it can be used broadly. Directory structure extended to add items and resources):src/main/java/jesse/keeblarcraft/Utils/ServerTickListener.java
import jesse.CommonServerUtils; import jesse.CommonServerUtils;
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents; import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents;

View File

@ -0,0 +1,25 @@
<<<<<<<< HEAD:src/main/java/jesse/keeblarcraft/EventMgr/ServerTickListener.java
package jesse.keeblarcraft.EventMgr;
========
package jesse.keeblarcraft.Utils;
>>>>>>>> d94f405 ([5] Initial implementation of some attribute stuff. Nothing in this commit actually works but the game still launches! Will need to move item and armor stuff to a more generic file as well to make it less unique so it can be used broadly. Directory structure extended to add items and resources):src/main/java/jesse/keeblarcraft/Utils/ServerTickListener.java
import jesse.CommonServerUtils;
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents;
import net.minecraft.server.MinecraftServer;
// This interface is responsible for the end tick of a server world event tick
public class ServerTickListener implements ServerTickEvents.EndTick {
CommonServerUtils config = new CommonServerUtils();
@Override
public void onEndTick(MinecraftServer server) {
if (server != null) {
config.SetServerInstance(server);
}
}
// Static method to register the server tick listener
public static void InitializeServerTicks() {
ServerTickEvents.END_SERVER_TICK.register(new ServerTickListener());
}
}