Compare commits

..

No commits in common. "issue/11-fix-bank-manager" and "main" have entirely different histories.

48 changed files with 4365 additions and 318 deletions

4
.gitignore vendored
View File

@ -9,6 +9,10 @@ classes/
*.launch
# Doxygen ignores
**html/*
**latex/*
# idea
.idea/

2658
Doxyfile Normal file

File diff suppressed because it is too large Load Diff

View File

@ -16,6 +16,12 @@ repositories {
// Loom adds the essential maven repositories to download Minecraft and libraries from automatically.
// See https://docs.gradle.org/current/userguide/declaring_repositories.html
// for more information about repositories.
// maven {
// url "https://maven.squiddev.cc"
// content {
// includeGroup("cc.tweaked")
// }
// }
}
loom {
@ -38,7 +44,8 @@ dependencies {
// Fabric API. This is technically optional, but you probably want it anyway.
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
//modCompileOnly "cc.tweaked:cc-tweaked-1.20-fabric-api:1.105.0"
//modRuntimeOnly "cc.tweaked:cc-tweaked-1.20-fabric-api:1.105.0"
}
processResources {
@ -50,7 +57,7 @@ processResources {
}
tasks.withType(JavaCompile).configureEach {
it.options.release = 21
it.options.release = 17
}
java {
@ -59,8 +66,8 @@ java {
// If you remove this line, sources will not be generated.
withSourcesJar()
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
jar {

View File

@ -9,7 +9,7 @@ yarn_mappings=1.20+build.1
loader_version=0.15.11
# Mod Properties
mod_version=1.0.0
mod_version=0.0.1
maven_group=jesse.keeblarcraft
archives_base_name=keeblarcraft

4
installmod.sh Executable file
View File

@ -0,0 +1,4 @@
#!/bin/bash
rm ~/.minecraft/mods/keeblarcraft* # What else could be named this? Really now?
cp build/devlibs/*sources.jar ~/.minecraft/mods
echo Moved minecraft to mods dir

View File

@ -1,10 +1,21 @@
package jesse.keeblarcraft;
import jesse.keeblarcraft.gui.ClientHandlers;
import jesse.keeblarcraft.gui.ScreenManager;
import jesse.keeblarcraft.gui.widgets.TreeWidget;
import jesse.keeblarcraft.Shortcuts.ShortcutManager;
import net.fabricmc.api.ClientModInitializer;
public class KeeblarcraftClient implements ClientModInitializer {
@Override
public void onInitializeClient() {
// This entrypoint is suitable for setting up client-specific logic, such as rendering.
ShortcutManager.RegisterKeybinds();
ClientHandlers.RegisterHandlers();
ScreenManager.GetInstance();
ScreenManager.AddWidget(TreeWidget.class, 10);
}
}

View File

@ -0,0 +1,97 @@
/*
*
* ShortcutManager
*
* This is the client-side shortcut keybind manager
*
*
*/
package jesse.keeblarcraft.Shortcuts;
import org.lwjgl.glfw.GLFW;
// import jesse.keeblarcraft.Keeblarcraft;
import jesse.keeblarcraft.gui.ScreenManager;
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.option.KeyBinding;
import net.minecraft.client.util.InputUtil;
import net.minecraft.text.Text;
public class ShortcutManager {
private static KeyBinding skillTreeShortcut;
private static KeyBinding globalConfig;
private static Boolean toggleTreeGui = true; // Initialized to true for first time pressing keybind to actually display gui
// private static ScreenManager treeGui = null;
/////////////////////////////////////////////////////////////////////////////
/// @fn RegisterKeybinds
///
/// @brief Registers all player keybinds and callbacks to them
/////////////////////////////////////////////////////////////////////////////
// All callbacks for keyboard shortcuts are put here
public static void RegisterKeybinds() {
// Keybindings are registered here
skillTreeShortcut = KeyBindingHelper.registerKeyBinding(new KeyBinding(
"key.keeblarcraft.treemap",
InputUtil.Type.KEYSYM,
GLFW.GLFW_KEY_K,
"category.keeblarcraft.test"
));
globalConfig = KeyBindingHelper.registerKeyBinding(new KeyBinding(
"key.keeblarcraft.globalconfig",
InputUtil.Type.KEYSYM,
GLFW.GLFW_KEY_M,
"category.keeblarcraft.test"
));
/// Callbacks are down here
ClientTickEvents.END_CLIENT_TICK.register(client -> {
// The keybinding util does 2 things in one, if I check the state of the key press it flips a bit and deducts from
// the actual pressed amount - which we don't want to do. We will call the callbacks for keybinding functions here,
// and let them check the keybind themselves. NOTE: These functions are called at the end of every tick! Future us
// should see if there is a less expensive way to check this on just the keybind itself being flipped
DrawTreeGui(client);
if (globalConfig.wasPressed()) {
client.player.sendMessage(Text.of("Keeblarcraft recognizes you pressed the config button, but this option doesn't do anything yet"), false);
}
});
}
/////////////////////////////////////////////////////////////////////////////
/// @fn DrawTreeGui
///
/// @arg[in] client is the minecraft client instance that is passed in
/// so we have context of the client itself
///
/// @brief Draws the attribute tree GUI
/////////////////////////////////////////////////////////////////////////////
@SuppressWarnings("resource")
public static void DrawTreeGui(MinecraftClient client) {
while (skillTreeShortcut.wasPressed()) { // Constant loop required to redraw screen continuously
System.out.println("Key pressed detected"); /// TODO: When we figure out how to get key presses to still work when a screen opens; then we can toggle menus with buttons...
if (toggleTreeGui) {
// There is a technical resource leak that current screen is never closed when defining it here; which is ok I think because we want to return to it anyways
Screen currentScreen = MinecraftClient.getInstance().currentScreen;
client.player.sendMessage(Text.of("You pressed the GUI key!"));
// treeGui = new ScreenManager(Keeblarcraft.TREE_HANDLER.create(0, client.player.getInventory()), client.player.getInventory(), Text.of("Test"));
// treeGui.AddParent(currentScreen); ///TODO: Put this in the constructor when you figure out how the hell the magic is happening with registration
ScreenManager treeGui = ScreenManager.GetInstance();
treeGui.AddParent(currentScreen);
MinecraftClient.getInstance().setScreen(treeGui);
// toggleTreeGui intentionally never bit-flipped to false as a slight implementation bug exists such that pressing the keybind again
// does NOT call this callback function until the previous screen is CLOSED (which is why this isn't resource leaking...). This will
// need a slight rework or an extra subcall - but is fine for now since this is just how screens work.
}
}
}
}

View File

@ -0,0 +1,14 @@
/*
*
* IndividualAttribute
*
* This will be the handler class for each little attribute on the attribute tree itself.
* It will be fully implemented in the ticket that finishes the TreeWidget ticket (NOT GuiMgr)
*/
package jesse.keeblarcraft.gui.AttributeTree;
// This represents a single node in the tree of attributes drawn to the gui!!!
public class IndividualAttribute {
}

View File

@ -0,0 +1,11 @@
package jesse.keeblarcraft.gui;
import jesse.keeblarcraft.Keeblarcraft;
import net.minecraft.client.gui.screen.ingame.HandledScreens;
public class ClientHandlers {
public static void RegisterHandlers() {
System.out.println("Registering tree handler screen");
HandledScreens.register(Keeblarcraft.TREE_HANDLER, ScreenManager::new);
}
}

View File

@ -0,0 +1,74 @@
/*
*
* GenericLayerT
*
* GenericLayerT is the class that all layers must inherit from in order to be drawn. This allows for the GUI to properly
* draw the layers on which you want your canvas to exist!
*
*
*/
package jesse.keeblarcraft.gui;
import jesse.keeblarcraft.Utils.CommonStructures.Position2d;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.screen.narration.NarrationMessageBuilder;
import net.minecraft.client.gui.widget.ClickableWidget;
import net.minecraft.text.Text;
abstract public class GenericLayerT extends ClickableWidget {
// These are the box bounds of the widget
public int startX;
public int startY;
public int endX;
public int endY;
public GenericLayerT() {
// default constructor
super(0, 0, 0, 0, Text.of(""));
}
/////////////////////////////////////////////////////////////////////////////
/// @fn GenericLayerT
///
/// @brief Constructor for class. This is setup directly by the screen
/// manager object and it is not recommended to change the x/y
/// positions or you may break the relation of your widget to
/// others on the screen at the same time!
/////////////////////////////////////////////////////////////////////////////
public GenericLayerT(int x, int y, int width, int height, Text message) {
super(x, y, width, height, message);
}
/////////////////////////////////////////////////////////////////////////////
/// @fn DrawLayer
///
/// @brief Draw on a layer! This is an early implementation of being
/// able to choose the layer you are drawing on and making sure
/// you can customize which layer your context will draw on.
/// This will be called by the overall screen manager so the
/// layer id will be passed in. You will need to handle the layer
/// id yourself.
///
/// @note It is possible to get passed any layer id and you handle each
/// layer respectively; however, it is possible to draw on the
/// wrong layer if handled wrong. For example, you could be
/// passed layer '3' but this function is called for every layer
/// drawn on screen; so you must handle this to only draw on a
/// specific layer. Be careful!
/////////////////////////////////////////////////////////////////////////////
public abstract void DrawLayer(DrawContext context, int layer);
public void UpdateAnchorValues(int x, int y) {
this.startX = x;
this.startY = y;
}
// Calculated based on center of box values
public Position2d GetScreenCenter() {
return new Position2d((this.endX - this.startX) / 2, (this.endY - this.startY) / 2);
}
public abstract void renderButton(DrawContext context, int mouseX, int mouseY, float delta);
protected abstract void appendClickableNarrations(NarrationMessageBuilder builder);
}

View File

