Skip to content

Commit

Permalink
Updated to 7.1
Browse files Browse the repository at this point in the history
TODO still
Controller support for new guidebook
Fix crafting GUI
Fix mod integrations
  • Loading branch information
UselessBullets committed Dec 16, 2023
1 parent 0eae223 commit 5aa3c55
Show file tree
Hide file tree
Showing 38 changed files with 338 additions and 302 deletions.
12 changes: 6 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -110,16 +110,16 @@ dependencies {
// Libraries
modImplementation "com.github.Turnip-Labs:bta-halplibe:${project.halplibe_version}"
modImplementation "BTA_Babric_PrismaticLibe:prismaticlibe:${project.prismatic_version}"
modImplementation "sunsetutils:sunsetutils:${project.sunsetutils_version}"
//modImplementation "sunsetutils:sunsetutils:${project.sunsetutils_version}"

// APIs
modImplementation "energyapi:energyapi:${project.energyapi_version}"
//modImplementation "energyapi:energyapi:${project.energyapi_version}"

// Mods
modImplementation "ModMenu:ModMenu:2.0.0"
modImplementation "BTA_Babric_SpawnEggs:spawneggs:1.3.0"
modImplementation "BTANoNameDyes:noname_dyes:${project.dyes_version}"
modImplementation "potato-logistics:PotatoLogistics:${project.potato_logistics_version}"
modImplementation "ModMenu:ModMenu:2.0.3"
//modImplementation "BTA_Babric_SpawnEggs:spawneggs:1.3.0"
// modImplementation "BTANoNameDyes:noname_dyes:${project.dyes_version}"
// modImplementation "potato-logistics:PotatoLogistics:${project.potato_logistics_version}"



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

# BTA
bta_version=1.7.7.0_02
bta_version=7.1-pre1

# Loader
loader_version=0.14.19-babric.1-bta
loader_version=0.14.19-babric.2-bta

# Libaries
halplibe_version=2.5.0
prismatic_version=2.1.5
halplibe_version=3.0.0
prismatic_version=3.0.0
sunsetutils_version=1.8.2

# APIs
Expand All @@ -19,6 +19,6 @@ dyes_version=0.1.7
potato_logistics_version=0.1.4

# Mod
mod_version=1.1.1
mod_version=1.1.1-7.1
mod_group=useless
mod_name=legacyui
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

import net.minecraft.client.Minecraft;
import net.minecraft.core.InventoryAction;
import net.minecraft.core.achievement.stat.StatFileWriter;
import net.minecraft.core.achievement.stat.StatList;
import net.minecraft.core.achievement.stat.StatsCounter;
import net.minecraft.core.block.Block;
import net.minecraft.core.crafting.CraftingManager;
import net.minecraft.core.crafting.legacy.CraftingManager;
import net.minecraft.core.entity.player.EntityPlayer;
import net.minecraft.core.item.ItemStack;
import net.minecraft.core.player.gamemode.Gamemode;
Expand All @@ -16,13 +16,13 @@
import useless.legacyui.Gui.GuiScreens.GuiLegacyCrafting;
import useless.legacyui.Gui.Slots.SlotCraftingDisplayLegacy;
import useless.legacyui.Gui.Slots.SlotNull;
import useless.legacyui.Gui.Slots.SlotResizable;
import useless.legacyui.Helper.InventoryHelper;
import useless.legacyui.LegacyUI;
import useless.legacyui.Sorting.LegacyCategoryManager;
import useless.legacyui.Sorting.Recipe.RecipeCategory;
import useless.legacyui.Sorting.Recipe.RecipeCost;
import useless.legacyui.Sorting.Recipe.RecipeGroup;
import useless.prismaticlibe.gui.slot.SlotResizable;

import java.util.List;

Expand Down Expand Up @@ -102,7 +102,7 @@ public void craftingSlots(boolean showCraftingPreview) {

this.onCraftMatrixChanged(this.craftMatrix);
}
public void setRecipes(EntityPlayer player, StatFileWriter statWriter, boolean showCraftingPreview){
public void setRecipes(EntityPlayer player, StatsCounter statCounter, boolean showCraftingPreview){
boolean isInInventory = craftingSize <= 4;

int currentSlotId = GuiLegacyCrafting.currentSlot;
Expand Down Expand Up @@ -133,7 +133,7 @@ public void setRecipes(EntityPlayer player, StatFileWriter statWriter, boolean s

// Recipebar preview
item = currentContainer.inventorySlots.get(0).getStack();
discovered = isDicovered(item, statWriter, player);
discovered = isDicovered(item, statCounter, player);
this.addSlot(new SlotCraftingDisplayLegacy(this.inventorySlots.size(), 12 + 18 * index, 56, currentContainer.inventorySlots.get(0).getStack(), discovered, !craftable, LegacyUI.modSettings.getHighlightColor().value.value));

if (group.getRecipes(isInInventory).length > 1) { // If multiple Items in recipe group
Expand All @@ -142,13 +142,13 @@ public void setRecipes(EntityPlayer player, StatFileWriter statWriter, boolean s

// Next item preview
item = group.getContainer(idUpper, isInInventory).inventorySlots.get(0).getStack();
discovered = isDicovered(item, statWriter, player);
discovered = isDicovered(item, statCounter, player);
craftable = canCraft(player, new RecipeCost(group.getContainer(idUpper, isInInventory)));
this.addSlot(new SlotCraftingDisplayLegacy(this.inventorySlots.size(), 12 + 18 * index, 56 + 21, item, discovered, !craftable, LegacyUI.modSettings.getHighlightColor().value.value));

// Previous item preview
item = group.getContainer(idLower, isInInventory).inventorySlots.get(0).getStack();
discovered = isDicovered(item, statWriter, player);
discovered = isDicovered(item, statCounter, player);
craftable = canCraft(player, new RecipeCost(group.getContainer(idLower, isInInventory)));
this.addSlot(new SlotCraftingDisplayLegacy(this.inventorySlots.size(), 12 + 18 * index, 56 - 21, item, discovered, !craftable, LegacyUI.modSettings.getHighlightColor().value.value));

Expand All @@ -159,12 +159,12 @@ public void setRecipes(EntityPlayer player, StatFileWriter statWriter, boolean s
RecipeCost cost = new RecipeCost(currentContainer);
craftable = canCraft(player, cost);
item = currentContainer.inventorySlots.get(0).getStack();
discovered = isDicovered(item, statWriter, player);
discovered = isDicovered(item, statCounter, player);
this.addSlot(new SlotCraftingDisplayLegacy(this.inventorySlots.size(), 103, 123+offset, item, discovered, !craftable, LegacyUI.modSettings.getHighlightColor().value.value, 26));

for (int j = 1; j < currentContainer.inventorySlots.size(); j++) {
item = currentContainer.inventorySlots.get(j).getStack();
discovered = isDicovered(item, statWriter, player);
discovered = isDicovered(item, statCounter, player);

int k = 0;
if (item != null){
Expand All @@ -191,7 +191,7 @@ public void setRecipes(EntityPlayer player, StatFileWriter statWriter, boolean s
}
else { // Renders first Slot of none selected groups
item = group.getContainer(0, isInInventory).inventorySlots.get(0).getStack();
discovered = isDicovered(item, statWriter, player);
discovered = isDicovered(item, statCounter, player);
craftable = canCraft(player, new RecipeCost(group.getContainer(0, isInInventory)));
this.addSlot(new SlotCraftingDisplayLegacy(this.inventorySlots.size(), 12 + 18 * index, 56, item, discovered, !craftable, LegacyUI.modSettings.getHighlightColor().value.value));
}
Expand Down Expand Up @@ -221,25 +221,25 @@ public boolean craft(Minecraft mc, int windowId){


if (isInInventory){
mc.playerController.doInventoryAction(windowId, InventoryAction.CLICK_LEFT, new int[]{slotId}, mc.thePlayer); // Picks up stack
mc.playerController.doInventoryAction(windowId, InventoryAction.CLICK_RIGHT, new int[]{i}, mc.thePlayer); // Places one item
mc.playerController.doInventoryAction(windowId, InventoryAction.CLICK_LEFT, new int[]{slotId}, mc.thePlayer); // Puts down stack
mc.playerController.handleInventoryMouseClick(windowId, InventoryAction.CLICK_LEFT, new int[]{slotId}, mc.thePlayer); // Picks up stack
mc.playerController.handleInventoryMouseClick(windowId, InventoryAction.CLICK_RIGHT, new int[]{i}, mc.thePlayer); // Places one item
mc.playerController.handleInventoryMouseClick(windowId, InventoryAction.CLICK_LEFT, new int[]{slotId}, mc.thePlayer); // Puts down stack
}
else if (recipe.inventorySlots.size() > 5){// 3x3 crafting
int offset = 1;
mc.playerController.doInventoryAction(windowId, InventoryAction.CLICK_LEFT, new int[]{slotId + offset}, mc.thePlayer); // Picks up stack
mc.playerController.doInventoryAction(windowId, InventoryAction.CLICK_RIGHT, new int[]{i}, mc.thePlayer); // Places one item
mc.playerController.doInventoryAction(windowId, InventoryAction.CLICK_LEFT, new int[]{slotId + offset}, mc.thePlayer); // Puts down stack
mc.playerController.handleInventoryMouseClick(windowId, InventoryAction.CLICK_LEFT, new int[]{slotId + offset}, mc.thePlayer); // Picks up stack
mc.playerController.handleInventoryMouseClick(windowId, InventoryAction.CLICK_RIGHT, new int[]{i}, mc.thePlayer); // Places one item
mc.playerController.handleInventoryMouseClick(windowId, InventoryAction.CLICK_LEFT, new int[]{slotId + offset}, mc.thePlayer); // Puts down stack
}
else {// 2x2 crafting
mc.playerController.doInventoryAction(windowId, InventoryAction.CLICK_LEFT, new int[]{slotId + 1}, mc.thePlayer); // Picks up stack
mc.playerController.doInventoryAction(windowId, InventoryAction.CLICK_RIGHT, new int[]{i + (i/3)}, mc.thePlayer); // Places one item
mc.playerController.doInventoryAction(windowId, InventoryAction.CLICK_LEFT, new int[]{slotId + 1}, mc.thePlayer); // Puts down stack
mc.playerController.handleInventoryMouseClick(windowId, InventoryAction.CLICK_LEFT, new int[]{slotId + 1}, mc.thePlayer); // Picks up stack
mc.playerController.handleInventoryMouseClick(windowId, InventoryAction.CLICK_RIGHT, new int[]{i + (i/3)}, mc.thePlayer); // Places one item
mc.playerController.handleInventoryMouseClick(windowId, InventoryAction.CLICK_LEFT, new int[]{slotId + 1}, mc.thePlayer); // Puts down stack
}
}
}
mc.playerController.doInventoryAction(windowId, InventoryAction.MOVE_STACK, new int[]{0}, mc.thePlayer);
mc.playerController.doInventoryAction(windowId, InventoryAction.DROP, new int[]{0}, mc.thePlayer);
mc.playerController.handleInventoryMouseClick(windowId, InventoryAction.MOVE_STACK, new int[]{0}, mc.thePlayer);
mc.playerController.handleInventoryMouseClick(windowId, InventoryAction.DROP, new int[]{0}, mc.thePlayer);
return true; // Craft succeeded
}
return false; // Craft failed
Expand All @@ -251,7 +251,7 @@ private boolean canCraft(EntityPlayer player, RecipeCost cost){
}
return canCraft;
}
public static boolean isDicovered(ItemStack item, StatFileWriter statWriter, EntityPlayer player){
public static boolean isDicovered(ItemStack item, StatsCounter statWriter, EntityPlayer player){
if (!LegacyUI.modSettings.getCraftingHideUndiscoveredItems().value){
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ public void swapDye(int dyeSelected){
slotId += 3; // Accounts for the first three slots being the dye slots
//slotId -= 4;

mc.playerController.doInventoryAction(windowId, InventoryAction.MOVE_STACK, new int[]{GuiLegacyFlag.selectedColor}, mc.thePlayer);
mc.playerController.handleInventoryMouseClick(windowId, InventoryAction.MOVE_STACK, new int[]{GuiLegacyFlag.selectedColor}, mc.thePlayer);

mc.playerController.doInventoryAction(windowId, InventoryAction.CLICK_LEFT, new int[]{slotId}, mc.thePlayer);
mc.playerController.doInventoryAction(windowId, InventoryAction.CLICK_LEFT, new int[]{GuiLegacyFlag.selectedColor}, mc.thePlayer);
mc.playerController.doInventoryAction(windowId, InventoryAction.CLICK_LEFT, new int[]{slotId}, mc.thePlayer);
mc.playerController.handleInventoryMouseClick(windowId, InventoryAction.CLICK_LEFT, new int[]{slotId}, mc.thePlayer);
mc.playerController.handleInventoryMouseClick(windowId, InventoryAction.CLICK_LEFT, new int[]{GuiLegacyFlag.selectedColor}, mc.thePlayer);
mc.playerController.handleInventoryMouseClick(windowId, InventoryAction.CLICK_LEFT, new int[]{slotId}, mc.thePlayer);
}
setSlots();
}
Expand Down
Loading

0 comments on commit 5aa3c55

Please # to comment.