@ -0,0 +1,381 @@
/*
*
* ScreenManager
*
* This is the screen manager for the global screen handler of `TreeHandler` type
* Please note: `TreeHandler` is suited for a more broad range of things; however
* its initial implementation is for the skill tree. It will be renamed to a more
* generic name so this class is more obviously re-usable after its implementation
* is complete AND we verify this class can be made more generic for it. Since this
* is unknown, it will remain the name it has currently.
*
*
*/
package jesse.keeblarcraft.gui;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map.Entry;
import jesse.keeblarcraft.Keeblarcraft;
import jesse.keeblarcraft.GuiMgr.TreeHandler;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.screen.ingame.HandledScreen;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.text.Text;
// Client side renderer
public class ScreenManager extends HandledScreen<TreeHandler> {
private static ScreenManager static_inst;
@SuppressWarnings("resource")
private static PlayerInventory static_inventory = new PlayerInventory(null);// = MinecraftClient.getInstance().player.getInventory();
public static ScreenManager GetInstance() {
if (static_inst == null) {
static_inst = new ScreenManager(Keeblarcraft.TREE_HANDLER.create(0, static_inventory), static_inventory, Text.of("Test"));
}
return static_inst;
}
private static HashMap<Integer, ArrayList<Class<? extends GenericLayerT>>> layerMap = new HashMap<Integer, ArrayList<Class<? extends GenericLayerT>>>();
private static HashMap<Integer, ArrayList<GenericLayerT>> layers = new HashMap<Integer, ArrayList<GenericLayerT>>(); // key: layer id; value: list of classes to draw
// private TreeWidget treeWidget = null;
private Screen parent;
/////////////////////////////////////////////////////////////////////////////
/// @fn ScreenManager
///
/// @arg[in] handler is the TreeHandler (ScreenHandler) object
///
/// @arg[in] inventory is the players inventory. Required by HandledScreen
/// object however is unused currently in this Screen
///
/// @arg[in] title is the title of the screen window
///
/// @brief Class constructor
/////////////////////////////////////////////////////////////////////////////
public ScreenManager(TreeHandler handler, PlayerInventory inventory, Text title) {
super(handler, inventory, title);
System.out.println("Called constructor of screen manager!");
// Initialize layers in map
// for (int i = 0; i < NUMBER_DRAW_LAYERS; i++) {
// layers.put(i, new ArrayList<Class<? extends GenericLayerT>>());
// }
}
/////////////////////////////////////////////////////////////////////////////
/// @fn AddParent
///
/// @arg[in] parent is the parent screen object
///
/// @brief Add a parent screen to the screen object. This is useful if
/// you want to return to the previous screen when this one gets
/// closed by the user
/////////////////////////////////////////////////////////////////////////////
public void AddParent(Screen parent) {
this.parent = parent;
}
public static void AddWidget(Class<? extends GenericLayerT> widget, int drawLayer) {
if (layerMap.containsKey(drawLayer)) {
// Just append the widget to the draw layer
var layerList = layerMap.get(drawLayer);
layerList.add(widget);
} else {
// Brand new layer!
layerMap.put(drawLayer, new ArrayList<>(List.of(widget)));
}
}
/////////////////////////////////////////////////////////////////////////////
/// @fn init
///
/// @brief Initialize method; called one-time to setup class variables
/////////////////////////////////////////////////////////////////////////////
@Override
public void init() {
// initialize screen size to the global background picture
this.width = MinecraftClient.getInstance().getWindow().getScaledWidth();
this.height = MinecraftClient.getInstance().getWindow().getScaledHeight();
// Let's go through and initialize all the screen types now in our active memory
for (Entry<Integer, ArrayList<Class<? extends GenericLayerT>>> layerEntry : layerMap.entrySet()) {
var layerList = layerEntry.getValue();
layers.put(layerEntry.getKey(), new ArrayList<>());
var activeLayerList = layers.get(layerEntry.getKey());
for (int i = 0; i < layerList.size(); i++) {
try {
System.out.println("Attempting to initialize widget with information: LAYER I-VAL W H: " + layerEntry.getKey() + " " + i + " " + this.width + " " + this.height);
GenericLayerT initializedWidget = layerList.get(i).getDeclaredConstructor(int.class, int.class, int.class, int.class, Text.class).newInstance(0, 0, this.width, this.height, Text.of(""));
activeLayerList.add(initializedWidget);
} catch (InstantiationException e) {
System.out.println("Could not initialize GenericLayerT class (" + layerList.get(i).getClass().toString() + ") because of IntantiationException");
e.printStackTrace();
} catch (IllegalAccessException e) {
System.out.println("Could not initialize GenericLayerT class (" + layerList.get(i).getClass().toString() + ") because of IllegalAccessException");
e.printStackTrace();
} catch (IllegalArgumentException e) {
System.out.println("Could not initialize GenericLayerT class (" + layerList.get(i).getClass().toString() + ") because of IllegalArgumentException");
e.printStackTrace();
} catch (InvocationTargetException e) {
System.out.println("Could not initialize GenericLayerT class (" + layerList.get(i).getClass().toString() + ") because of InvocationTargetException");
e.printStackTrace();
} catch (NoSuchMethodException e) {
System.out.println("Could not initialize GenericLayerT class (" + layerList.get(i).getClass().toString() + ") because of NoSuchMethodException");
e.printStackTrace();
} catch (SecurityException e) {
System.out.println("Could not initialize GenericLayerT class (" + layerList.get(i).getClass().toString() + ") because of SecurityException");
e.printStackTrace();
}
}
}
// Initialize child widgets with correct screen values so they can draw themselves in the right area on the screen (duh!)
// treeWidget = new TreeWidget(GLOBAL_SCREEN_START_X + 24, GLOBAL_SCREEN_START_Y + 24, GLOBAL_SCREEN_WIDTH - 24, GLOBAL_SCREEN_HEIGHT - 24);
// this.addDrawableChild(treeWidget);
}
/////////////////////////////////////////////////////////////////////////////
/// @fn render
///
/// @arg[in] context is the drawing context of super class
///
/// @arg[in] mouseX is passed to parent class but unused here
///
/// @arg[in] mouseY is passed to parent class but unused here
///
/// @brief Render is called every frame while the screen is open
///
/// @note This is a pure abstract in parent and is required
/////////////////////////////////////////////////////////////////////////////
@Override
public void render(DrawContext context, int mouseX, int mouseY, float delta) {
super.render(context, mouseX, mouseY, delta); // This takes care of calling drawBackground which calls DrawMainScreen
}
/////////////////////////////////////////////////////////////////////////////
/// @fn drawForeground
///
/// @arg[in] context is the drawing context of super class
///
/// @arg[in] mouseX is unused
///
/// @arg[in] mouseY is unused
///
/// @brief Draw foreground exists to draw the titles; however we
/// intentionally override it so the superclass object does not
/// draw the overlay over the background screen
/////////////////////////////////////////////////////////////////////////////
@Override
public void drawForeground(DrawContext context, int mouseX, int mouseY) {
// We override this function to intentionally do nothing
// If in the future we want, we would draw the foreground and TITLES with this!
}
/////////////////////////////////////////////////////////////////////////////
/// @fn close
///
/// @brief Called when the screen closes
///
/// @note This is a pure abstract in parent and is required
/////////////////////////////////////////////////////////////////////////////
@Override
public void close() {
this.client.setScreen(parent); // return to previous screen or null
}
/////////////////////////////////////////////////////////////////////////////
/// @fn mouseDragged
///
/// @arg[in] mouseX is x-axis position of original mouse click
///
/// @arg[in] mouseY is y-axis position of original mouse click
///
/// @arg[in] button is the int value of button pressed for mouse dragging
///
/// @arg[in] deltaX is the change in the X position from the previous
/// mouse click
///
/// @arg[in] deltaY is the change in the Y position from the previous
/// mouse click
///
/// @brief The drag event is called on all widgets on the screen so
/// long as the initial position of the drag is within the
/// bounds of the widget box itself. Widgets themselves will need
/// to handle any sub-widgets since the bound check is only
/// there to verify if the event happened ANYWHERE within a
/// widget box
/////////////////////////////////////////////////////////////////////////////
@Override
public boolean mouseDragged(double mouseX, double mouseY, int button, double deltaX, double deltaY) {
super.mouseDragged(mouseX, mouseY, button, deltaX, deltaY);
// UpdateAnchorValues();
for (Entry<Integer, ArrayList<GenericLayerT>> layerEntry : layers.entrySet()) {
var layerList = layerEntry.getValue();
for (var layerListIterator = 0; layerListIterator < layerList.size(); layerListIterator++) {
var layer = layerList.get(layerListIterator);
// Check to make sure scroll is within the context of the widget then deliver information
if (InBounds(layer.startX, layer.startY, layer.endX, layer.endY, (int) mouseX, (int) mouseY)) {
layer.mouseDragged(mouseX, mouseY, button, deltaX, deltaY);
}
}
}
return true;
}
/////////////////////////////////////////////////////////////////////////////
/// @fn mouseScrolled
///
/// @arg[in] mouseX is the initial X position of the cursor on a scroll
///
/// @arg[in] mouseY is the initial Y position of the cursor on a scroll
///
/// @arg[in] amount is a normalized value that indicates scroll direction
///
/// @brief The scroll event is called on all widgets on the screen so
/// long as the initial position of the scroll is within the
/// bounds of the widget box itself. Widgets themselves will need
/// to handle any sub-widgets since the bound check is only
/// there to verify if the event happened ANYWHERE within a
/// widget box
///
/////////////////////////////////////////////////////////////////////////////
@Override
public boolean mouseScrolled(double mouseX, double mouseY, double amount) {
super.mouseScrolled(mouseX, mouseY, amount);
for (Entry<Integer, ArrayList<GenericLayerT>> layerEntry : layers.entrySet()) {
var layerList = layerEntry.getValue();
for (var layerListIterator = 0; layerListIterator < layerList.size(); layerListIterator++) {
var layer = layerList.get(layerListIterator);
// Check to make sure scroll is within the context of the widget then deliver information
if (InBounds(layer.startX, layer.startY, layer.endX, layer.endY, (int) mouseX, (int) mouseY)) {
layer.mouseScrolled(mouseX, mouseY, amount);
}
}
}
return true; // The parent function defines this to be boolean; but I have no idea when I would want to return false from this
}
/////////////////////////////////////////////////////////////////////////////
/// @fn mouseClicked
///
/// @arg[in] mouseX is the initial X position of the mouse click event
///
/// @arg[in] mouseY is the initial Y position of the mouse click event
///
/// @arg[in] button is the mouse click button (left/right click value)
///
/// @brief The mouse click is called on all widgets on the screen so
/// long as the initial position of the click is within the
/// bounds of the widget box itself. Widgets themselves will need
/// to handle any sub-widgets since the bound check is only
/// there to verify if the event happened ANYWHERE within a
/// widget box
///
/////////////////////////////////////////////////////////////////////////////
@Override
public boolean mouseClicked(double mouseX, double mouseY, int button) {
super.mouseClicked(mouseX, mouseY, button);
for (Entry<Integer, ArrayList<GenericLayerT>> layerEntry : layers.entrySet()) {
var layerList = layerEntry.getValue();
for (var layerListIterator = 0; layerListIterator < layerList.size(); layerListIterator++) {
var layer = layerList.get(layerListIterator);
// Check to make sure scroll is within the context of the widget then deliver information
if (InBounds(layer.startX, layer.startY, layer.endX, layer.endY, (int) mouseX, (int) mouseY)) {
layer.mouseClicked(mouseX, mouseY, button);
}
}
}
return true;
}
/////////////////////////////////////////////////////////////////////////////
/// @fn DrawLayers
///
/// @arg[in] context is the global drawing context for the screen
///
/// @arg[in] delta is passed in from background draw
///
/// @brief This is the primary drawing function so that all the texture
/// draws can be done in one place in this class. We want as
/// little distance as possible between redraws when possible!
///
/// @note Currently the foreground is not drawn in the custom screen
/// manager. This is because the foreground features the general
/// inventory manager that this screen handler is based on and we
/// do not want to see those text pop ups.
/////////////////////////////////////////////////////////////////////////////
public void DrawLayers(DrawContext context, float delta) {
for (Entry<Integer, ArrayList<GenericLayerT>> layerEntry : layers.entrySet()) {
var layerList = layerEntry.getValue();
for (var layerListIterator = 0; layerListIterator < layerList.size(); layerListIterator++) {
var layer = layerList.get(layerListIterator);
System.out.println("Drawing layer " + layerEntry.getKey() + " for class type " + layer.getClass().toString());
layer.DrawLayer(context, layerEntry.getKey());
}
}
}
/////////////////////////////////////////////////////////////////////////////
/// @fn InBounds
///
/// @arg[in] initX is initial position of X axis
///
/// @arg[in] initY is initial position of Y axis
///
/// @arg[in] endX is the end position of X axis
///
/// @arg[in] endY is the end position of Y axis
///
/// @arg[in] x is the current X value we are comparing in the X axis
///
/// @arg[in] y is the current Y value we are comparing in the Y axis
///
/// @brief Checks if an x,y coordinate position falls within the bounds
/// of a bounded box
/////////////////////////////////////////////////////////////////////////////
private boolean InBounds(int initX, int initY, int endX, int endY, int x, int y) {
return (x >= initX && x <= endX) && (y >= initY && y <= endY);
}
/////////////////////////////////////////////////////////////////////////////
/// @fn drawBackground
///
/// @arg[in] context is the drawing context of super class
///
/// @arg[in] delta is the change in background draw
///
/// @arg[in] mouseX is the mouse x-axis position
///
/// @arg[in] mouseY is the mouse y-axis position
///
/// @brief This function is an abstract parent class and must be
/// implemented. This is "hijacked" and just being used as our
/// main drawing method of all the background images. There isn't
/// a huge difference of drawing our stuff in background vs the
/// foreground - except possibly foreground is drawn first.
/////////////////////////////////////////////////////////////////////////////
@Override
protected void drawBackground(DrawContext context, float delta, int mouseX, int mouseY) {
DrawLayers(context, delta);
}
}

View File

@ -0,0 +1,165 @@
/*
*
* TreeWidget
*
* Handles the skill tree widget
*
*
*/
package jesse.keeblarcraft.gui.widgets;
import jesse.keeblarcraft.Keeblarcraft;
import jesse.keeblarcraft.Utils.CommonStructures.Position2d;
import jesse.keeblarcraft.gui.GenericLayerT;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.screen.narration.NarrationMessageBuilder;
import net.minecraft.text.Text;
import net.minecraft.util.Identifier;
public class TreeWidget extends GenericLayerT {
private static Identifier BACKGROUND_TEXTURE = new Identifier(Keeblarcraft.MOD_ID + ":" + "textures/gui/attribute_tree_background.png");
private static int maxHeight = 320;
private static int maxLength = 640;
private int zoomScale = 1;
// private static Identifier FLIGHT_ATTRIBUTE = new Identifier(Keeblarcraft.MOD_ID + ":" + "textures/gui/attribute_flight.png");
///TODO: Make this THE root node in the attribute tree! Rename in future
// private static Identifier EXAMPLE_NODE = new Identifier(Keeblarcraft.MOD_ID + ":" + "textures/gui/attribute_tree_example_node.png"); ///TODO: Make a way to make this programmatic (Proabably extend AbstractNode to carry this var)
/////////////////////////////////////////////////////////////////////////////
/// @fn TreeWidget
///
/// @brief Class constructor for constructing a tree widget. This will
/// be deprecated in a future version but exists for testing
/////////////////////////////////////////////////////////////////////////////
public TreeWidget() {
this(0, 0, 0, 0, Text.of("Test"));
System.out.println("Calling empty tree constructor");
}
/////////////////////////////////////////////////////////////////////////////
/// @fn TreeWidget
///
/// @brief Class constructor for constructing a tree widget
/////////////////////////////////////////////////////////////////////////////
public TreeWidget(int x, int y, int width, int height, Text message) {
super(x, y, width, height, message);
this.startX = x;
this.startY = y;
this.endX = x + width;
this.endY = y + height;
}
/////////////////////////////////////////////////////////////////////////////
/// @fn renderButton
///
/// @param[in] context is the drawing pane
///
/// @param[in] x is the X position to draw at
///
/// @param[in] y is the Y position to draw at
///
/// @param[in] delta is unused in this version
///
/// @brief Primary call to draw the GUI for this widget
/////////////////////////////////////////////////////////////////////////////
@Override
public void renderButton(DrawContext context, int x, int y, float delta) {
context.drawTexture(BACKGROUND_TEXTURE, x, y, 0, 0, maxLength, maxHeight, maxLength, maxHeight);
}
/////////////////////////////////////////////////////////////////////////////
/// @fn appendClickableNarrations
///
/// @param[in] builder is the narration builder. This is pure virtual in
/// the parent but is unused in this widget currently
///
/// @brief Handles the narrator
/////////////////////////////////////////////////////////////////////////////
@Override
protected void appendClickableNarrations(NarrationMessageBuilder builder) {
return;
}
/////////////////////////////////////////////////////////////////////////////
/// @fn mouseClicked
///
/// @param[in] mouseX is where on the x-axis the mouse was clicked
///
/// @param[in] mouseY is where on the y-axis the mouse was clicked
///
/// @param[in] button is the button clicked with (think of a mouse...)
///
/// @brief Handler for mouse click events
/////////////////////////////////////////////////////////////////////////////
@Override
public boolean mouseClicked(double mouseX, double mouseY, int button) {
return true;
}
/////////////////////////////////////////////////////////////////////////////
/// @fn mouseDragged
///
/// @param[in] mouseX is where on the x-axis the mouse was dragged
///
/// @param[in] mouseY is where on the y-axis the mouse was dragged
///
/// @param[in] button is the button dragged with (think of a mouse...)
///
/// @brief Handler for mouse drag events. delta's unused currently
/////////////////////////////////////////////////////////////////////////////
@Override
public boolean mouseDragged(double mouseX, double mouseY, int button, double deltaX, double deltaY) {
boolean ret = false;
if (this.isValidClickButton(button)) {
// Do camera panning magic stuff here
ret = true;
}
return ret;
}
/////////////////////////////////////////////////////////////////////////////
/// @fn mouseDragged
///
/// @param[in] mouseX is where on the x-axis the mouse was dragged
///
/// @param[in] mouseY is where on the y-axis the mouse was dragged
///
/// @param[in] amount represents scroll direction. If the value is negative
/// we scale out. If positive, we scale in
///
/// @brief Handler for mouse scroll events
/////////////////////////////////////////////////////////////////////////////
@Override
public boolean mouseScrolled(double mouseX, double mouseY, double amount) {
// Zooming INWARDS on scroll wheel produces 1.0 (which means zoom in)
// Zooming BACKWARDS on scroll wheel produces -1.0 (which means zoom out)
// We enforce a max scroll of 10 in either direction here
if (amount > 0 && zoomScale <= 10) {
// Zoom in
zoomScale++;
} else if (amount < 0 && zoomScale >= -10) {
// Zoom out
zoomScale--;
}
return true;
}
/////////////////////////////////////////////////////////////////////////////
/// @fn DrawLayer
///
/// @param[in] context is the drawing pane
///
/// @param[in] layer is the layer in which this widget is being drawn in
///
/// @brief This calls renderButton and gives it the valid drawing
/// context to use. This function is called by a ScreenManager<T>
/////////////////////////////////////////////////////////////////////////////
@Override
public void DrawLayer(DrawContext context, int layer) {
Position2d pos = GetScreenCenter();
this.renderButton(context, pos.x - (maxLength / 2), pos.y - (maxHeight / 2), 0);
}
}

View File

@ -1,15 +0,0 @@
package jesse.keeblarcraft.mixin.client;
import net.minecraft.client.MinecraftClient;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(MinecraftClient.class)
public class ExampleClientMixin {
@Inject(at = @At("HEAD"), method = "run")
private void init(CallbackInfo info) {
// This code is injected into the start of MinecraftClient.run()V
}
}

View File

@ -1,11 +0,0 @@
{
"required": true,
"package": "jesse.keeblarcraft.mixin.client",
"compatibilityLevel": "JAVA_21",
"client": [
"ExampleClientMixin"
],
"injectors": {
"defaultRequire": 1
}
}

View File

@ -25,11 +25,11 @@ public class MetalJacketArmor implements ArmorMaterial {
System.out.println("durability for armor called");
// Replace this multiplier by a constant value for the durability of the armor.
// For reference, diamond uses 33 for all armor pieces, whilst leather uses 5.
return switch (type) {
case ArmorItem.Type.BOOTS -> Integer.MAX_VALUE;
case ArmorItem.Type.LEGGINGS -> Integer.MAX_VALUE;
case ArmorItem.Type.CHESTPLATE -> Integer.MAX_VALUE;
case ArmorItem.Type.HELMET -> Integer.MAX_VALUE;
return switch (type) { // All from ArmorItem.Type
case BOOTS -> Integer.MAX_VALUE;
case LEGGINGS -> Integer.MAX_VALUE;
case CHESTPLATE -> Integer.MAX_VALUE;
case HELMET -> Integer.MAX_VALUE;
};
}
@ -40,10 +40,10 @@ public class MetalJacketArmor implements ArmorMaterial {
// For reference, diamond uses 3 for boots, 6 for leggings, 8 for chestplate, and 3 for helmet,
// whilst leather uses 1, 2, 3 and 1 respectively.
return switch (type) {
case ArmorItem.Type.BOOTS -> defaultArmorModifier;
case ArmorItem.Type.HELMET -> defaultArmorModifier;
case ArmorItem.Type.LEGGINGS -> defaultArmorModifier;
case ArmorItem.Type.CHESTPLATE -> defaultArmorModifier;
case BOOTS -> defaultArmorModifier;
case HELMET -> defaultArmorModifier;
case LEGGINGS -> defaultArmorModifier;
case CHESTPLATE -> defaultArmorModifier;
};
}

View File

@ -22,6 +22,8 @@ public class AttributeMgr {
ConfigManager config;
// Global list of attributes
// Key: node title
// Val: The node class itself
public static final HashMap<String, Class<? extends AbstractNode>> attributes = new HashMap<String, Class<? extends AbstractNode>>();
// This is a list of all logged in player tree's. These are kept in memory until either the mod is torn down or
@ -108,6 +110,7 @@ public class AttributeMgr {
public static void RegisterAttributes() {
// Manually register all attribute node classes here
/// TODO: Find a better way to do this more dynamically in the future
/// hint: make it an API for other modders to add to
RegisterAttributeClass(AttributeFlight.class);
RegisterAttributeClass(AttributeMetalJacket.class);

View File

@ -13,7 +13,6 @@ import java.util.HashMap;
import java.util.List;
abstract public class AbstractNode {
/////////////////////////////////////////////////////////////////////////////
/// @fn GetNodeTitle
///

View File

@ -13,7 +13,7 @@ import net.minecraft.server.PlayerManager;
import net.minecraft.server.network.ServerPlayerEntity;
public class BankManager {
BankManagerFile bankInfo = new BankManagerFile();
BankManagerFile bankInfo = new BankManagerFile(); // not sure why we make another one but i guess so we
ConfigManager config = new ConfigManager(); // for read and write privs
CommonServerUtils commonServerUtils = new CommonServerUtils();
@ -97,111 +97,154 @@ public class BankManager {
}
return ret;
}
//https://maven.fabricmc.net/docs/fabric-api-0.34.8+1.17/net/fabricmc/fabric/api/networking/v1/PlayerLookup.html maybe this for getting the players im still not sure
public void SetBalance(Integer newBalance, String reason, String otherParty) {
Integer transactionNumber = bankInfo.bank.size();
bankInfo.bank.put(transactionNumber.toString(),
new BankManagerMetaData(newBalance, reason, newBalance, otherParty, 0));
public void SetBalance(long payment, String reason, ServerPlayerEntity otherParty) {
bankInfo.uuid = otherParty.getUuidAsString();
bankInfo.bank.put(bankInfo.uuid, new BankManagerMetaData(payment, reason, payment, "SERVER", 0));
FlashConfig(bankInfo.uuid);
FlashConfig(PlayerListNameChecker(otherParty));
}
public void AddMoney(ServerPlayerEntity otherParty, long payment, ServerPlayerEntity player, String reason) {
bankInfo.uuid = otherParty.getUuidAsString();
bankInfo.bank = DoesBankAccountExist(otherParty);
public void AddMoney(String reason, long payment, String otherParty) {
if (bankInfo.bank.size() > 0) {
for (Entry<String, BankManagerMetaData> entry : bankInfo.bank.entrySet()) {
entry.getValue().balance += payment;
entry.getValue().reason = "SERVER: " + reason;
entry.getValue().payment = payment;
entry.getValue().otherParty = "SERVER";
entry.getValue().otherParty = otherParty;
entry.getValue().time = 0;
}
} else {
bankInfo.bank.put(bankInfo.uuid, new BankManagerMetaData(payment, reason, payment, "SERVER", 0));
bankInfo.bank.put(bankInfo.uuid, new BankManagerMetaData(payment, reason, payment, otherParty, 0));
}
FlashConfig(otherParty.getUuidAsString());
FlashConfig(PlayerListNameChecker(otherParty));
}
public void SubtractBalance(String reason, long payment, ServerPlayerEntity otherParty) {
bankInfo.uuid = otherParty.getUuidAsString();
bankInfo.bank = DoesBankAccountExist(otherParty);
public void SubtractBalance(String reason, long payment, String otherParty) {
if (bankInfo.bank.size() > 0) {
for (Entry<String, BankManagerMetaData> entry : bankInfo.bank.entrySet()) {
entry.getValue().balance -= payment;//not working?
entry.getValue().reason = "SERVER: " + reason;
entry.getValue().payment = payment;
entry.getValue().otherParty = "SERVER";
entry.getValue().otherParty = otherParty;
entry.getValue().time = 0;
}
FlashConfig(bankInfo.uuid);
} else {
bankInfo.bank.put(bankInfo.uuid, new BankManagerMetaData(0, reason, payment, otherParty, 0));
}
public void Wire(ServerPlayerEntity otherParty, long payment, String reason, ServerPlayerEntity sender) {
FlashConfig(PlayerListNameChecker(otherParty));
}
BankManagerFile sendersBankInfo = new BankManagerFile();
BankManagerFile otherPartyBankInfo = new BankManagerFile();
sendersBankInfo.uuid = sender.getUuidAsString();
otherPartyBankInfo.uuid = otherParty.getUuidAsString();
sendersBankInfo.bank = DoesBankAccountExist(sender);
otherPartyBankInfo.bank = DoesBankAccountExist(otherParty);
//check to make sure they can afford to send the money
for (Entry<String, BankManagerMetaData> entry : sendersBankInfo.bank.entrySet()) {
if (entry.getValue().balance > payment) {
public void Wire(String reason, long payment, String otherParty) {
if (bankInfo.bank.size() > 0) {
for (Entry<String, BankManagerMetaData> entry : bankInfo.bank.entrySet()) {
entry.getValue().balance -= payment;
entry.getValue().reason = reason;
entry.getValue().payment = payment;
entry.getValue().otherParty = otherParty.getUuidAsString();
entry.getValue().otherParty = otherParty;
entry.getValue().time = 0;
} else {
System.out.println(ChatUtil.ColoredString("You ain't the goverment: " + otherParty, CONSOLE_COLOR.RED));
if (payment <= 0) {
// add a error for the PLAYER not the server
return;
}
}
for (Entry<String, BankManagerMetaData> entry : otherPartyBankInfo.bank.entrySet()) {
entry.getValue().balance += payment;
entry.getValue().reason = reason;
entry.getValue().payment = payment;
entry.getValue().otherParty = otherParty.getUuidAsString();
entry.getValue().time = 0;
}
//needs to be inside the player check flash config has a write check
FlashConfig(otherPartyBankInfo.uuid);
FlashConfig(sendersBankInfo.uuid);
}
public HashMap<String, BankManagerMetaData> DoesBankAccountExist(ServerPlayerEntity otherParty) {
Boolean existingFile = false;
try {
bankInfo.uuid = otherParty.getUuidAsString();
bankInfo = config.GetJsonObjectFromFile("bank/" + otherParty.getUuidAsString() + ".json", BankManagerFile.class);
existingFile = true;
} catch (Exception e) {
// Do nothing. This means the file does not exist
}
if (!existingFile) {
System.out.println("Procced no account exisiting");
// make a server instance
MinecraftServer server = CommonServerUtils.GetServerInstance();
String[] playerList = server.getPlayerNames();
//NOT SURE IF THIS FOR LOOP IS ONE OFF COULD POSSIBLEY BE SO IF NO ONE IS GETTING MONEY DOUBLE CHECK FOR LOOP
for (int i = 0; i < playerList.length; i++) {
System.out.println(ChatUtil.ColoredString("PLAYERS: " + playerList, CONSOLE_COLOR.YELLOW));
if (playerList[i] == otherParty) {
System.out.println(ChatUtil.ColoredString("Found Player: " + otherParty, CONSOLE_COLOR.GREEN));
// we will use getuuidbyname then set the other VALID players bank BE SURE TO
// MAKE THEM A BANK FIRST IF THEY DONT HAVE ONE fortnite forever
if (config.GetFile("bank/" + GetUuidByName(server, otherParty) + ".json").size() < 1) {
BankManagerFile newBankInfo = new BankManagerFile();
BankManagerMetaData newBank = new BankManagerMetaData(0, "Account Created", 0, "Server", 0);
newBankInfo.uuid = otherParty.getUuidAsString();
newBankInfo.bank.put(newBankInfo.uuid, newBank);
newBankInfo.bank.put(GetUuidByName(server, otherParty).toString(), newBank);
try {
config.WriteToJsonFile("bank/" + newBankInfo.uuid + ".json", newBankInfo);
} catch (FILE_WRITE_EXCEPTION e) {
System.out.println(ChatUtil.ColoredString("Could not flash notes configuration file", CONSOLE_COLOR.RED));
return newBankInfo.bank;
return;
}
return newBankInfo.bank;
} else {
}
//since the other player has a account now and we have access to it we can start fucking around
BankManagerFile newBankInfo = new BankManagerFile();
newBankInfo = config.GetJsonObjectFromFile("bank/" + GetUuidByName(server, otherParty) + ".json", BankManagerFile.class);
// for now we will only use adding valance and not subtracting since that dosent make any sense
for (Entry<String, BankManagerMetaData> entry : newBankInfo.bank.entrySet()) {
entry.getValue().balance += payment;
entry.getValue().reason = reason;
entry.getValue().payment = payment;
entry.getValue().otherParty = otherParty;
entry.getValue().time = 0;
}
//cannot use regular flash config since the hard coded values need to add agurment for the uuid
//needs to be inside the player check
FlashConfig(newBankInfo.uuid);
try {
bankInfo = config.GetJsonObjectFromFile("bank/" + bankInfo.uuid + ".json", BankManagerFile.class);
} catch (Exception e) {
// Do nothing. This means the file does not exist
System.out.println("How did this fail Function: DoesBankAccountExist try catch statement -first if failed incorrectly");
config.WriteToJsonFile("bank/" + newBankInfo.uuid + ".json", bankInfo);
} catch (FILE_WRITE_EXCEPTION e) {
System.out.println(ChatUtil.ColoredString("Could not flash notes configuration file", CONSOLE_COLOR.RED));
}
return bankInfo.bank;
} else {
System.out.println(ChatUtil.ColoredString("Player Not Found: " + otherParty, CONSOLE_COLOR.RED));
return;
}
}
} else {
System.out.println(ChatUtil.ColoredString("You need to finance better", CONSOLE_COLOR.RED));
return;
}
}
String GetUuidByName(MinecraftServer server, String playerName) {
PlayerManager playerManager = server.getPlayerManager();
ServerPlayerEntity player = playerManager.getPlayer(playerName);
if (player.getUuid() != null) {
return player.getUuidAsString();
} else {
return "";
}
}
String PlayerListNameChecker(String otherParty) {
MinecraftServer server = CommonServerUtils.GetServerInstance();
String[] playerList = server.getPlayerNames();
for (int i = 0; i < playerList.length; i++) {
System.out.println(ChatUtil.ColoredString("PLAYERS: " + playerList, CONSOLE_COLOR.YELLOW));
if (playerList[i] == otherParty) {
System.out.println(ChatUtil.ColoredString("Found Player: " + otherParty, CONSOLE_COLOR.GREEN));
// we will use getuuidbyname then set the other VALID players bank BE SURE TO
// MAKE THEM A BANK FIRST IF THEY DONT HAVE ONE fortnite forever
if (config.GetFile("bank/" + GetUuidByName(server, otherParty) + ".json").size() < 1) {
BankManagerFile newBankInfo = new BankManagerFile();
BankManagerMetaData newBank = new BankManagerMetaData(0, "Account Created", 0, "Server", 0);
newBankInfo.bank.put(GetUuidByName(server, otherParty).toString(), newBank);
try {
config.WriteToJsonFile("bank/" + newBankInfo.uuid + ".json", newBankInfo);
} catch (FILE_WRITE_EXCEPTION e) {
System.out.println(ChatUtil.ColoredString("Could not flash notes configuration file", CONSOLE_COLOR.RED));
return "";
}
}
else {
System.out.println(ChatUtil.ColoredString("Bank Account Found", CONSOLE_COLOR.GREEN));
}
return GetUuidByName(server, otherParty);
}
}
System.out.println(ChatUtil.ColoredString("For Loop condition bypassed Null Playerlist or Null Server instance", CONSOLE_COLOR.RED));
return "";
}
public void FlashConfig(String uuid) {
try {

View File

@ -0,0 +1,5 @@
package jesse.keeblarcraft.CCTweakedExtension;
public class CCTweakedTest {
}

View File

@ -71,7 +71,6 @@ public class AttributeCommands {
playerArgAdd.addChild(attributeNameAdd);
playerArgRemove.addChild(attributeNameDelete);
});
}
public int ApplyAttribute(ServerPlayerEntity targetPlayer, String attributeName, CommandContext<ServerCommandSource> context) {
@ -80,8 +79,7 @@ public class AttributeCommands {
System.out.println("Applying attribute");
if (context.getSource().isExecutedByPlayer()) {
System.out.println("Executed by player");
// String result = AttributeMgr.ApplyAttribute(targetPlayer.getUuidAsString(), attributeName);
String result = AttributeMgr.ApplyAttribute(context.getSource().getPlayer().getUuidAsString(), attributeName);
String result = AttributeMgr.ApplyAttribute(targetPlayer.getUuidAsString(), attributeName);
Keeblarcraft.LOGGER.info("[ApplyAttribute] -> " + result);
context.getSource().getPlayer().sendMessage(Text.of(result));
ret = 0;

View File

@ -7,7 +7,6 @@ import com.mojang.brigadier.context.CommandContext;
import jesse.keeblarcraft.BankMgr.BankManager;
import jesse.keeblarcraft.ConfigMgr.ConfigManager;
import net.minecraft.command.argument.EntityArgumentType;
import net.minecraft.server.command.CommandManager;
import net.minecraft.server.command.ServerCommandSource;
import net.minecraft.server.network.ServerPlayerEntity;
@ -18,94 +17,68 @@ public class BankCommands {
ConfigManager config = new ConfigManager();
public void RegisterCommands(){
// Command: "/getbalance"
CommandRegistrationCallback.EVENT.register((dispatcher, registryAccess, environment) -> {
var rootBank = CommandManager.literal("bank").build();
dispatcher.register(CommandManager.literal("getbalance")
.executes(context -> GetBalance(context)));
});
//second layer of tree
var balance = CommandManager.literal("balance").build();
var wire = CommandManager.literal("wire").build();
//third layer of tree
var setBalance = CommandManager.literal("setBalance").build();
var getBalance = CommandManager.literal("getBalance").build();
var addMoney = CommandManager.literal("addMoney").build();
var subtractBalance = CommandManager.literal("subtractBalance").build();
var playerArgAdd = CommandManager.argument("otherParty", EntityArgumentType.player()).build();
var paymentArg = CommandManager.argument("payment", LongArgumentType.longArg()).build();
var wireFunction = CommandManager.argument("reason", StringArgumentType.greedyString())
.executes(context -> Wire
(
EntityArgumentType.getPlayer(context, "otherParty"),
LongArgumentType.getLong(context, "payment"),
// Command: "/setbalance || rootSetBalance"
CommandRegistrationCallback.EVENT.register((dispatcher, registryAccess, environment) -> {
final var rootSetBalance = dispatcher.register(CommandManager.literal("setbalance")
.then(CommandManager.argument("newBalance", IntegerArgumentType.integer())
.then(CommandManager.argument("reason", StringArgumentType.string())
.then(CommandManager.argument("otherParty", StringArgumentType.string())
.executes(context -> SetBalance(
IntegerArgumentType.getInteger(context, "newBalance"),
StringArgumentType.getString(context, "reason"),
context)
)
.build();
StringArgumentType.getString(context, "otherParty"),
context))))));
var setBalanceFunction = CommandManager.argument("reason", StringArgumentType.greedyString())
.executes(context -> SetBalance
(
EntityArgumentType.getPlayer(context, "otherParty"),
LongArgumentType.getLong(context, "payment"),
dispatcher.register(CommandManager.literal("setbalance").redirect(rootSetBalance));
});
// Command: "/AddMoney"
CommandRegistrationCallback.EVENT.register((dispatcher, registryAccess, environment) -> {
dispatcher.register(CommandManager.literal("AddMoney")
.then(CommandManager.argument("reason", StringArgumentType.string())
.then(CommandManager.argument("payment", LongArgumentType.longArg())
.then(CommandManager.argument("otherParty", StringArgumentType.string())
.executes(context -> AddMoney(
StringArgumentType.getString(context, "reason"),
context)
)
.build();
var addMoneyFunction = CommandManager.argument("reason", StringArgumentType.greedyString())
.executes(context -> AddMoney
(
EntityArgumentType.getPlayer(context, "otherParty"),
LongArgumentType.getLong(context, "payment"),
StringArgumentType.getString(context, "reason"),
context)
)
.build();
StringArgumentType.getString(context, "otherParty"),
context))))));
});
var subtractMoneyFunction = CommandManager.argument("reason", StringArgumentType.greedyString())
.executes(context -> SubtractBalance
(
EntityArgumentType.getPlayer(context, "otherParty"),
// Command: "/subtractbalance || /SubtractBalance"
CommandRegistrationCallback.EVENT.register((dispatcher, registryAccess, environment) -> {
final var SubtractBalance = dispatcher.register(CommandManager.literal("subtractbalance")
.then(CommandManager.argument("reason", StringArgumentType.string())
.then(CommandManager.argument("payment", LongArgumentType.longArg())
.then(CommandManager.argument("otherParty", StringArgumentType.string())
.executes(context -> SubtractBalance(
StringArgumentType.getString(context, "reason"),
LongArgumentType.getLong(context, "payment"),
StringArgumentType.getString(context, "otherParty"),
context))))));
dispatcher.register(CommandManager.literal("subtractbalance").redirect(SubtractBalance));
});
// Command: "/wire || /sendmoney"
CommandRegistrationCallback.EVENT.register((dispatcher, registryAccess, environment) -> {
final var sendmoney = dispatcher.register(CommandManager.literal("wire")
.then(CommandManager.argument("reason", StringArgumentType.string())
.then(CommandManager.argument("payment", LongArgumentType.longArg())
.then(CommandManager.argument("otherParty", StringArgumentType.string())
.executes(context -> Wire(
StringArgumentType.getString(context, "reason"),
context)
)
.build();
LongArgumentType.getLong(context, "payment"),
StringArgumentType.getString(context, "otherParty"),
context))))));
// Build out the argument tree here
dispatcher.getRoot().addChild(rootBank);
rootBank.addChild(wire);
rootBank.addChild(balance);
// Subcommands of balance node "/getbalance", [ADMIN->] "/setbalance", "/subtractbalance", "/addmoney"
balance.addChild(getBalance);
balance.addChild(setBalance);
balance.addChild(subtractBalance);
balance.addChild(addMoney);
//subcommands of wire node "/playernamehere"
wire.addChild(playerArgAdd);
playerArgAdd.addChild(paymentArg);
paymentArg.addChild(wireFunction);
//subcommands of setBalance
setBalance.addChild(playerArgAdd);
playerArgAdd.addChild(paymentArg);
paymentArg.addChild(setBalanceFunction);
//subcommands of addMoney
addMoney.addChild(playerArgAdd);
playerArgAdd.addChild(paymentArg);
paymentArg.addChild(addMoneyFunction);
//subcommands for subtractbalance
subtractBalance.addChild(playerArgAdd);
playerArgAdd.addChild(paymentArg);
paymentArg.addChild(subtractMoneyFunction);
dispatcher.register(CommandManager.literal("wire").redirect(sendmoney));
});
}
@ -123,27 +96,28 @@ public class BankCommands {
}
//SetBalance will be a ServerCommand only Perm level Op
public Integer SetBalance(ServerPlayerEntity otherParty, long payment, String reason, CommandContext<ServerCommandSource> context) {
public Integer SetBalance(Integer newBalance, String reason, String otherParty, CommandContext<ServerCommandSource> context) {
Integer ret = -1;
if (context.getSource().hasPermissionLevel(1)) {
BankManager playerBank = new BankManager(otherParty.getUuidAsString());
System.out.println("UUID TEST IN COMMANDS " + otherParty.getUuidAsString());
playerBank.SetBalance(payment, reason, otherParty);
ret = 0;
ServerPlayerEntity player = context.getSource().getPlayer();
BankManager playerBank = new BankManager(player.getUuidAsString());
playerBank.SetBalance(newBalance, reason, otherParty);
player.sendMessage(Text.literal(String.valueOf(playerBank.GetBalance())));
}
return ret;
}
//AddMoney will be a ServerCommand Only Perm level Op
public Integer AddMoney(ServerPlayerEntity otherParty, long payment, String reason, CommandContext<ServerCommandSource> context) {
public Integer AddMoney(String reason, long payment, String otherParty, CommandContext<ServerCommandSource> context) {
Integer ret = -1;
if (context.getSource().hasPermissionLevel(1)) {
ret = 0;
ServerPlayerEntity player = context.getSource().getPlayer();
BankManager playerBank = new BankManager(player.getUuidAsString());
playerBank.AddMoney(otherParty, payment, player, reason);
playerBank.AddMoney(reason, payment, otherParty);
player.sendMessage(Text.literal(String.valueOf(playerBank.GetBalance())));
}
@ -151,34 +125,31 @@ public class BankCommands {
}
//SubtractBalance will be a ServerCommand Perm leve Op
public Integer SubtractBalance(ServerPlayerEntity otherParty, long payment, String reason, CommandContext<ServerCommandSource> context) {
public Integer SubtractBalance(String reason, long payment, String otherParty, CommandContext<ServerCommandSource> context) {
Integer ret = -1;
if (context.getSource().hasPermissionLevel(1)) {
BankManager playerBank = new BankManager(otherParty.getUuidAsString());
playerBank.SubtractBalance(reason, payment, otherParty);
otherParty.sendMessage(Text.literal(String.valueOf(playerBank.GetBalance())));
ret = 0;
ServerPlayerEntity player = context.getSource().getPlayer();
BankManager playerBank = new BankManager(player.getUuidAsString());
playerBank.SubtractBalance(reason, payment, otherParty);
player.sendMessage(Text.literal(String.valueOf(playerBank.GetBalance())));
}
return ret;
}
public Integer Wire(ServerPlayerEntity otherParty, long payment, String reason, CommandContext<ServerCommandSource> context) {
public Integer Wire(String reason, long payment, String otherParty, CommandContext<ServerCommandSource> context) {
Integer ret = -1;
if (context.getSource().isExecutedByPlayer()) {
ServerPlayerEntity sender = context.getSource().getPlayer();
BankManager playerBank = new BankManager(sender.getUuidAsString());
if (sender.getUuidAsString() == otherParty.getUuidAsString()) {
sender.sendMessage(Text.of("you aint congress"));
return -1;
}
playerBank.Wire(otherParty, payment, reason, sender);
sender.sendMessage(Text.literal(String.valueOf(playerBank.GetBalance())));
ret = 0;
ServerPlayerEntity player = context.getSource().getPlayer();
BankManager playerBank = new BankManager(player.getUuidAsString());
playerBank.Wire(reason, payment, otherParty);
player.sendMessage(Text.literal(String.valueOf(playerBank.GetBalance())));
}
return ret;
}
}

View File

@ -19,6 +19,7 @@ import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback;
import net.minecraft.entity.player.PlayerAbilities;
import net.minecraft.server.command.CommandManager;
import net.minecraft.server.command.ServerCommandSource;
import net.minecraft.server.command.TimeCommand;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.text.Text;
@ -64,6 +65,20 @@ public class ShortcutCommands {
return 0;
}));
});
CommandRegistrationCallback.EVENT.register((dispatcher, registryAccess, environment) -> {
dispatcher.register(CommandManager.literal("day")
.executes(context -> { DayShortcut(context);
return 0;
}));
});
CommandRegistrationCallback.EVENT.register((dispatcher, registryAccess, environment) -> {
dispatcher.register(CommandManager.literal("night")
.executes(context -> { NightShortcut(context);
return 0;
}));
});
}
/// Command handlers below
@ -210,4 +225,35 @@ public class ShortcutCommands {
return retValue;
}
private int DayShortcut(CommandContext<ServerCommandSource> context) {
int retValue = -1;
if (context.getSource().isExecutedByPlayer()) {
ServerPlayerEntity player = context.getSource().getPlayer();
if (player.hasPermissionLevel(4)) {
retValue=0;
TimeCommand.executeSet(context.getSource(), retValue);
} else {
player.sendMessage(Text.literal("You do not have permission for this command"));
}
}
return retValue;
}
private int NightShortcut(CommandContext<ServerCommandSource> context) {
int retValue = -1;
if (context.getSource().isExecutedByPlayer()) {
ServerPlayerEntity player = context.getSource().getPlayer();
if (player.hasPermissionLevel(4)) {
retValue=13000;
TimeCommand.executeSet(context.getSource(), retValue);
} else {
player.sendMessage(Text.literal("You do not have permission for this command"));
}
}
return retValue;
}
}

View File

@ -171,15 +171,11 @@ public class ConfigManager {
}
public Boolean DoesFileExist(String fileName) {
Boolean ret = false;
return ret;
return new File(fileName).exists(); // untested
}
public Boolean DoesDirectoryExist(String dirName) {
Boolean ret = false;
return ret;
return new File(dirName).isDirectory(); // untested
}
public Boolean CreateDirectory(String dirName) throws DIRECTORY_CREATE_EXCEPTION {

View File

@ -0,0 +1,24 @@
package jesse.keeblarcraft.CustomBlocks;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.block.AbstractBlock;
import net.minecraft.block.Block;
import net.minecraft.block.Blocks;
import net.minecraft.block.ExperienceDroppingBlock;
import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.util.math.intprovider.UniformIntProvider;
// Put all your blocks here
public class BlockList {
/////////////////////////////////////////////////////////////////////////////
/// @fn RegisterBlocks
///
/// @brief This function is called by the main thread to register all
/// block objects. Please register your blocks here
/////////////////////////////////////////////////////////////////////////////
public static void RegisterBlocks() {
BlockManager.RegisterBlock("example_block_ore", new Block(FabricBlockSettings.copyOf(Blocks.IRON_BLOCK).sounds(BlockSoundGroup.AMETHYST_BLOCK).requiresTool().breakInstantly()));
BlockManager.RegisterBlock("example_block", new ExperienceDroppingBlock(FabricBlockSettings.copyOf(Blocks.IRON_BLOCK).sounds(BlockSoundGroup.ANCIENT_DEBRIS).requiresTool(), UniformIntProvider.create(4, 20)));
BlockManager.RegisterBlock("example_statue", new Block(FabricBlockSettings.copyOf(Blocks.BELL)));
}
}

View File

@ -9,28 +9,23 @@
package jesse.keeblarcraft.CustomBlocks;
import java.util.ArrayList;
import java.util.List;
import java.util.HashMap;
import jesse.keeblarcraft.Keeblarcraft;
import net.fabricmc.fabric.api.item.v1.FabricItemSettings;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.block.Block;
import net.minecraft.block.Blocks;
import net.minecraft.block.ExperienceDroppingBlock;
import net.minecraft.item.BlockItem;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.intprovider.UniformIntProvider;
public class BlockManager {
/// The block list. DO NOT ADD TO THE LIST YOURSELF. USE
/// THE RegisterBlock(...) FUNCTION OTHERWISE YOUR BLOCK WILL
/// NOT BE REGISTERED PROPERLY AND MAY BREAK THE GAME
public static final List<Block> blockList = new ArrayList<Block>();
// public static final List<Block> blockList = new ArrayList<Block>();
public static final HashMap<String, Block> blockList = new HashMap<String, Block>();
/////////////////////////////////////////////////////////////////////////////
/// @fn RegisterBlock
@ -56,24 +51,18 @@ public class BlockManager {
Block newBlock = Registry.register(Registries.BLOCK, new Identifier(Keeblarcraft.MOD_ID, name), block);
// Add the block to the block list
blockList.add(newBlock);
blockList.put(name, newBlock);
}
/////////////////////////////////////////////////////////////////////////////
/// @fn RegisterBlocks
/// @fn GetBlock
///
/// @brief This function is only meant to be called by the main mod
/// execution path and should only be called once. This is a
/// glorified print statement - but also serves to add the
/// example block in the game
/// @brief Gets a block from the block list by name
///
/// @return Returns a block from the blockList object if name is found,
/// will return null if not found
/////////////////////////////////////////////////////////////////////////////
public static void RegisterBlocks() {
Keeblarcraft.LOGGER.info("Registering modded blocks for " + Keeblarcraft.MOD_ID);
// Register example block to the mod
Block exampleBlock = new Block(FabricBlockSettings.copyOf(Blocks.IRON_BLOCK).sounds(BlockSoundGroup.AMETHYST_BLOCK).requiresTool().breakInstantly());
Block exampleBlockOre = new ExperienceDroppingBlock(FabricBlockSettings.copyOf(Blocks.IRON_BLOCK).sounds(BlockSoundGroup.ANCIENT_DEBRIS).requiresTool(), UniformIntProvider.create(4, 20));
RegisterBlock("example_block_ore", exampleBlockOre);
RegisterBlock("example_block", exampleBlock);
public static Block GetBlock(String name) {
return blockList.get(name);
}
}

View File

@ -1,8 +1,11 @@
package jesse.keeblarcraft.CustomItems;
import java.util.Map.Entry;
import jesse.keeblarcraft.Keeblarcraft;
import jesse.keeblarcraft.CustomBlocks.BlockManager;
import net.fabricmc.fabric.api.itemgroup.v1.FabricItemGroup;
import net.minecraft.block.Block;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
@ -24,8 +27,8 @@ public class CustomItemGroups {
}
// We iterate through all the modded blocks and add them to the custom block group here
for (int i = 0; i < BlockManager.blockList.size(); i++) {
entries.add(BlockManager.blockList.get(i));
for(Entry<String, Block> blocks : BlockManager.blockList.entrySet()) {
entries.add(blocks.getValue());
}
}).build());

View File

@ -14,7 +14,6 @@ import java.util.ArrayList;
import java.util.List;
import jesse.keeblarcraft.Keeblarcraft;
import net.fabricmc.fabric.api.item.v1.FabricItemSettings;
import net.minecraft.item.Item;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;

View File

@ -1,13 +0,0 @@
/*
*
* GuiMgr
*
* Handles everything related to in-game gui environments
*
*/
package jesse.keeblarcraft.GuiMgr;
public class GuiMgr {
}

View File

@ -0,0 +1,86 @@
package jesse.keeblarcraft.GuiMgr;
import jesse.keeblarcraft.Keeblarcraft;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.Inventory;
import net.minecraft.inventory.SimpleInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.screen.ScreenHandler;
// Server side screen handler for the attribute tree
public class TreeHandler extends ScreenHandler {
/////////////////////////////////////////////////////////////////////////////
/// @fn TreeHandler
///
/// @arg[in] syncId is SUPPOSED to be some sync identifier between the
/// server and client. This isn't being used yet, so there isn't
/// enough knowledge to make a good documentation note on it.
/// Coming soon!
///
/// @arg[in] inventory is the players inventory. Required by HandledScreen
/// object however is unused currently so we make the size 0. As
/// needs and use-cases change; this may be reworked in the future
///
/// @brief Class constructor
/////////////////////////////////////////////////////////////////////////////
public TreeHandler(int syncId, PlayerInventory inventory) {
// Call the constructor below
this(syncId, inventory, new SimpleInventory(0));
}
/////////////////////////////////////////////////////////////////////////////
/// @fn TreeHandler
///
/// @arg[in] syncId is SUPPOSED to be some sync identifier between the
/// server and client. This isn't being used yet, so there isn't
/// enough knowledge to make a good documentation note on it.
/// Coming soon!
///
/// @arg[in] inventory is the players inventory. Required by HandledScreen
/// object however is unused currently so we make the size 0. As
/// needs and use-cases change; this may be reworked in the future
///
/// @arg[in] inventory is the SERVER's inventory - which is what syncId
/// would likely be useful for. Once I (Jesse) get the screen stuff
/// more sorted out - a more useful doxygen comment will be applied
/// here in this class. Coming soon!
///
/// @brief Class constructor
/////////////////////////////////////////////////////////////////////////////
public TreeHandler(int syncId, PlayerInventory playerInventory, Inventory inventory) {
super(Keeblarcraft.TREE_HANDLER, syncId);
System.out.println("Created tree handler");
System.out.println("Is static var null? " + Keeblarcraft.TREE_HANDLER == null ? "YES":"NO");
}
/////////////////////////////////////////////////////////////////////////////
/// @fn quickMove
///
/// @arg[in] player is the player entity moving an item
///
/// @arg[in] slot is the inventory slot to quick move to (shift+click)
///
/// @brief Required by parent class; currently do nothing as we aren't
/// using inventories in the gui's!
/////////////////////////////////////////////////////////////////////////////
@Override
public ItemStack quickMove(PlayerEntity player, int slot) {
return ItemStack.EMPTY;
}
/////////////////////////////////////////////////////////////////////////////
/// @fn canUse
///
/// @arg[in] player is the player entity moving an item
///
/// @brief Returns whether the screen handler can be used. Required by
/// parent class as its abstract; but for now players can always
/// use GUI's and need no confirmation!
/////////////////////////////////////////////////////////////////////////////
@Override
public boolean canUse(PlayerEntity player) {
return true;
}
}

View File

@ -12,8 +12,12 @@
package jesse.keeblarcraft;
import net.fabricmc.api.ModInitializer;
// import net.minecraft.server.command.ServerCommandSource;
import net.fabricmc.fabric.api.networking.v1.ServerPlayConnectionEvents;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.resource.featuretoggle.FeatureSet;
import net.minecraft.screen.ScreenHandlerType;
import net.minecraft.util.Identifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -21,9 +25,10 @@ import org.slf4j.LoggerFactory;
import jesse.keeblarcraft.AttributeMgr.AttributeMgr;
import jesse.keeblarcraft.AttributeMgr.AttributeTree;
import jesse.keeblarcraft.Commands.CustomCommandManager;
import jesse.keeblarcraft.CustomBlocks.BlockManager;
import jesse.keeblarcraft.CustomBlocks.BlockList;
import jesse.keeblarcraft.CustomItems.ItemManager;
import jesse.keeblarcraft.EventMgr.ServerTickListener;
import jesse.keeblarcraft.GuiMgr.TreeHandler;
import jesse.keeblarcraft.Utils.CustomExceptions.SETUP_FAILED_EXCEPTION;
import jesse.keeblarcraft.Utils.ChatUtil;
import jesse.keeblarcraft.Utils.Setup;
@ -32,8 +37,14 @@ import jesse.keeblarcraft.Utils.ChatUtil.CONSOLE_COLOR;
public class Keeblarcraft implements ModInitializer {
public static String MOD_ID = "keeblarcraft";
public static final Logger LOGGER = LoggerFactory.getLogger("keeblarcraft");
CustomCommandManager cmdMgr = new CustomCommandManager();
// May be moved in future; but is the universal TREE_HANDLER call for at least the tree gui. It's possible it can get a more
// generic name in the future after the tree gui is done; however until then it will remain TREE_HANDLER.
public static final ScreenHandlerType<TreeHandler> TREE_HANDLER = Registry.register(Registries.SCREEN_HANDLER,
Identifier.of(Keeblarcraft.MOD_ID, "tree_gui"),
new ScreenHandlerType<>(TreeHandler::new, FeatureSet.empty()));
CustomCommandManager cmdMgr = new CustomCommandManager();
Setup setup = Setup.GetInstance();
@Override
@ -85,7 +96,7 @@ public class Keeblarcraft implements ModInitializer {
ItemManager.RegisterAllItems();
// Register blocks
BlockManager.RegisterBlocks();
BlockList.RegisterBlocks();
} catch (SETUP_FAILED_EXCEPTION e) {

View File

@ -24,22 +24,22 @@ public class ChatUtil {
public static String getColor(CONSOLE_COLOR color) {
String ret = "";
switch(color) {
case CONSOLE_COLOR.RED:
case RED:
ret = "31";
break;
case CONSOLE_COLOR.GREEN:
case GREEN:
ret = "32";
break;
case CONSOLE_COLOR.YELLOW:
case YELLOW:
ret = "33";
break;
case CONSOLE_COLOR.BLUE:
case BLUE:
ret = "34";
break;
case CONSOLE_COLOR.MAGENTA:
case MAGENTA:
ret = "35";
break;
case CONSOLE_COLOR.CYAN:
case CYAN:
ret = "36";
break;
}

View File

@ -0,0 +1,11 @@
package jesse.keeblarcraft.Utils.CommonStructures;
public class Position2d {
public Position2d(int x, int y) {
this.x = x;
this.y = y;
}
public int x;
public int y;
}

View File

@ -0,0 +1,13 @@
package jesse.keeblarcraft.Utils.CommonStructures;
public class Position3d {
public Position3d(int x, int y, int z) {
this.x = x;
this.y = y;
this.z = z;
}
public int x;
public int y;
public int z;
}

View File

@ -15,7 +15,6 @@ import java.util.List;
import java.util.ArrayList;
import jesse.keeblarcraft.ConfigMgr.ConfigManager;
import jesse.keeblarcraft.EventMgr.ServerTickListener;
import jesse.keeblarcraft.Utils.ChatUtil.CONSOLE_COLOR;
import jesse.keeblarcraft.Utils.CustomExceptions.DIRECTORY_CREATE_EXCEPTION;
import jesse.keeblarcraft.Utils.CustomExceptions.SETUP_FAILED_EXCEPTION;

View File

@ -1,15 +0,0 @@
package jesse.keeblarcraft.mixin;
import net.minecraft.server.MinecraftServer;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(MinecraftServer.class)
public class ExampleMixin {
@Inject(at = @At("HEAD"), method = "loadWorld")
private void init(CallbackInfo info) {
// This code is injected into the start of MinecraftServer.loadWorld()V
}
}

View File

@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "keeblarcraft:block/example_statue"
}
}
}

View File

@ -7,5 +7,10 @@
"itemgroup.keeblarcraft": "Keeblarcraft Modded Items",
"block.keeblarcraft.example_block": "Keeblarcraft example block",
"block.keeblarcraft.example_block_ore": "Keeblarcraft example block ore"
"block.keeblarcraft.example_block_ore": "Keeblarcraft example block ore",
"block.keeblarcraft.example_statue": "Keeblarcraft example statue",
"category.keeblarcraft.test": "Keeblarcraft bindings",
"key.keeblarcraft.treemap": "Tree GUI",
"key.keeblarcraft.globalconfig": "Config menu"
}

View File

@ -0,0 +1,481 @@
{
"credit": "Made with Blockbench",
"texture_size": [64, 64],
"textures": {
"0": "keeblarcraft:block/example_statue",
"particle": "keeblarcraft:block/example_statue"
},
"elements": [
{
"name": "platform",
"from": [0, 0, 0],
"to": [16, 1, 16],
"rotation": {"angle": 0, "axis": "y", "origin": [5, 0, 3]},
"faces": {
"north": {"uv": [4, 2.5, 8, 2.75], "texture": "#0"},
"east": {"uv": [4, 2.75, 8, 3], "texture": "#0"},
"south": {"uv": [4, 3, 8, 3.25], "texture": "#0"},
"west": {"uv": [4, 3.25, 8, 3.5], "texture": "#0"},
"up": {"uv": [4, 4, 0, 0], "texture": "#0"},
"down": {"uv": [4, 4, 0, 8], "texture": "#0"}
}
},
{
"name": "left_leg",
"from": [7, 1, 3],
"to": [9, 5, 5],
"rotation": {"angle": 0, "axis": "y", "origin": [7, 0, 2]},
"faces": {
"north": {"uv": [5.5, 5.5, 6, 6.75], "texture": "#0"},
"east": {"uv": [6, 0, 6.5, 1.25], "texture": "#0"},
"south": {"uv": [6, 1.25, 6.5, 2.5], "texture": "#0"},
"west": {"uv": [6, 3.5, 6.5, 4.75], "texture": "#0"},
"up": {"uv": [6.75, 7.75, 6.25, 7.25], "texture": "#0"},
"down": {"uv": [7.75, 7, 7.25, 7.5], "texture": "#0"}
}
},
{
"name": "right_leg",
"from": [7, 1, 11],
"to": [9, 5, 13],
"rotation": {"angle": 0, "axis": "y", "origin": [7, 0, 11]},
"faces": {
"north": {"uv": [6, 4.75, 6.5, 6], "texture": "#0"},
"east": {"uv": [6, 6, 6.5, 7.25], "texture": "#0"},
"south": {"uv": [6.5, 0, 7, 1.25], "texture": "#0"},
"west": {"uv": [6.5, 1.25, 7, 2.5], "texture": "#0"},
"up": {"uv": [8, 0.5, 7.5, 0], "texture": "#0"},
"down": {"uv": [8, 0.5, 7.5, 1], "texture": "#0"}
}
},
{
"from": [7, 5, 5],
"to": [9, 10, 11],
"rotation": {"angle": 0, "axis": "y", "origin": [7, 5, 7]},
"faces": {
"north": {"uv": [6.5, 3.5, 7, 4.75], "texture": "#0"},
"east": {"uv": [4, 0, 5.5, 1.25], "texture": "#0"},
"south": {"uv": [6.5, 4.75, 7, 6], "texture": "#0"},
"west": {"uv": [4, 1.25, 5.5, 2.5], "texture": "#0"},
"up": {"uv": [6, 1.5, 5.5, 0], "texture": "#0"},
"down": {"uv": [4.5, 5.5, 4, 7], "texture": "#0"}
}
},
{
"from": [7, 8, 10],
"to": [9, 10, 12],
"rotation": {"angle": 0, "axis": "y", "origin": [7, 8, 10]},
"faces": {
"north": {"uv": [7.5, 1, 8, 1.5], "texture": "#0"},
"east": {"uv": [7.5, 1.5, 8, 2], "texture": "#0"},
"south": {"uv": [7.5, 2, 8, 2.5], "texture": "#0"},
"west": {"uv": [7.5, 3.5, 8, 4], "texture": "#0"},
"up": {"uv": [8, 4.5, 7.5, 4], "texture": "#0"},
"down": {"uv": [8, 5, 7.5, 5.5], "texture": "#0"}
}
},
{
"from": [7, 10, 11],
"to": [9, 11, 13],
"rotation": {"angle": 0, "axis": "y", "origin": [7, 10, 11]},
"faces": {
"north": {"uv": [8, 2.75, 8.5, 3], "texture": "#0"},
"east": {"uv": [8, 3, 8.5, 3.25], "texture": "#0"},
"south": {"uv": [8, 3.25, 8.5, 3.5], "texture": "#0"},
"west": {"uv": [3.5, 8, 4, 8.25], "texture": "#0"},
"up": {"uv": [8, 6, 7.5, 5.5], "texture": "#0"},
"down": {"uv": [8, 6, 7.5, 6.5], "texture": "#0"}
}
},
{
"from": [7, 10, 13],
"to": [9, 11, 14],
"rotation": {"angle": 0, "axis": "y", "origin": [7, 10, 12]},
"faces": {
"north": {"uv": [8, 3.5, 8.5, 3.75], "texture": "#0"},
"east": {"uv": [7.5, 8.5, 7.75, 8.75], "texture": "#0"},
"south": {"uv": [8, 3.75, 8.5, 4], "texture": "#0"},
"west": {"uv": [8.75, 8.75, 9, 9], "texture": "#0"},
"up": {"uv": [8.5, 4.25, 8, 4], "texture": "#0"},
"down": {"uv": [8.5, 4.25, 8, 4.5], "texture": "#0"}
}
},
{
"from": [7, 11, 14],
"to": [9, 13, 15],
"rotation": {"angle": 0, "axis": "y", "origin": [7, 11, 13]},
"faces": {
"north": {"uv": [7.5, 6.5, 8, 7], "texture": "#0"},
"east": {"uv": [8, 5, 8.25, 5.5], "texture": "#0"},
"south": {"uv": [7.25, 7.5, 7.75, 8], "texture": "#0"},
"west": {"uv": [5.5, 8, 5.75, 8.5], "texture": "#0"},
"up": {"uv": [8.5, 5.75, 8, 5.5], "texture": "#0"},
"down": {"uv": [8.5, 5.75, 8, 6], "texture": "#0"}
}
},
{
"from": [7, 14, 12],
"to": [9, 15, 14],
"rotation": {"angle": 0, "axis": "y", "origin": [7, 14, 12]},
"faces": {
"north": {"uv": [8, 6, 8.5, 6.25], "texture": "#0"},
"east": {"uv": [8, 6.25, 8.5, 6.5], "texture": "#0"},
"south": {"uv": [8, 6.5, 8.5, 6.75], "texture": "#0"},
"west": {"uv": [8, 6.75, 8.5, 7], "texture": "#0"},
"up": {"uv": [4.5, 8.25, 4, 7.75], "texture": "#0"},
"down": {"uv": [5, 7.75, 4.5, 8.25], "texture": "#0"}
}
},
{
"from": [7, 14, 11],
"to": [9, 15, 12],
"rotation": {"angle": 0, "axis": "y", "origin": [7, 13, 10]},
"faces": {
"north": {"uv": [7.25, 8, 7.75, 8.25], "texture": "#0"},
"east": {"uv": [0, 9, 0.25, 9.25], "texture": "#0"},
"south": {"uv": [7.75, 8, 8.25, 8.25], "texture": "#0"},
"west": {"uv": [9, 0, 9.25, 0.25], "texture": "#0"},
"up": {"uv": [8.75, 0.75, 8.25, 0.5], "texture": "#0"},
"down": {"uv": [8.75, 0.75, 8.25, 1], "texture": "#0"}
}
},
{
"from": [7, 14, 10],
"to": [9, 15, 11],
"rotation": {"angle": 0, "axis": "y", "origin": [7, 13, 9]},
"faces": {
"north": {"uv": [8.25, 1, 8.75, 1.25], "texture": "#0"},
"east": {"uv": [0.25, 9, 0.5, 9.25], "texture": "#0"},
"south": {"uv": [8.25, 1.25, 8.75, 1.5], "texture": "#0"},
"west": {"uv": [9, 0.25, 9.25, 0.5], "texture": "#0"},
"up": {"uv": [8.75, 1.75, 8.25, 1.5], "texture": "#0"},
"down": {"uv": [8.75, 1.75, 8.25, 2], "texture": "#0"}
}
},
{
"from": [7, 13, 9],
"to": [9, 14, 10],
"rotation": {"angle": 0, "axis": "y", "origin": [7, 13, 9]},
"faces": {
"north": {"uv": [8.25, 2, 8.75, 2.25], "texture": "#0"},
"east": {"uv": [0.5, 9, 0.75, 9.25], "texture": "#0"},
"south": {"uv": [8.25, 2.25, 8.75, 2.5], "texture": "#0"},
"west": {"uv": [0.75, 9, 1, 9.25], "texture": "#0"},
"up": {"uv": [3.25, 8.5, 2.75, 8.25], "texture": "#0"},
"down": {"uv": [3.75, 8.25, 3.25, 8.5], "texture": "#0"}
}
},
{
"from": [7, 11, 8],
"to": [9, 13, 9],
"rotation": {"angle": 0, "axis": "y", "origin": [7, 11, 7]},
"faces": {
"north": {"uv": [5, 7.75, 5.5, 8.25], "texture": "#0"},
"east": {"uv": [5.75, 8, 6, 8.5], "texture": "#0"},
"south": {"uv": [6.25, 7.75, 6.75, 8.25], "texture": "#0"},
"west": {"uv": [3.75, 8.25, 4, 8.75], "texture": "#0"},
"up": {"uv": [4.5, 8.5, 4, 8.25], "texture": "#0"},
"down": {"uv": [5, 8.25, 4.5, 8.5], "texture": "#0"}
}
},
{
"from": [7, 10, 9],
"to": [9, 11, 11],
"rotation": {"angle": 0, "axis": "y", "origin": [7, 9, 8]},
"faces": {
"north": {"uv": [5, 8.25, 5.5, 8.5], "texture": "#0"},
"east": {"uv": [8.25, 5, 8.75, 5.25], "texture": "#0"},
"south": {"uv": [8.25, 5.25, 8.75, 5.5], "texture": "#0"},
"west": {"uv": [6.25, 8.25, 6.75, 8.5], "texture": "#0"},
"up": {"uv": [8.25, 7.5, 7.75, 7], "texture": "#0"},
"down": {"uv": [8.25, 7.5, 7.75, 8], "texture": "#0"}
}
},
{
"from": [7, 13, 14],
"to": [9, 14, 15],
"rotation": {"angle": 0, "axis": "y", "origin": [7, 13, 14]},
"faces": {
"north": {"uv": [6.75, 8.25, 7.25, 8.5], "texture": "#0"},
"east": {"uv": [1, 9, 1.25, 9.25], "texture": "#0"},
"south": {"uv": [8.25, 7, 8.75, 7.25], "texture": "#0"},
"west": {"uv": [1.25, 9, 1.5, 9.25], "texture": "#0"},
"up": {"uv": [7.75, 8.5, 7.25, 8.25], "texture": "#0"},
"down": {"uv": [8.75, 7.25, 8.25, 7.5], "texture": "#0"}
}
},
{
"from": [7, 7, 4],
"to": [9, 9, 5],
"rotation": {"angle": 0, "axis": "y", "origin": [7, 7, 4]},
"faces": {
"north": {"uv": [0, 8, 0.5, 8.5], "texture": "#0"},
"east": {"uv": [8.25, 7.5, 8.5, 8], "texture": "#0"},
"south": {"uv": [8, 0, 8.5, 0.5], "texture": "#0"},
"west": {"uv": [7.75, 8.25, 8, 8.75], "texture": "#0"},
"up": {"uv": [8.5, 8.5, 8, 8.25], "texture": "#0"},
"down": {"uv": [8.75, 8, 8.25, 8.25], "texture": "#0"}
}
},
{
"from": [7, 8, 3],
"to": [9, 9, 4],
"rotation": {"angle": 0, "axis": "y", "origin": [7, 7, 2]},
"faces": {
"north": {"uv": [0, 8.5, 0.5, 8.75], "texture": "#0"},
"east": {"uv": [1.5, 9, 1.75, 9.25], "texture": "#0"},
"south": {"uv": [8.5, 0, 9, 0.25], "texture": "#0"},
"west": {"uv": [1.75, 9, 2, 9.25], "texture": "#0"},
"up": {"uv": [9, 0.5, 8.5, 0.25], "texture": "#0"},
"down": {"uv": [3.25, 8.5, 2.75, 8.75], "texture": "#0"}
}
},
{
"from": [7, 9, 2],
"to": [9, 12, 3],
"rotation": {"angle": 0, "axis": "y", "origin": [7, 9, 1]},
"faces": {
"north": {"uv": [4, 7, 4.5, 7.75], "texture": "#0"},
"east": {"uv": [2.25, 8, 2.5, 8.75], "texture": "#0"},
"south": {"uv": [4.5, 7, 5, 7.75], "texture": "#0"},
"west": {"uv": [2.5, 8, 2.75, 8.75], "texture": "#0"},
"up": {"uv": [9, 3, 8.5, 2.75], "texture": "#0"},
"down": {"uv": [9, 3, 8.5, 3.25], "texture": "#0"}
}
},
{
"from": [7, 12, 3],
"to": [9, 13, 4],
"rotation": {"angle": 0, "axis": "y", "origin": [7, 12, 3]},
"faces": {
"north": {"uv": [3.25, 8.5, 3.75, 8.75], "texture": "#0"},
"east": {"uv": [2, 9, 2.25, 9.25], "texture": "#0"},
"south": {"uv": [8.5, 3.25, 9, 3.5], "texture": "#0"},
"west": {"uv": [2.25, 9, 2.5, 9.25], "texture": "#0"},
"up": {"uv": [9, 3.75, 8.5, 3.5], "texture": "#0"},
"down": {"uv": [9, 3.75, 8.5, 4], "texture": "#0"}
}
},
{
"from": [7, 13, 4],
"to": [9, 14, 5],
"rotation": {"angle": 0, "axis": "y", "origin": [7, 13, 4]},
"faces": {
"north": {"uv": [4, 8.5, 4.5, 8.75], "texture": "#0"},
"east": {"uv": [2.5, 9, 2.75, 9.25], "texture": "#0"},
"south": {"uv": [8.5, 4, 9, 4.25], "texture": "#0"},
"west": {"uv": [2.75, 9, 3, 9.25], "texture": "#0"},
"up": {"uv": [9, 4.5, 8.5, 4.25], "texture": "#0"},
"down": {"uv": [5, 8.5, 4.5, 8.75], "texture": "#0"}
}
},
{
"from": [7, 10, 5],
"to": [9, 14, 6],
"rotation": {"angle": 0, "axis": "y", "origin": [7, 10, 5]},
"faces": {
"north": {"uv": [5.5, 1.5, 6, 2.5], "texture": "#0"},
"east": {"uv": [6.75, 7.25, 7, 8.25], "texture": "#0"},
"south": {"uv": [7, 3.5, 7.5, 4.5], "texture": "#0"},
"west": {"uv": [0.5, 8, 0.75, 9], "texture": "#0"},
"up": {"uv": [9, 4.75, 8.5, 4.5], "texture": "#0"},
"down": {"uv": [9, 4.75, 8.5, 5], "texture": "#0"}
}
},
{
"from": [7, 10, 6],
"to": [9, 15, 7],
"rotation": {"angle": 0, "axis": "y", "origin": [7, 14, 6]},
"faces": {
"north": {"uv": [6.5, 6, 7, 7.25], "texture": "#0"},
"east": {"uv": [7, 5.75, 7.25, 7], "texture": "#0"},
"south": {"uv": [5.5, 6.75, 6, 8], "texture": "#0"},
"west": {"uv": [7, 7, 7.25, 8.25], "texture": "#0"},
"up": {"uv": [5.5, 8.75, 5, 8.5], "texture": "#0"},
"down": {"uv": [6, 8.5, 5.5, 8.75], "texture": "#0"}
}
},
{
"from": [7, 10, 7],
"to": [9, 15, 8],
"rotation": {"angle": 0, "axis": "y", "origin": [7, 14, 7]},
"faces": {
"north": {"uv": [7, 0, 7.5, 1.25], "texture": "#0"},
"east": {"uv": [7.25, 5.75, 7.5, 7], "texture": "#0"},
"south": {"uv": [7, 1.25, 7.5, 2.5], "texture": "#0"},
"west": {"uv": [6, 7.25, 6.25, 8.5], "texture": "#0"},
"up": {"uv": [9, 8, 8.5, 7.75], "texture": "#0"},
"down": {"uv": [8.5, 8.5, 8, 8.75], "texture": "#0"}
}
},
{
"from": [7, 15, 6],
"to": [9, 16, 7],
"rotation": {"angle": 0, "axis": "y", "origin": [7, 15, 6]},
"faces": {
"north": {"uv": [8.5, 5.5, 9, 5.75], "texture": "#0"},
"east": {"uv": [9, 2.75, 9.25, 3], "texture": "#0"},
"south": {"uv": [8.5, 5.75, 9, 6], "texture": "#0"},
"west": {"uv": [3, 9, 3.25, 9.25], "texture": "#0"},
"up": {"uv": [6.5, 8.75, 6, 8.5], "texture": "#0"},
"down": {"uv": [9, 6, 8.5, 6.25], "texture": "#0"}
}
},
{
"from": [7, 15, 13],
"to": [9, 16, 14],
"rotation": {"angle": 0, "axis": "y", "origin": [7, 15, 13]},
"faces": {
"north": {"uv": [8.5, 6.5, 9, 6.75], "texture": "#0"},
"east": {"uv": [9, 3, 9.25, 3.25], "texture": "#0"},
"south": {"uv": [8.5, 6.75, 9, 7], "texture": "#0"},
"west": {"uv": [3.25, 9, 3.5, 9.25], "texture": "#0"},
"up": {"uv": [7.5, 8.75, 7, 8.5], "texture": "#0"},
"down": {"uv": [9, 7.5, 8.5, 7.75], "texture": "#0"}
}
},
{
"from": [7, 10, 8],
"to": [9, 11, 9],
"rotation": {"angle": 0, "axis": "y", "origin": [7, 10, 8]},
"faces": {
"north": {"uv": [8.5, 8.25, 9, 8.5], "texture": "#0"},
"east": {"uv": [9, 3.25, 9.25, 3.5], "texture": "#0"},
"south": {"uv": [8.5, 8.5, 9, 8.75], "texture": "#0"},
"west": {"uv": [3.5, 9, 3.75, 9.25], "texture": "#0"},
"up": {"uv": [0.5, 9, 0, 8.75], "texture": "#0"},
"down": {"uv": [9.25, 0.5, 8.75, 0.75], "texture": "#0"}
}
},
{
"from": [7, 14, 8],
"to": [9, 15, 9],
"rotation": {"angle": 0, "axis": "y", "origin": [7, 14, 8]},
"faces": {
"north": {"uv": [8.75, 0.75, 9.25, 1], "texture": "#0"},
"east": {"uv": [9, 3.5, 9.25, 3.75], "texture": "#0"},
"south": {"uv": [8.75, 1, 9.25, 1.25], "texture": "#0"},
"west": {"uv": [3.75, 9, 4, 9.25], "texture": "#0"},
"up": {"uv": [9.25, 1.5, 8.75, 1.25], "texture": "#0"},
"down": {"uv": [9.25, 1.5, 8.75, 1.75], "texture": "#0"}
}
},
{
"from": [7, 13, 8],
"to": [9, 14, 9],
"rotation": {"angle": 0, "axis": "y", "origin": [7, 13, 8]},
"faces": {
"north": {"uv": [8.75, 1.75, 9.25, 2], "texture": "#0"},
"east": {"uv": [9, 3.75, 9.25, 4], "texture": "#0"},
"south": {"uv": [8.75, 2, 9.25, 2.25], "texture": "#0"},
"west": {"uv": [4, 9, 4.25, 9.25], "texture": "#0"},
"up": {"uv": [2.75, 9, 2.25, 8.75], "texture": "#0"},
"down": {"uv": [9.25, 2.25, 8.75, 2.5], "texture": "#0"}
}
},
{
"from": [7, 15, 8],
"to": [9, 16, 9],
"rotation": {"angle": 0, "axis": "y", "origin": [7, 15, 8]},
"faces": {
"north": {"uv": [8.75, 2.5, 9.25, 2.75], "texture": "#0"},
"east": {"uv": [9, 4, 9.25, 4.25], "texture": "#0"},
"south": {"uv": [2.75, 8.75, 3.25, 9], "texture": "#0"},
"west": {"uv": [4.25, 9, 4.5, 9.25], "texture": "#0"},
"up": {"uv": [3.75, 9, 3.25, 8.75], "texture": "#0"},
"down": {"uv": [4.25, 8.75, 3.75, 9], "texture": "#0"}
}
},
{
"from": [7, 15, 7],
"to": [9, 16, 8],
"rotation": {"angle": 0, "axis": "y", "origin": [7, 15, 7]},
"faces": {
"north": {"uv": [4.25, 8.75, 4.75, 9], "texture": "#0"},
"east": {"uv": [9, 4.25, 9.25, 4.5], "texture": "#0"},
"south": {"uv": [4.75, 8.75, 5.25, 9], "texture": "#0"},
"west": {"uv": [4.5, 9, 4.75, 9.25], "texture": "#0"},
"up": {"uv": [9.25, 5.25, 8.75, 5], "texture": "#0"},
"down": {"uv": [5.75, 8.75, 5.25, 9], "texture": "#0"}
}
},
{
"from": [7, 15, 9],
"to": [9, 16, 10],
"rotation": {"angle": 0, "axis": "y", "origin": [7, 15, 9]},
"faces": {
"north": {"uv": [8.75, 5.25, 9.25, 5.5], "texture": "#0"},
"east": {"uv": [9, 4.5, 9.25, 4.75], "texture": "#0"},
"south": {"uv": [5.75, 8.75, 6.25, 9], "texture": "#0"},
"west": {"uv": [4.75, 9, 5, 9.25], "texture": "#0"},
"up": {"uv": [6.75, 9, 6.25, 8.75], "texture": "#0"},
"down": {"uv": [7.25, 8.75, 6.75, 9], "texture": "#0"}
}
},
{
"from": [7, 14, 9],
"to": [9, 15, 10],
"rotation": {"angle": 0, "axis": "y", "origin": [7, 14, 9]},
"faces": {
"north": {"uv": [8.75, 7, 9.25, 7.25], "texture": "#0"},
"east": {"uv": [9, 4.75, 9.25, 5], "texture": "#0"},
"south": {"uv": [7.25, 8.75, 7.75, 9], "texture": "#0"},
"west": {"uv": [5, 9, 5.25, 9.25], "texture": "#0"},
"up": {"uv": [9.25, 7.5, 8.75, 7.25], "texture": "#0"},
"down": {"uv": [8.25, 8.75, 7.75, 9], "texture": "#0"}
}
},
{
"from": [7, 15, 10],
"to": [9, 16, 13],
"rotation": {"angle": 0, "axis": "y", "origin": [7, 15, 10]},
"faces": {
"north": {"uv": [8.75, 8, 9.25, 8.25], "texture": "#0"},
"east": {"uv": [8, 2.5, 8.75, 2.75], "texture": "#0"},
"south": {"uv": [8.25, 8.75, 8.75, 9], "texture": "#0"},
"west": {"uv": [2.75, 8, 3.5, 8.25], "texture": "#0"},
"up": {"uv": [5.5, 7.75, 5, 7], "texture": "#0"},
"down": {"uv": [7.5, 5, 7, 5.75], "texture": "#0"}
}
},
{
"from": [7, 16, 7],
"to": [9, 17, 13],
"rotation": {"angle": 0, "axis": "y", "origin": [7, 16, 7]},
"faces": {
"north": {"uv": [8.5, 6.25, 9, 6.5], "texture": "#0"},
"east": {"uv": [7, 4.5, 8.5, 4.75], "texture": "#0"},
"south": {"uv": [6.5, 8.5, 7, 8.75], "texture": "#0"},
"west": {"uv": [7, 4.75, 8.5, 5], "texture": "#0"},
"up": {"uv": [5, 7, 4.5, 5.5], "texture": "#0"},
"down": {"uv": [5.5, 5.5, 5, 7], "texture": "#0"}
}
},
{
"from": [6, 6, 6],
"to": [7, 10, 10],
"rotation": {"angle": 0, "axis": "y", "origin": [5, 6, 6]},
"faces": {
"north": {"uv": [8, 0.5, 8.25, 1.5], "texture": "#0"},
"east": {"uv": [4, 3.5, 5, 4.5], "texture": "#0"},
"south": {"uv": [0.75, 8, 1, 9], "texture": "#0"},
"west": {"uv": [4, 4.5, 5, 5.5], "texture": "#0"},
"up": {"uv": [1.25, 9, 1, 8], "texture": "#0"},
"down": {"uv": [1.5, 8, 1.25, 9], "texture": "#0"}
}
},
{
"from": [9, 6, 6],
"to": [10, 10, 10],
"rotation": {"angle": 0, "axis": "y", "origin": [8, 6, 6]},
"faces": {
"north": {"uv": [1.5, 8, 1.75, 9], "texture": "#0"},
"east": {"uv": [5, 3.5, 6, 4.5], "texture": "#0"},
"south": {"uv": [8, 1.5, 8.25, 2.5], "texture": "#0"},
"west": {"uv": [5, 4.5, 6, 5.5], "texture": "#0"},
"up": {"uv": [2, 9, 1.75, 8], "texture": "#0"},
"down": {"uv": [2.25, 8, 2, 9], "texture": "#0"}
}
}
]
}

View File

@ -0,0 +1,3 @@
{
"parent": "keeblarcraft:block/example_statue"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 782 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 154 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1012 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 791 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 782 B

View File

@ -1,11 +1,11 @@
{
"schemaVersion": 1,
"id": "keeblarcraft",
"version": "${version}",
"version": "0.1",
"name": "keeblarcraft",
"description": "This is an example description! Tell everyone what your mod is about!",
"description": "My everything mod",
"authors": [
"Me!"
"Jkibbels"
],
"contact": {
"homepage": "https://fabricmc.net/",
@ -22,18 +22,12 @@
"jesse.keeblarcraft.KeeblarcraftClient"
]
},
"mixins": [
"keeblarcraft.mixins.json",
{
"config": "keeblarcraft.client.mixins.json",
"environment": "client"
}
],
"depends": {
"fabricloader": ">=0.15.11",
"minecraft": "~1.20",
"java": ">=21",
"fabric-api": "*"
"java": ">=17",
"fabric-api": "*",
"fabric-key-binding-api-v1": "*"
},
"suggests": {
"another-mod": "*"

View File

@ -1,11 +0,0 @@
{
"required": true,
"package": "jesse.keeblarcraft.mixin",
"compatibilityLevel": "JAVA_21",
"mixins": [
"ExampleMixin"
],
"injectors": {
"defaultRequire": 1
}
}