Compare commits

..
16 Commits
Author SHA1 Message Date
Martin Robertz e7760c068f Merge remote-tracking branch 'koolkrafter5/meteor-nei' into dev 2025-05-11 12:59:26 +02:00
Maya 5de73d31c4 Merge branch 'master' into meteor-nei 2025-05-09 17:02:20 -05:00
Maya a20e0b0c70 Merge branch 'master' into meteor-nei 2025-05-07 11:05:52 -05:00
koolkrafter5 a22fcb8cb0 Who wrote this? Oh yeah, that was me. 2025-05-05 23:33:27 -04:00
koolkrafter5 71ebe63947 Remove unused field 2025-05-05 23:23:32 -04:00
koolkrafter5 da84ed4f06 Checked the wrong variable here 2025-05-05 23:13:11 -04:00
koolkrafter5 76bfb7dda1 Make it work properly on servers 2025-05-05 22:57:53 -04:00
koolkrafter5 9decf95c08 Merge branch 'master' into meteor-nei 2025-05-05 22:51:12 -04:00
koolkrafter5 deb0118a41 Merge branch 'master' into meteor-nei 2025-05-03 12:14:33 -04:00
koolkrafter5 395e9c6b10 This works to make it only show this info on the first page of results, which seems fine. 2025-04-25 07:50:41 -04:00
koolkrafter5 3eeabd90ae Make this message more clear 2025-04-25 07:50:41 -04:00
koolkrafter5 2321967bdb Capitalize this to match other text 2025-04-25 07:50:41 -04:00
koolkrafter5 2b0b688c98 Spotless 2025-04-25 07:50:41 -04:00
koolkrafter5 b721e43537 Move the + button down for the meteor handler so it's not on top of the item slot graphics. 2025-04-25 07:50:41 -04:00
koolkrafter5 f74f42d0f9 Add ritual (name and cost) and reagent (message saying there are none that apply) to the binding ritual handler. It shows them for every recipe. It should only show once per page, but I'm stumped on how to actually do that. 2025-04-25 07:50:41 -04:00
koolkrafter5 b02fa2f32d Revamp the NEI meteor handler.
Add a new Ritual Info widget that shows the required activation crystal, ritual name, and activation cost when hovered. Suitable for use in any other NEI ritual handlers.
Move the cost and radius to the top of the page so they don't get hidden with certain UI scales.
Cost now shows the blood orb required (works with any IBloodOrb, but does not account for Runes of the Orb). The orb is darkened and the hover text includes "Insufficient LP" if the player does not have enough LP to summon that meteor.
Radius shows the diameter (and its formula because it's actually 2r + 1) when hovered.
Add a new Reagent Effects widget (also suitable for use in other handlers), and have it show effects for the currently selected meteor (meteors with no filler will not show things that impact filler, new filler chance will be calculated, new radius will be calculated).
Center focus item and arrow on the texture because they were not centered before.
2025-04-25 07:50:41 -04:00
29 changed files with 493 additions and 397 deletions

No files matched your search

+4 -4
View File
@@ -24,12 +24,12 @@
dependencies {
api("com.github.GTNewHorizons:waila:1.8.4:dev")
api("com.github.GTNewHorizons:NotEnoughItems:2.7.44-GTNH:dev")
api("com.github.GTNewHorizons:NotEnoughItems:2.7.40-GTNH:dev")
compileOnly("com.github.GTNewHorizons:GT5-Unofficial:5.09.51.289:dev") {transitive = false }
compileOnly("com.github.GTNewHorizons:GT5-Unofficial:5.09.51.275:dev") {transitive = false }
compileOnly("com.github.GTNewHorizons:Botania:1.12.8-GTNH:api") {transitive = false }
compileOnly("com.github.GTNewHorizons:ForestryMC:4.10.8:api") {transitive = false }
compileOnly("com.github.GTNewHorizons:Botania:1.12.6-GTNH:api") {transitive = false }
compileOnly("com.github.GTNewHorizons:ForestryMC:4.10.7:api") {transitive = false }
compileOnly("com.github.GTNewHorizons:ForgeMultipart:1.6.2:dev") {transitive = false }
compileOnly("com.github.GTNewHorizons:Chisel:2.16.4-GTNH:api") {transitive = false }
@@ -1,29 +1,17 @@
package WayofTime.alchemicalWizardry.api;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector;
public class RoutingFocusLogic {
public boolean getDefaultMatch(ItemStack keyStack, ItemStack checkedStack) {
return (keyStack != null && keyStack.getItem() != null
&& checkedStack != null
&& keyStack.getItem() == checkedStack.getItem()
&& (!keyStack.getItem().getHasSubtypes() || keyStack.getItemDamage() == checkedStack.getItemDamage()));
return (keyStack != null ? checkedStack != null && keyStack.getItem() == checkedStack.getItem()
&& (keyStack.getItem().getHasSubtypes() ? keyStack.getItemDamage() == checkedStack.getItemDamage()
: true)
: false);
}
public boolean doesItemMatch(boolean previous, ItemStack keyStack, ItemStack checkedStack) {
return previous || this.getDefaultMatch(keyStack, checkedStack);
}
public List<String> getDescription() {
return new ArrayList<>(
Collections.singletonList(
StatCollector.translateToLocal("tooltip.routingFocus.logic") + " "
+ StatCollector.translateToLocal("item.outputRoutingFocus.default.logic")));
}
}
@@ -7,11 +7,9 @@ import net.minecraft.item.ItemStack;
public class RoutingFocusParadigm {
public List<RoutingFocusLogic> logicList = new LinkedList<>();
public List<RoutingFocusLogic> logicList = new LinkedList();
public List<RoutingFocusPosAndFacing> locationList = new LinkedList<>();
public List<String> nameList = new LinkedList<>();
public List<RoutingFocusPosAndFacing> locationList = new LinkedList();
public int maximumAmount = 0;
@@ -26,14 +24,6 @@ public class RoutingFocusParadigm {
logicList.add(logic);
}
public void addName(String name) {
nameList.add(name);
}
public boolean doesNameMatch(String name) {
return nameList.contains(name);
}
public boolean doesItemMatch(ItemStack keyStack, ItemStack checkedStack) {
boolean isGood = false;
boolean isFirst = true;
@@ -52,7 +42,6 @@ public class RoutingFocusParadigm {
public void clear() {
logicList.clear();
locationList.clear();
nameList.clear();
maximumAmount = 0;
}
@@ -1,16 +1,15 @@
package WayofTime.alchemicalWizardry.client.nei;
import static WayofTime.alchemicalWizardry.client.ClientUtils.mc;
import static WayofTime.alchemicalWizardry.client.nei.NEIConfig.getBloodOrbs;
import java.awt.Rectangle;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
@@ -29,19 +28,28 @@ public class NEIAlchemyRecipeHandler extends TemplateRecipeHandler {
public class CachedAlchemyRecipe extends CachedRecipe {
ArrayList<ItemStack> orbs;
public class BloodOrbs {
public PositionedStack stack;
public BloodOrbs(ItemStack orb) {
this.stack = new PositionedStack(orb, 136, 47, false);
}
}
ArrayList<BloodOrbs> orbs;
PositionedStack output;
List<PositionedStack> inputs;
int lp;
public CachedAlchemyRecipe(AlchemyRecipe recipe, ItemStack orb) {
this(recipe);
this.orbs = new ArrayList<>();
orbs.add(orb);
this.orbs = new ArrayList<BloodOrbs>();
orbs.add(new BloodOrbs(orb));
}
public CachedAlchemyRecipe(AlchemyRecipe recipe) {
List<PositionedStack> inputs = new ArrayList<>();
List<PositionedStack> inputs = new ArrayList<PositionedStack>();
ItemStack[] stacks = recipe.getRecipe();
if (stacks.length > 0) inputs.add(new PositionedStack(stacks[0], 76, 3));
if (stacks.length > 1) inputs.add(new PositionedStack(stacks[1], 51, 19));
@@ -51,10 +59,10 @@ public class NEIAlchemyRecipeHandler extends TemplateRecipeHandler {
this.inputs = inputs;
this.output = new PositionedStack(recipe.getResult(), 76, 25);
this.lp = recipe.getAmountNeeded() * 100;
this.orbs = new ArrayList<>();
this.orbs = new ArrayList<BloodOrbs>();
for (Item orb : getBloodOrbs()) {
if (((IBloodOrb) orb).getOrbLevel() >= recipe.getOrbLevel()) {
orbs.add(new ItemStack(orb));
orbs.add(new BloodOrbs(new ItemStack(orb)));
}
}
}
@@ -71,11 +79,8 @@ public class NEIAlchemyRecipeHandler extends TemplateRecipeHandler {
@Override
public PositionedStack getOtherStack() {
if (orbs == null || orbs.isEmpty()) return null;
PositionedStack stack = new PositionedStack(orbs, 136, 47, false);
stack.setPermutationToRender((cycleticks / 48) % orbs.size());
stack.setMaxSize(1);
return stack;
if (orbs == null || orbs.size() <= 0) return null;
return orbs.get((cycleticks / 48) % orbs.size()).stack;
}
}
@@ -117,10 +122,10 @@ public class NEIAlchemyRecipeHandler extends TemplateRecipeHandler {
@Override
public void loadUsageRecipes(ItemStack ingredient) {
if (ingredient.getItem() instanceof IBloodOrb orb) {
if (ingredient.getItem() instanceof IBloodOrb) {
for (AlchemyRecipe recipe : AlchemyRecipeRegistry.recipes) {
if (recipe == null) continue;
if (orb.getOrbLevel() >= recipe.getOrbLevel()) {
if (((IBloodOrb) ingredient.getItem()).getOrbLevel() >= recipe.getOrbLevel()) {
arecipes.add(new CachedAlchemyRecipe(recipe, ingredient));
}
}
@@ -140,14 +145,17 @@ public class NEIAlchemyRecipeHandler extends TemplateRecipeHandler {
@Override
public void drawExtras(int id) {
CachedAlchemyRecipe recipe = (CachedAlchemyRecipe) arecipes.get(id);
String text = EnumChatFormatting.GRAY.toString() + recipe.lp + "LP";
mc.fontRenderer.drawString(text, getLPX(text), 28, 0);
CachedAlchemyRecipe cache = (CachedAlchemyRecipe) arecipes.get(id);
Minecraft.getMinecraft().fontRenderer.drawString("\u00a77" + cache.lp + "LP", getLPX(cache.lp), 34, 0);
}
public int getLPX(String text) {
int textWidth = mc.fontRenderer.getStringWidth(text);
return 144 - (textWidth / 2);
public int getLPX(int lp) {
if (lp < 10) return 122;
else if (lp < 100) return 122;
else if (lp < 1000) return 130;
else if (lp < 10000) return 127;
else if (lp < 100000) return 124;
return 122;
}
@Override
@@ -6,7 +6,6 @@ import java.util.List;
import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
@@ -66,7 +65,7 @@ public class NEIAltarRecipeHandler extends TemplateRecipeHandler {
public void loadCraftingRecipes(ItemStack result) {
for (AltarRecipe recipe : AltarRecipeRegistry.altarRecipes) {
if (NEIServerUtils.areStacksSameTypeCraftingWithNBT(recipe.result, result)) {
if (recipe.result != null) arecipes.add(new CachedAltarRecipe(recipe));
if (recipe != null && recipe.result != null) arecipes.add(new CachedAltarRecipe(recipe));
}
}
}
@@ -75,7 +74,7 @@ public class NEIAltarRecipeHandler extends TemplateRecipeHandler {
public void loadUsageRecipes(ItemStack ingredient) {
for (AltarRecipe recipe : AltarRecipeRegistry.altarRecipes) {
if (NEIServerUtils.areStacksSameTypeCraftingWithNBT(recipe.requiredItem, ingredient)) {
if (recipe.result != null) arecipes.add(new CachedAltarRecipe(recipe));
if (recipe != null && recipe.result != null) arecipes.add(new CachedAltarRecipe(recipe));
}
}
}
@@ -84,18 +83,21 @@ public class NEIAltarRecipeHandler extends TemplateRecipeHandler {
public void drawExtras(int id) {
CachedAltarRecipe recipe = (CachedAltarRecipe) arecipes.get(id);
Minecraft.getMinecraft().fontRenderer.drawString(
EnumChatFormatting.GRAY + StatCollector.translateToLocal("bm.string.tier") + ": " + recipe.tier,
"\u00a77" + StatCollector.translateToLocal("bm.string.tier") + ": " + recipe.tier,
78,
5,
0);
Minecraft.getMinecraft().fontRenderer
.drawString(EnumChatFormatting.GRAY + "LP: " + recipe.lp_amount, 78, 15, 0);
Minecraft.getMinecraft().fontRenderer.drawString("\u00a77" + "LP: " + recipe.lp_amount, 78, 15, 0);
}
@Override
public List<String> handleTooltip(GuiRecipe<?> gui, List<String> currenttip, int id) {
super.handleTooltip(gui, currenttip, id);
if (altarRect(gui, id).contains(GuiDraw.getMousePosition())) {
Point mouse = GuiDraw.getMousePosition();
Point root = gui.getRecipePosition(id);
int offsetX = gui.guiLeft + root.x;
int offsetY = gui.guiTop + root.y;
if (mouse.x >= 14 + offsetX && mouse.x <= 75 + offsetX && mouse.y >= 22 + offsetY && mouse.y <= 56 + offsetY) {
CachedAltarRecipe recipe = (CachedAltarRecipe) arecipes.get(id);
currenttip.add(StatCollector.translateToLocal("bm.string.consume") + ": " + recipe.consumption + "LP/t");
currenttip.add(StatCollector.translateToLocal("bm.string.drain") + ": " + recipe.drain + "LP/t");
@@ -103,13 +105,6 @@ public class NEIAltarRecipeHandler extends TemplateRecipeHandler {
return currenttip;
}
public Rectangle altarRect(GuiRecipe<?> gui, int id) {
Point root = gui.getRecipePosition(id);
int offsetX = gui.guiLeft + root.x;
int offsetY = gui.guiTop + root.y;
return new Rectangle(14 + offsetX, 22 + offsetY, 62, 34);
}
@Override
public String getOverlayIdentifier() {
return "altarrecipes";
@@ -122,7 +117,7 @@ public class NEIAltarRecipeHandler extends TemplateRecipeHandler {
@Override
public String getRecipeName() {
return StatCollector.translateToLocal("tile.bloodAltar.name");
return " " + StatCollector.translateToLocal("tile.bloodAltar.name");
}
@Override
@@ -24,7 +24,7 @@ import codechicken.nei.recipe.TemplateRecipeHandler;
*/
public class NEIBindingRitualHandler extends TemplateRecipeHandler {
private static final RitualInfo ritualInfo = new RitualInfo(1f, "AW006Binding");
private static final RitualInfo ritualInfo = new RitualInfo("AW006Binding", 1f);
private static final ReagentInfo reagentInfo = new ReagentInfo(1f);
public class CachedBindingRecipe extends CachedRecipe {
@@ -94,20 +94,24 @@ public class NEIBindingRitualHandler extends TemplateRecipeHandler {
}
@Override
public List<String> handleTooltip(GuiRecipe<?> gui, List<String> currenttip, int recipeIndex) {
if (GuiContainerManager.shouldShowTooltip(gui) && currenttip.isEmpty()) {
public List<String> handleTooltip(GuiRecipe<?> gui, List<String> list, int recipeIndex) {
if (GuiContainerManager.shouldShowTooltip(gui) && list.isEmpty()) {
CachedRecipe cRecipe = arecipes.get(recipeIndex);
Point mousePos = GuiDraw.getMousePosition();
if (recipeIndex == 0 && cRecipe instanceof NEIBindingRitualHandler.CachedBindingRecipe) {
if (ritualInfo.getRect(gui).contains(mousePos)) {
ritualInfo.onHover(currenttip);
} else if (reagentInfo.getRect(gui).contains(mousePos)) {
currenttip.add(StatCollector.translateToLocal("nei.recipe.reagent.none"));
Rectangle rect = ritualInfo.getRect(gui);
if (rect.contains(mousePos)) {
ritualInfo.onHover(list);
}
rect = reagentInfo.getRect(gui);
if (rect.contains(mousePos)) {
list.add(StatCollector.translateToLocal("nei.recipe.reagent.none"));
}
}
}
return super.handleTooltip(gui, currenttip, recipeIndex);
return super.handleTooltip(gui, list, recipeIndex);
}
@Override
@@ -2,6 +2,7 @@ package WayofTime.alchemicalWizardry.client.nei;
import static WayofTime.alchemicalWizardry.client.nei.NEIConfig.getBloodOrbs;
import java.awt.Rectangle;
import java.util.ArrayList;
import java.util.List;
@@ -32,17 +33,21 @@ public class NEIBloodOrbShapedHandler extends ShapedRecipeHandler {
public void setIngredients(int width, int height, Object[] items) {
for (int x = 0; x < width; x++) {
for (int y = 0; y < height; y++) {
Object o = items[y * width + x];
if (o == null) continue;
if (items[y * width + x] == null) continue;
Object o = items[y * width + x];
if (o instanceof ItemStack) {
PositionedStack stack = new PositionedStack(o, 25 + x * 18, 6 + y * 18, false);
PositionedStack stack = new PositionedStack(
items[y * width + x],
25 + x * 18,
6 + y * 18,
false);
stack.setMaxSize(1);
ingredients.add(stack);
} else if (o instanceof Integer i) {
} else if (o instanceof Integer) {
ArrayList<ItemStack> orbs = new ArrayList<>();
for (Item item : getBloodOrbs()) {
if (((IBloodOrb) item).getOrbLevel() >= i) {
if (((IBloodOrb) item).getOrbLevel() >= (Integer) o) {
orbs.add(new ItemStack(item));
}
}
@@ -59,12 +64,13 @@ public class NEIBloodOrbShapedHandler extends ShapedRecipeHandler {
}
}
@SuppressWarnings("unchecked")
@Override
public void loadCraftingRecipes(String outputId, Object... results) {
if (outputId.equals("crafting") && getClass() == NEIBloodOrbShapedHandler.class) {
for (IRecipe irecipe : CraftingManager.getInstance().getRecipeList()) {
if (irecipe instanceof ShapedBloodOrbRecipe orbRecipe) {
CachedBloodOrbRecipe recipe = forgeShapedRecipe(orbRecipe);
for (IRecipe irecipe : (List<IRecipe>) CraftingManager.getInstance().getRecipeList()) {
if (irecipe instanceof ShapedBloodOrbRecipe) {
CachedBloodOrbRecipe recipe = forgeShapedRecipe((ShapedBloodOrbRecipe) irecipe);
if (recipe == null) continue;
recipe.computeVisuals();
@@ -76,11 +82,12 @@ public class NEIBloodOrbShapedHandler extends ShapedRecipeHandler {
}
}
@SuppressWarnings("unchecked")
@Override
public void loadCraftingRecipes(ItemStack result) {
for (IRecipe irecipe : CraftingManager.getInstance().getRecipeList()) {
if (irecipe instanceof ShapedBloodOrbRecipe orbRecipe) {
CachedBloodOrbRecipe recipe = forgeShapedRecipe(orbRecipe);
for (IRecipe irecipe : (List<IRecipe>) CraftingManager.getInstance().getRecipeList()) {
if (irecipe instanceof ShapedBloodOrbRecipe) {
CachedBloodOrbRecipe recipe = forgeShapedRecipe((ShapedBloodOrbRecipe) irecipe);
if (recipe == null || !NEIServerUtils.areStacksSameTypeCraftingWithNBT(recipe.result.item, result))
continue;
@@ -90,11 +97,12 @@ public class NEIBloodOrbShapedHandler extends ShapedRecipeHandler {
}
}
@SuppressWarnings("unchecked")
@Override
public void loadUsageRecipes(ItemStack ingredient) {
for (IRecipe irecipe : CraftingManager.getInstance().getRecipeList()) {
for (IRecipe irecipe : (List<IRecipe>) CraftingManager.getInstance().getRecipeList()) {
CachedShapedRecipe recipe = null;
if (irecipe instanceof ShapedBloodOrbRecipe orbRecipe) recipe = forgeShapedRecipe(orbRecipe);
if (irecipe instanceof ShapedBloodOrbRecipe) recipe = forgeShapedRecipe((ShapedBloodOrbRecipe) irecipe);
if (recipe == null || !recipe.contains(recipe.ingredients, ingredient.getItem())) continue;
@@ -126,6 +134,11 @@ public class NEIBloodOrbShapedHandler extends ShapedRecipeHandler {
return new CachedBloodOrbRecipe(width, height, items, recipe.getRecipeOutput());
}
@Override
public void loadTransferRects() {
transferRects.add(new RecipeTransferRect(new Rectangle(84, 23, 24, 18), "crafting"));
}
@Override
public String getRecipeName() {
return StatCollector.translateToLocal("bm.string.crafting.orb.shaped");
@@ -1,5 +1,6 @@
package WayofTime.alchemicalWizardry.client.nei;
import java.awt.Rectangle;
import java.util.ArrayList;
import java.util.List;
@@ -38,10 +39,10 @@ public class NEIBloodOrbShapelessHandler extends ShapelessRecipeHandler {
6 + stackorder[ingred][1] * 18);
stack.setMaxSize(1);
ingredients.add(stack);
} else if (o instanceof Integer i) {
} else if (o instanceof Integer) {
ArrayList<ItemStack> orbs = new ArrayList<>();
for (Item item : NEIConfig.getBloodOrbs()) {
if (((IBloodOrb) item).getOrbLevel() >= i) {
if (((IBloodOrb) item).getOrbLevel() >= (Integer) o) {
orbs.add(new ItemStack(item));
}
}
@@ -64,13 +65,15 @@ public class NEIBloodOrbShapelessHandler extends ShapelessRecipeHandler {
}
}
@SuppressWarnings("unchecked")
@Override
public void loadCraftingRecipes(String outputId, Object... results) {
if (outputId.equals("crafting") && getClass() == NEIBloodOrbShapelessHandler.class) {
List<IRecipe> allRecipes = CraftingManager.getInstance().getRecipeList();
for (IRecipe irecipe : allRecipes) {
List<IRecipe> allrecipes = CraftingManager.getInstance().getRecipeList();
for (IRecipe irecipe : allrecipes) {
CachedBloodOrbRecipe recipe = null;
if (irecipe instanceof ShapelessBloodOrbRecipe orbRecipe) recipe = forgeShapelessRecipe(orbRecipe);
if (irecipe instanceof ShapelessBloodOrbRecipe)
recipe = forgeShapelessRecipe((ShapelessBloodOrbRecipe) irecipe);
if (recipe == null) continue;
@@ -81,13 +84,15 @@ public class NEIBloodOrbShapelessHandler extends ShapelessRecipeHandler {
}
}
@SuppressWarnings("unchecked")
@Override
public void loadCraftingRecipes(ItemStack result) {
List<IRecipe> allRecipes = CraftingManager.getInstance().getRecipeList();
for (IRecipe irecipe : allRecipes) {
List<IRecipe> allrecipes = CraftingManager.getInstance().getRecipeList();
for (IRecipe irecipe : allrecipes) {
if (NEIServerUtils.areStacksSameTypeCraftingWithNBT(irecipe.getRecipeOutput(), result)) {
CachedBloodOrbRecipe recipe = null;
if (irecipe instanceof ShapelessBloodOrbRecipe orbRecipe) recipe = forgeShapelessRecipe(orbRecipe);
if (irecipe instanceof ShapelessBloodOrbRecipe)
recipe = forgeShapelessRecipe((ShapelessBloodOrbRecipe) irecipe);
if (recipe == null) continue;
@@ -96,12 +101,14 @@ public class NEIBloodOrbShapelessHandler extends ShapelessRecipeHandler {
}
}
@SuppressWarnings("unchecked")
@Override
public void loadUsageRecipes(ItemStack ingredient) {
List<IRecipe> allRecipes = CraftingManager.getInstance().getRecipeList();
for (IRecipe irecipe : allRecipes) {
List<IRecipe> allrecipes = CraftingManager.getInstance().getRecipeList();
for (IRecipe irecipe : allrecipes) {
CachedBloodOrbRecipe recipe = null;
if (irecipe instanceof ShapelessBloodOrbRecipe orbRecipe) recipe = forgeShapelessRecipe(orbRecipe);
if (irecipe instanceof ShapelessBloodOrbRecipe)
recipe = forgeShapelessRecipe((ShapelessBloodOrbRecipe) irecipe);
if (recipe == null) continue;
@@ -121,6 +128,16 @@ public class NEIBloodOrbShapelessHandler extends ShapelessRecipeHandler {
return new CachedBloodOrbRecipe(items, recipe.getRecipeOutput());
}
@Override
public void loadTransferRects() {
transferRects.add(new RecipeTransferRect(new Rectangle(84, 23, 24, 18), "crafting"));
}
@Override
public String getOverlayIdentifier() {
return "crafting";
}
@Override
public String getRecipeName() {
return StatCollector.translateToLocal("bm.string.crafting.orb.shapeless");
@@ -45,7 +45,7 @@ import codechicken.nei.recipe.TemplateRecipeHandler;
public class NEIMeteorRecipeHandler extends TemplateRecipeHandler {
private static final RitualInfo ritualInfo = new RitualInfo(0.75f, "AW019FallingTower");
private static final RitualInfo ritualInfo = new RitualInfo("AW019FallingTower", 0.75f);
private static final ReagentInfo reagentInfo = new ReagentInfo(0.75f);
public class CachedMeteorRecipe extends CachedRecipe {
@@ -134,8 +134,8 @@ public class NEIMeteorRecipeHandler extends TemplateRecipeHandler {
}
}
this.costInfo = new CostInfo(1.0f, meteor.cost);
this.radiusInfo = new RadiusInfo(1.0f, meteor.radius);
this.costInfo = new CostInfo(meteor.cost);
this.radiusInfo = new RadiusInfo(meteor.radius);
}
private String getReagentStrings(MeteorComponent component) {
@@ -281,8 +281,9 @@ public class NEIMeteorRecipeHandler extends TemplateRecipeHandler {
CachedMeteorRecipe meteorRecipe = (CachedMeteorRecipe) this.arecipes.get(recipe);
for (PositionedStack pStack : meteorRecipe.outputs) {
// if (!gui.isMouseOver(pStack, recipe)) continue; // put it back when NEI is properly patched
if (!(pStack instanceof TooltipStack tStack)) break;
if (!(pStack instanceof TooltipStack)) break;
TooltipStack tStack = (TooltipStack) pStack;
if (Arrays.stream(tStack.items).anyMatch(s -> NEIServerUtils.areStacksSameTypeCrafting(s, stack))) {
currenttip.addAll(tStack.getTooltips());
break;
@@ -292,33 +293,44 @@ public class NEIMeteorRecipeHandler extends TemplateRecipeHandler {
}
@Override
public List<String> handleTooltip(GuiRecipe<?> gui, List<String> currenttip, int recipeIndex) {
if (GuiContainerManager.shouldShowTooltip(gui) && currenttip.isEmpty()) {
public List<String> handleTooltip(GuiRecipe<?> gui, List<String> list, int recipeIndex) {
if (GuiContainerManager.shouldShowTooltip(gui) && list.isEmpty()) {
CachedRecipe cRecipe = arecipes.get(recipeIndex);
Point mousePos = GuiDraw.getMousePosition();
if (cRecipe instanceof CachedMeteorRecipe cachedRecipe) {
if (cachedRecipe.costInfo.getRect(gui).contains(mousePos)) {
currenttip.add(StatCollector.translateToLocal("nei.recipe.meteor.cost"));
if (cRecipe instanceof CachedMeteorRecipe) {
CachedMeteorRecipe cachedRecipe = (CachedMeteorRecipe) cRecipe;
Rectangle rect = cachedRecipe.costInfo.getRect(gui);
if (rect.contains(mousePos)) {
list.add(StatCollector.translateToLocal("nei.recipe.meteor.cost"));
if (APISpellHelper.getPlayerLPTag(mc.thePlayer) < cachedRecipe.getCost()) {
currenttip.add(
list.add(
EnumChatFormatting.RED
+ StatCollector.translateToLocal("nei.recipe.meteor.tooExpensive"));
}
} else if (cachedRecipe.radiusInfo.getRect(gui).contains(mousePos)) {
currenttip.add(
}
rect = cachedRecipe.radiusInfo.getRect(gui);
if (rect.contains(mousePos)) {
list.add(
StatCollector.translateToLocalFormatted(
"nei.recipe.meteor.diameter",
2 * cachedRecipe.radiusInfo.getRadius() + 1));
} else if (ritualInfo.getRect(gui).contains(mousePos)) {
ritualInfo.onHover(currenttip);
} else if (reagentInfo.getRect(gui).contains(mousePos)) {
reagentInfo.onHover(currenttip);
addMeteorReagentInfo(currenttip, cachedRecipe);
}
rect = ritualInfo.getRect(gui);
if (rect.contains(mousePos)) {
ritualInfo.onHover(list);
}
rect = reagentInfo.getRect(gui);
if (rect.contains(mousePos)) {
reagentInfo.onHover(list);
addMeteorReagentInfo(list, cachedRecipe);
}
}
}
return super.handleTooltip(gui, currenttip, recipeIndex);
return super.handleTooltip(gui, list, recipeIndex);
}
private void addMeteorReagentInfo(List<String> list, CachedMeteorRecipe cachedRecipe) {
@@ -1,33 +0,0 @@
package WayofTime.alchemicalWizardry.client.nei.widgets;
import static WayofTime.alchemicalWizardry.client.ClientUtils.mc;
import java.awt.Rectangle;
import net.minecraft.client.gui.FontRenderer;
import codechicken.nei.recipe.GuiRecipe;
public abstract class BMNEIWidget {
protected final float scale;
public int prevX, prevY;
protected BMNEIWidget(float scale) {
this.scale = scale;
}
public Rectangle getRect(GuiRecipe<?> gui) {
return new Rectangle(gui.guiLeft + prevX + 4, gui.guiTop + prevY + 14, (int) (18 * scale), (int) (18 * scale));
}
protected static void drawCenteredText(int x, int y, String text) {
FontRenderer fontRenderer = mc.fontRenderer;
int textWidth = fontRenderer.getStringWidth(text);
int textX = x + 9 - (textWidth / 2);
int textY = y + 18;
fontRenderer.drawString(text, textX, textY, 0x000000);
}
}
@@ -2,8 +2,10 @@ package WayofTime.alchemicalWizardry.client.nei.widgets;
import static WayofTime.alchemicalWizardry.client.ClientUtils.mc;
import java.awt.Rectangle;
import java.util.ArrayList;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
@@ -13,18 +15,19 @@ import org.lwjgl.opengl.GL11;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBloodOrb;
import WayofTime.alchemicalWizardry.api.spell.APISpellHelper;
import WayofTime.alchemicalWizardry.client.nei.NEIConfig;
import codechicken.nei.recipe.GuiRecipe;
public class CostInfo extends BMNEIWidget {
public class CostInfo {
private final int cost;
private int prevX, prevY;
private final ItemStack orbStack;
private static final RenderItem renderItem = new RenderItem();
static {
renderItem.renderWithColor = false;
}
public CostInfo(float scale, int cost) {
super(scale);
public CostInfo(int cost) {
this.cost = cost;
Item orb = null;
@@ -66,7 +69,18 @@ public class CostInfo extends BMNEIWidget {
GL11.glDisable(GL11.GL_BLEND);
GL11.glPopMatrix();
drawCenteredText(x, y, String.format("%,d", cost));
String costText = String.format("%,d", cost);
FontRenderer fontRenderer = mc.fontRenderer;
int textWidth = fontRenderer.getStringWidth(costText);
int textX = x + 9 - (textWidth / 2);
int textY = y + 18;
fontRenderer.drawString(costText, textX, textY, 0x000000);
}
public Rectangle getRect(GuiRecipe<?> gui) {
return new Rectangle(gui.guiLeft + prevX + 4, gui.guiTop + prevY + 14, 18, 18);
}
}
@@ -2,21 +2,25 @@ package WayofTime.alchemicalWizardry.client.nei.widgets;
import static WayofTime.alchemicalWizardry.client.ClientUtils.mc;
import java.awt.Rectangle;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector;
import WayofTime.alchemicalWizardry.ModItems;
import codechicken.nei.recipe.GuiRecipe;
public class RadiusInfo extends BMNEIWidget {
public class RadiusInfo {
private final int radius;
private int prevX, prevY;
private static final RenderItem renderItem = new RenderItem();
// It's a circle with a dot in the center. Couldn't ask for a better item!
private static final ItemStack item = new ItemStack(ModItems.demonPlacer);
public RadiusInfo(float scale, int radius) {
super(scale);
public RadiusInfo(int radius) {
this.radius = radius;
}
@@ -30,7 +34,18 @@ public class RadiusInfo extends BMNEIWidget {
renderItem.renderItemAndEffectIntoGUI(mc.fontRenderer, mc.getTextureManager(), item, x, y);
drawCenteredText(x, y, StatCollector.translateToLocalFormatted("nei.recipe.meteor.radius", radius));
String costText = StatCollector.translateToLocalFormatted("nei.recipe.meteor.radius", radius);
FontRenderer fontRenderer = mc.fontRenderer;
int textWidth = fontRenderer.getStringWidth(costText);
int textX = x + 9 - (textWidth / 2);
int textY = y + 18;
fontRenderer.drawString(costText, textX, textY, 0x000000);
}
public Rectangle getRect(GuiRecipe<?> gui) {
return new Rectangle(gui.guiLeft + prevX + 5, gui.guiTop + prevY + 15, 16, 16);
}
}
@@ -2,6 +2,7 @@ package WayofTime.alchemicalWizardry.client.nei.widgets;
import static WayofTime.alchemicalWizardry.client.ClientUtils.mc;
import java.awt.Rectangle;
import java.util.List;
import net.minecraft.client.renderer.entity.RenderItem;
@@ -11,14 +12,17 @@ import net.minecraft.util.StatCollector;
import org.lwjgl.opengl.GL11;
import WayofTime.alchemicalWizardry.ModBlocks;
import codechicken.nei.recipe.GuiRecipe;
public class ReagentInfo extends BMNEIWidget {
public class ReagentInfo {
private final float scale;
private int prevX, prevY;
private static final RenderItem renderItem = new RenderItem();
private static final ItemStack item = new ItemStack(ModBlocks.blockReagentConduit);
public ReagentInfo(float scale) {
super(scale);
this.scale = scale;
}
public void onDraw(int x, int y) {
@@ -32,6 +36,10 @@ public class ReagentInfo extends BMNEIWidget {
GL11.glPopMatrix();
}
public Rectangle getRect(GuiRecipe<?> gui) {
return new Rectangle(gui.guiLeft + prevX + 4, gui.guiTop + prevY + 14, (int) (18 * scale), (int) (18 * scale));
}
/**
* Adds the text Reagent effects: to the tooltip list.
*/
@@ -2,6 +2,7 @@ package WayofTime.alchemicalWizardry.client.nei.widgets;
import static WayofTime.alchemicalWizardry.client.ClientUtils.mc;
import java.awt.Rectangle;
import java.util.List;
import net.minecraft.client.renderer.entity.RenderItem;
@@ -12,17 +13,20 @@ import org.lwjgl.opengl.GL11;
import WayofTime.alchemicalWizardry.ModItems;
import WayofTime.alchemicalWizardry.api.rituals.Rituals;
import codechicken.nei.recipe.GuiRecipe;
public class RitualInfo extends BMNEIWidget {
public class RitualInfo {
private final String id;
private final int cost;
private final float scale;
private final ItemStack crystal;
private int prevX, prevY;
private static final RenderItem renderItem = new RenderItem();
public RitualInfo(float scale, String id) {
super(scale);
public RitualInfo(String id, float scale) {
this.id = id;
this.scale = scale;
this.cost = Rituals.getCostForActivation(id);
Rituals r = Rituals.ritualMap.get(id);
@@ -49,6 +53,10 @@ public class RitualInfo extends BMNEIWidget {
GL11.glPopMatrix();
}
public Rectangle getRect(GuiRecipe<?> gui) {
return new Rectangle(gui.guiLeft + prevX + 4, gui.guiTop + prevY + 14, (int) (18 * scale), (int) (18 * scale));
}
public void onHover(List<String> list) {
list.add(
StatCollector
@@ -32,11 +32,8 @@ public class OutputRoutingFocus extends RoutingFocus implements ILimitedRoutingF
}
@Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List<String> par3List,
boolean par4) {
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
super.addInformation(par1ItemStack, par2EntityPlayer, par3List, par4);
if (!(par1ItemStack.getItem() instanceof OutputRoutingFocus focus)) return;
par3List.addAll(focus.getLogic(par1ItemStack).getDescription());
if (!(par1ItemStack.getTagCompound() == null)) {
int limit = this.getRoutingFocusLimit(par1ItemStack);
@@ -58,18 +55,49 @@ public class OutputRoutingFocus extends RoutingFocus implements ILimitedRoutingF
@SideOnly(Side.CLIENT)
public IIcon getIconFromDamage(int damage) {
return switch (damage) {
case 1 -> this.modItemIcon;
case 2 -> this.ignMetaIcon;
case 3 -> this.matchNBTIcon;
case 4 -> this.globalIcon;
default -> this.itemIcon;
};
switch (damage) {
case 0:
return this.itemIcon;
case 1:
return this.modItemIcon;
case 2:
return this.ignMetaIcon;
case 3:
return this.matchNBTIcon;
case 4:
return this.globalIcon;
}
return this.itemIcon;
}
@Override
public String getUnlocalizedName(ItemStack itemStack) {
String addedString = "";
switch (itemStack.getItemDamage()) {
case 0:
addedString = "default";
break;
case 1:
addedString = "modItem";
break;
case 2:
addedString = "ignMeta";
break;
case 3:
addedString = "matchNBT";
break;
case 4:
addedString = "global";
break;
}
return super.getUnlocalizedName() + "." + addedString;
}
@Override
@SideOnly(Side.CLIENT)
public void getSubItems(Item id, CreativeTabs creativeTab, List<ItemStack> list) {
public void getSubItems(Item id, CreativeTabs creativeTab, List list) {
for (int meta = 0; meta < 5; ++meta) {
list.add(new ItemStack(id, 1, meta));
}
@@ -78,14 +106,18 @@ public class OutputRoutingFocus extends RoutingFocus implements ILimitedRoutingF
@Override
public RoutingFocusLogic getLogic(ItemStack itemStack) {
if (itemStack != null) {
return switch (itemStack.getItemDamage()) {
case 0 -> new RoutingFocusLogicLimitDefault(itemStack);
case 1 -> new RoutingFocusLogicLimitModItems(itemStack);
case 2 -> new RoutingFocusLogicLimitIgnMeta(itemStack);
case 3 -> new RoutingFocusLogicLimitMatchNBT(itemStack);
case 4 -> new RoutingFocusLogicLimitGlobal(itemStack);
default -> new RoutingFocusLogic();
};
switch (itemStack.getItemDamage()) {
case 0:
return new RoutingFocusLogicLimitDefault(itemStack);
case 1:
return new RoutingFocusLogicLimitModItems(itemStack);
case 2:
return new RoutingFocusLogicLimitIgnMeta(itemStack);
case 3:
return new RoutingFocusLogicLimitMatchNBT(itemStack);
case 4:
return new RoutingFocusLogicLimitGlobal(itemStack);
}
}
return new RoutingFocusLogic();
@@ -74,8 +74,7 @@ public class RoutingFocus extends Item {
}
@Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List<String> par3List,
boolean par4) {
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
par3List.add(StatCollector.translateToLocal(this.getFocusDescription()));
if (!(par1ItemStack.getTagCompound() == null)) {
@@ -90,9 +89,7 @@ public class RoutingFocus extends Item {
+ itemTag.getInteger("zCoord"));
par3List.add(
StatCollector.translateToLocal("tooltip.alchemy.direction") + " "
+ StatCollector.translateToLocal(
"message.ritual.side."
+ this.getSetDirection(par1ItemStack).toString().toLowerCase()));
+ this.getSetDirection(par1ItemStack));
}
}
@@ -171,17 +168,4 @@ public class RoutingFocus extends Item {
public RoutingFocusLogic getLogic(ItemStack itemStack) {
return new RoutingFocusLogic();
}
public String getName(ItemStack stack) {
if (stack.hasTagCompound()) {
NBTTagCompound tag = stack.getTagCompound();
if (tag.hasKey("display", 10)) {
NBTTagCompound display = tag.getCompoundTag("display");
if (display.hasKey("Name", 8)) {
return display.getString("Name");
}
}
}
return "";
}
}
@@ -1,7 +1,10 @@
package WayofTime.alchemicalWizardry.common.rituals;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.ISidedInventory;
@@ -17,142 +20,226 @@ import WayofTime.alchemicalWizardry.api.RoutingFocusPosAndFacing;
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import WayofTime.alchemicalWizardry.common.items.routing.InputRoutingFocus;
import WayofTime.alchemicalWizardry.common.items.routing.OutputRoutingFocus;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
public class RitualEffectItemRouting extends RitualEffect {
private static final Int3[] INPUT_BUFFER_LOCATIONS = { new Int3(1, 0, 0), new Int3(-1, 0, 0), new Int3(0, 0, 1),
new Int3(0, 0, -1) };
private static final Int3[] OUTPUT_BUFFER_LOCATIONS = { new Int3(2, 0, 2), new Int3(-2, 0, 2), new Int3(2, 0, -2),
new Int3(-2, 0, -2) };
Random rand = new Random();
@Override
public void performEffect(IMasterRitualStone ritualStone) {
String owner = ritualStone.getOwner();
int currentEssence = SoulNetworkHandler.getCurrentEssence(owner);
World world = ritualStone.getWorld();
int x = ritualStone.getXCoord();
int y = ritualStone.getYCoord();
int z = ritualStone.getZCoord();
if (world.getTotalWorldTime() % 20 != 0) return;
List<IInventory> outputFocusChests = findBufferChests(world, x, y, z, OUTPUT_BUFFER_LOCATIONS);
if (outputFocusChests.isEmpty()) return;
List<IInventory> inputFocusChests = findBufferChests(world, x, y, z, INPUT_BUFFER_LOCATIONS);
if (inputFocusChests.isEmpty()) return;
for (IInventory outputFoci : outputFocusChests) {
processOutputFoci(world, outputFoci, inputFocusChests);
if (world.getTotalWorldTime() % 20 != 0) {
return;
}
}
private void processOutputFoci(World world, IInventory outputFoci, List<IInventory> inputFocusChests) {
RoutingFocusParadigm paradigm = new RoutingFocusParadigm();
boolean lastItemWasFocus = true;
Map<Int3, IInventory> tileMap = new HashMap();
for (int i = 0; i < outputFoci.getSizeInventory(); i++) {
ItemStack keyStack = outputFoci.getStackInSlot(i);
if (keyStack == null) continue;
if (keyStack.getItem() instanceof OutputRoutingFocus outputFocus) {
if (!lastItemWasFocus) paradigm.clear();
paradigm.addRoutingFocusPosAndFacing(outputFocus.getPosAndFacing(keyStack));
paradigm.addLogic(outputFocus.getLogic(keyStack));
paradigm.addName(outputFocus.getName(keyStack));
lastItemWasFocus = true;
continue;
List<IInventory> outputList = new ArrayList();
for (int i = 0; i < 4; i++) // Check output foci chests, return if none available
{
Int3 outputFocusChest = this.getOutputBufferChestLocation(i);
TileEntity outputFocusInv = world.getTileEntity(
x + outputFocusChest.xCoord,
y + outputFocusChest.yCoord,
z + outputFocusChest.zCoord);
if (outputFocusInv instanceof IInventory) {
outputList.add((IInventory) outputFocusInv);
}
lastItemWasFocus = false;
}
for (RoutingFocusPosAndFacing posAndFacing : paradigm.locationList) {
if (posAndFacing == null) continue;
ForgeDirection inputDirection = posAndFacing.facing;
TileEntity outputTarget = world.getTileEntity(
posAndFacing.location.xCoord,
posAndFacing.location.yCoord,
posAndFacing.location.zCoord);
if (outputList.isEmpty()) {
return;
}
if (!(outputTarget instanceof IInventory outputInventory)) continue;
for (IInventory outputFocusInventory : outputList) {
{
OutputRoutingFocus outputFocus;;
for (IInventory inputFoci : inputFocusChests) {
processInputFoci(world, inputFoci, keyStack, paradigm, outputInventory, inputDirection);
RoutingFocusParadigm parad = new RoutingFocusParadigm();
TileEntity outputChest = null; // Destination
ForgeDirection inputDirection;
{
IInventory outputChestInventory = null;
boolean lastItemWasFocus = true;
for (int j = 0; j < outputFocusInventory.getSizeInventory(); j++) {
ItemStack keyStack = outputFocusInventory.getStackInSlot(j);
if (keyStack == null) {
continue;
}
if (keyStack.getItem() instanceof OutputRoutingFocus) {
if (!lastItemWasFocus) {
parad.clear();
}
outputFocus = (OutputRoutingFocus) keyStack.getItem();
parad.addRoutingFocusPosAndFacing(outputFocus.getPosAndFacing(keyStack));
parad.addLogic(outputFocus.getLogic(keyStack));
lastItemWasFocus = true;
continue;
} else {
lastItemWasFocus = false;
}
for (RoutingFocusPosAndFacing posAndFacing : parad.locationList) {
if (posAndFacing == null) {
continue;
}
inputDirection = posAndFacing.facing;
if (outputChest == null || !posAndFacing.location
.equals(new Int3(outputChest.xCoord, outputChest.yCoord, outputChest.zCoord))) {
outputChest = world.getTileEntity(
posAndFacing.location.xCoord,
posAndFacing.location.yCoord,
posAndFacing.location.zCoord);
if (outputChest instanceof IInventory) {
outputChestInventory = (IInventory) outputChest;
} else {
continue;
}
}
for (int i = 0; i < 4; i++) {
Int3 inputFocusChest = this.getInputBufferChestLocation(i);
TileEntity inputFocusInv = world.getTileEntity(
x + inputFocusChest.xCoord,
y + inputFocusChest.yCoord,
z + inputFocusChest.zCoord);
if (inputFocusInv instanceof IInventory) {
for (int ji = 0; ji < ((IInventory) inputFocusInv).getSizeInventory(); ji++) // Iterate
// through
// foci
// inventory
{
ItemStack inputFocusStack = ((IInventory) inputFocusInv).getStackInSlot(ji);
if (inputFocusStack != null
&& inputFocusStack.getItem() instanceof InputRoutingFocus) {
InputRoutingFocus inputFocus = (InputRoutingFocus) inputFocusStack
.getItem();
TileEntity inputChest = world.getTileEntity(
inputFocus.xCoord(inputFocusStack),
inputFocus.yCoord(inputFocusStack),
inputFocus.zCoord(inputFocusStack));
if (inputChest instanceof IInventory) {
IInventory inputChestInventory = (IInventory) inputChest;
ForgeDirection syphonDirection = inputFocus
.getSetDirection(inputFocusStack);
boolean[] canSyphonList = new boolean[inputChestInventory
.getSizeInventory()];
if (inputChest instanceof ISidedInventory) {
int[] validSlots = ((ISidedInventory) inputChest)
.getAccessibleSlotsFromSide(syphonDirection.ordinal());
for (int in : validSlots) {
canSyphonList[in] = true;
}
} else {
for (int ni = 0; ni
< inputChestInventory.getSizeInventory(); ni++) {
canSyphonList[ni] = true;
}
}
for (int ni = 0; ni < inputChestInventory.getSizeInventory(); ni++) {
if (canSyphonList[ni]) {
ItemStack syphonedStack = inputChestInventory
.getStackInSlot(ni); // Has a syphoned item linked, next
// need to find a
// destination
if (syphonedStack == null
|| (inputChestInventory instanceof ISidedInventory
&& !((ISidedInventory) inputChestInventory)
.canExtractItem(
ni,
syphonedStack,
syphonDirection.ordinal()))) {
continue;
}
int size = syphonedStack.stackSize;
if (parad.doesItemMatch(keyStack, syphonedStack)) {
ItemStack newStack = null;
if (parad.maximumAmount <= 0) {
newStack = SpellHelper.insertStackIntoInventory(
syphonedStack,
outputChestInventory,
inputDirection);
} else {
newStack = SpellHelper.insertStackIntoInventory(
syphonedStack,
outputChestInventory,
inputDirection,
parad.maximumAmount);
}
if (size == newStack.stackSize) {
continue;
}
int numberSyphoned = size - newStack.stackSize;
if (newStack != null && newStack.stackSize <= 0) {
size = newStack.stackSize;
newStack = null;
}
inputChestInventory.setInventorySlotContents(ni, newStack);
// break;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
private void processInputFoci(World world, IInventory inputFoci, ItemStack keyStack, RoutingFocusParadigm paradigm,
IInventory outputInventory, ForgeDirection inputDirection) {
for (int i = 0; i < inputFoci.getSizeInventory(); i++) {
ItemStack inputFocusStack = inputFoci.getStackInSlot(i);
if (inputFocusStack == null || !(inputFocusStack.getItem() instanceof InputRoutingFocus inputFocus))
continue;
if (!paradigm.doesNameMatch(inputFocus.getName(inputFocusStack))) continue;
TileEntity inputTarget = world.getTileEntity(
inputFocus.xCoord(inputFocusStack),
inputFocus.yCoord(inputFocusStack),
inputFocus.zCoord(inputFocusStack));
if (!(inputTarget instanceof IInventory inputChest)) continue;
boolean[] slotList = checkSlots(inputChest, inputFocus.getSetDirection(inputFocusStack));
for (int j = 0; j < inputChest.getSizeInventory(); j++) {
if (!slotList[j]) continue;
ItemStack syphonedStack = inputChest.getStackInSlot(j);
if (!canExtractItem(inputChest, j, syphonedStack, inputFocus.getSetDirection(inputFocusStack)))
continue;
if (paradigm.doesItemMatch(keyStack, syphonedStack)) {
ItemStack newStack = insertStackWithLimit(
syphonedStack,
outputInventory,
inputDirection,
paradigm.maximumAmount);
inputChest.setInventorySlotContents(
j,
(newStack != null && newStack.stackSize > 0) ? newStack : null);
}
}
public Int3 getInputBufferChestLocation(int number) {
switch (number) {
case 0:
return new Int3(1, 0, 0);
case 1:
return new Int3(-1, 0, 0);
case 2:
return new Int3(0, 0, 1);
case 3:
return new Int3(0, 0, -1);
}
return new Int3(0, 0, 0);
}
private boolean[] checkSlots(IInventory inventory, ForgeDirection direction) {
boolean[] result = new boolean[inventory.getSizeInventory()];
if (inventory instanceof ISidedInventory sidedInv) {
int[] validSlots = sidedInv.getAccessibleSlotsFromSide(direction.ordinal());
for (int slot : validSlots) result[slot] = true;
} else {
for (int i = 0; i < inventory.getSizeInventory(); i++) result[i] = true;
public Int3 getOutputBufferChestLocation(int number) {
switch (number) {
case 0:
return new Int3(2, 0, 2);
case 1:
return new Int3(-2, 0, 2);
case 2:
return new Int3(2, 0, -2);
case 3:
return new Int3(-2, 0, -2);
}
return result;
}
private boolean canExtractItem(IInventory inventory, int slot, ItemStack stack, ForgeDirection direction) {
return stack != null && (!(inventory instanceof ISidedInventory)
|| ((ISidedInventory) inventory).canExtractItem(slot, stack, direction.ordinal()));
}
private ItemStack insertStackWithLimit(ItemStack stack, IInventory inventory, ForgeDirection direction,
int maxAmount) {
return maxAmount <= 0 ? SpellHelper.insertStackIntoInventory(stack, inventory, direction)
: SpellHelper.insertStackIntoInventory(stack, inventory, direction, maxAmount);
}
private List<IInventory> findBufferChests(World world, int x, int y, int z, Int3[] locations) {
List<IInventory> chestList = new ArrayList<>();
for (Int3 chestLocation : locations) {
TileEntity tileEntity = world
.getTileEntity(x + chestLocation.xCoord, y + chestLocation.yCoord, z + chestLocation.zCoord);
if (tileEntity instanceof IInventory inv) {
chestList.add(inv);
}
}
return chestList;
return new Int3(0, 0, 0);
}
@Override
@@ -162,14 +249,14 @@ public class RitualEffectItemRouting extends RitualEffect {
@Override
public List<RitualComponent> getRitualComponentList() {
ArrayList<RitualComponent> itemRoutingRitual = new ArrayList<>();
ArrayList<RitualComponent> omegaRitual = new ArrayList();
this.addCornerRunes(itemRoutingRitual, 1, 0, RitualComponent.BLANK);
this.addOffsetRunes(itemRoutingRitual, 2, 1, 0, RitualComponent.FIRE);
this.addParallelRunes(itemRoutingRitual, 4, 0, RitualComponent.WATER);
this.addParallelRunes(itemRoutingRitual, 5, 0, RitualComponent.EARTH);
this.addCornerRunes(itemRoutingRitual, 4, 0, RitualComponent.WATER);
this.addCornerRunes(omegaRitual, 1, 0, RitualComponent.BLANK);
this.addOffsetRunes(omegaRitual, 2, 1, 0, RitualComponent.FIRE);
this.addParallelRunes(omegaRitual, 4, 0, RitualComponent.WATER);
this.addParallelRunes(omegaRitual, 5, 0, RitualComponent.EARTH);
this.addCornerRunes(omegaRitual, 4, 0, RitualComponent.WATER);
return itemRoutingRitual;
return omegaRitual;
}
}
@@ -1,11 +1,6 @@
package WayofTime.alchemicalWizardry.common.routing;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector;
import WayofTime.alchemicalWizardry.api.RoutingFocusLogic;
@@ -13,13 +8,6 @@ public class RoutingFocusLogicIgnMeta extends RoutingFocusLogic {
@Override
public boolean getDefaultMatch(ItemStack keyStack, ItemStack checkedStack) {
return (keyStack != null && checkedStack != null && keyStack.getItem() == checkedStack.getItem());
}
public List<String> getDescription() {
return new ArrayList<>(
Collections.singletonList(
StatCollector.translateToLocal("tooltip.routingFocus.logic") + " "
+ StatCollector.translateToLocal("item.outputRoutingFocus.ignMeta.logic")));
return (keyStack != null ? checkedStack != null && keyStack.getItem() == checkedStack.getItem() : false);
}
}
@@ -11,6 +11,8 @@ public class RoutingFocusLogicLimitDefault extends RoutingFocusLogicLimit {
public RoutingFocusLogicLimitDefault(ItemStack stack) {
if (stack != null && stack.getItem() instanceof ILimitedRoutingFocus) {
limit = ((ILimitedRoutingFocus) stack.getItem()).getRoutingFocusLimit(stack);
} else {
limit = 0;
}
}
@@ -1,11 +1,6 @@
package WayofTime.alchemicalWizardry.common.routing;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector;
import WayofTime.alchemicalWizardry.common.items.routing.ILimitedRoutingFocus;
@@ -16,6 +11,8 @@ public class RoutingFocusLogicLimitGlobal extends RoutingFocusLogicLimit {
public RoutingFocusLogicLimitGlobal(ItemStack stack) {
if (stack != null && stack.getItem() instanceof ILimitedRoutingFocus) {
limit = ((ILimitedRoutingFocus) stack.getItem()).getRoutingFocusLimit(stack);
} else {
limit = 0;
}
}
@@ -28,11 +25,4 @@ public class RoutingFocusLogicLimitGlobal extends RoutingFocusLogicLimit {
public boolean getDefaultMatch(ItemStack keyStack, ItemStack checkedStack) {
return true;
}
public List<String> getDescription() {
return new ArrayList<>(
Collections.singletonList(
StatCollector.translateToLocal("tooltip.routingFocus.logic") + " "
+ StatCollector.translateToLocal("item.outputRoutingFocus.global.logic")));
}
}
@@ -12,6 +12,8 @@ public class RoutingFocusLogicLimitIgnMeta extends RoutingFocusLogicIgnMeta impl
public RoutingFocusLogicLimitIgnMeta(ItemStack stack) {
if (stack != null && stack.getItem() instanceof ILimitedRoutingFocus) {
limit = ((ILimitedRoutingFocus) stack.getItem()).getRoutingFocusLimit(stack);
} else {
limit = 0;
}
}
@@ -12,6 +12,8 @@ public class RoutingFocusLogicLimitMatchNBT extends RoutingFocusLogicMatchNBT im
public RoutingFocusLogicLimitMatchNBT(ItemStack stack) {
if (stack != null && stack.getItem() instanceof ILimitedRoutingFocus) {
limit = ((ILimitedRoutingFocus) stack.getItem()).getRoutingFocusLimit(stack);
} else {
limit = 0;
}
}
@@ -12,6 +12,8 @@ public class RoutingFocusLogicLimitModItems extends RoutingFocusLogicModItems im
public RoutingFocusLogicLimitModItems(ItemStack stack) {
if (stack != null && stack.getItem() instanceof ILimitedRoutingFocus) {
limit = ((ILimitedRoutingFocus) stack.getItem()).getRoutingFocusLimit(stack);
} else {
limit = 0;
}
}
@@ -1,33 +1,20 @@
package WayofTime.alchemicalWizardry.common.routing;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector;
import WayofTime.alchemicalWizardry.api.RoutingFocusLogic;
public class RoutingFocusLogicMatchNBT extends RoutingFocusLogic {
public boolean getDefaultMatch(ItemStack keyStack, ItemStack checkedStack) {
return (keyStack != null && keyStack.getItem() != null
&& checkedStack != null
&& keyStack.getItem() == checkedStack.getItem()
&& (!keyStack.getItem().getHasSubtypes() || keyStack.getItemDamage() == checkedStack.getItemDamage())
&& ItemStack.areItemStackTagsEqual(keyStack, checkedStack));
return (keyStack != null ? checkedStack != null && keyStack.getItem() == checkedStack.getItem()
&& (keyStack.getItem().getHasSubtypes() ? keyStack.getItemDamage() == checkedStack.getItemDamage()
: true)
&& keyStack.areItemStackTagsEqual(keyStack, checkedStack) : false);
}
@Override
public boolean doesItemMatch(boolean previous, ItemStack keyStack, ItemStack checkedStack) {
return previous && this.getDefaultMatch(keyStack, checkedStack);
}
public List<String> getDescription() {
return new ArrayList<>(
Collections.singletonList(
StatCollector.translateToLocal("tooltip.routingFocus.logic") + " "
+ StatCollector.translateToLocal("item.outputRoutingFocus.matchNBT.logic")));
}
}
@@ -1,12 +1,7 @@
package WayofTime.alchemicalWizardry.common.routing;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector;
import WayofTime.alchemicalWizardry.api.RoutingFocusLogic;
import cpw.mods.fml.common.registry.GameData;
@@ -28,18 +23,11 @@ public class RoutingFocusLogicModItems extends RoutingFocusLogic {
String str = GameData.getItemRegistry().getNameForObject(itm);
if (!str.isEmpty()) {
String[] strs = str.split(":");
if (strs.length >= 1) {
if (strs != null && strs.length >= 1) {
return strs[0];
}
}
return "";
}
public List<String> getDescription() {
return new ArrayList<>(
Collections.singletonList(
StatCollector.translateToLocal("tooltip.routingFocus.logic") + " "
+ StatCollector.translateToLocal("item.outputRoutingFocus.modItem.logic")));
}
}
@@ -230,11 +230,11 @@ item.itemMailCatalogue.name=Mail Order Catalogue
item.inputRoutingFocus.name=Input Routing Focus
item.bloodMagicBaseItem.EnderShard.name=Ender Shard
item.outputRoutingFocus.name=Output Routing Focus
item.outputRoutingFocus.default.logic=Match Item & Meta
item.outputRoutingFocus.modItem.logic=Match Mod
item.outputRoutingFocus.ignMeta.logic=Match Item, Ignore Meta
item.outputRoutingFocus.matchNBT.logic=Match Item, Meta, & NBT
item.outputRoutingFocus.global.logic=Move Everything
item.outputRoutingFocus.default.name=Default Output Routing Focus
item.outputRoutingFocus.modItem.name=Output Routing Focus (ModItem)
item.outputRoutingFocus.ignMeta.name=Output Routing Focus (Ignore Meta)
item.outputRoutingFocus.matchNBT.name=Output Routing Focus (MatchNBT)
item.outputRoutingFocus.global.name=Output Routing Focus (Global)
item.dawnScribeTool.name=Elemental Inscription Tool: Dawn
item.boundHelmetEarth.name=Earth Omega Helmet
item.boundPlateEarth.name=Earth Omega Plate
@@ -533,7 +533,6 @@ tooltip.telepositionfocus.desc=An Enderpearl imbued with blood
tooltip.voidsigil.desc=Better than a Swiffer!
tooltip.watersigil.desc=Infinite water, anyone?
tooltip.routingFocus.limit=Limit:
tooltip.routingFocus.logic=Logic:
tooltip.routingFocus.desc=A focus used to route items
tooltip.alchemy.usedinincense=Purifying incense used in a crucible
@@ -567,8 +566,6 @@ message.masterstone.ritualresistyou=The ritual appears to actively resist you!
message.masterstone.somethingstoppedyou=Something stopped you in your tracks...
message.masterstone.youfeelapull=You feel a pull, but you are too weak to push any further.
message.ritual.currentritual=Current Ritual:
message.ritual.side.up=UP
message.ritual.side.down=DOWN
message.ritual.side.east=EAST
message.ritual.side.north=NORTH
message.ritual.side.south=SOUTH
@@ -212,7 +212,11 @@ item.transcendentBloodOrb.name=Трансцендентальный кровав
item.itemMailCatalogue.name=Mail Order Catalogue
item.inputRoutingFocus.name=Фокус направления входа
item.bloodMagicBaseItem.EnderShard.name=Осколок Края
item.outputRoutingFocus.name=фокус направления выхода
item.outputRoutingFocus.default.name=Обычный фокус направления выхода
item.outputRoutingFocus.modItem.name=Фокус направления выхода (ModItem)
item.outputRoutingFocus.ignMeta.name=Фокус направления выхода (Ignore Meta)
item.outputRoutingFocus.matchNBT.name=Фокус направления выхода (MatchNBT)
item.outputRoutingFocus.global.name=Фокус направления выхода (Global)
item.dawnScribeTool.name=Elemental Inscription Tool: Dawn
item.boundHelmetEarth.name=Земляной омега шлем
item.boundPlateEarth.name=Земляная омега кираса
@@ -440,8 +444,6 @@ message.masterstone.ritualresistyou=Ритуал, кажется, защищае
message.masterstone.somethingstoppedyou=Что-то останавливает Вас...
message.masterstone.youfeelapull=Вы чувствуете втягивание, но Вы слишком слабы, чтобы толкать дальше.
message.ritual.currentritual=Текущий ритуал:
message.ritual.side.up=ВВЕРХ
message.ritual.side.down=ВНИЗ
message.ritual.side.east=ВОСТОК
message.ritual.side.north=СЕВЕР
message.ritual.side.south=ЮГ
@@ -218,11 +218,11 @@ item.transcendentBloodOrb.name=卓越气血宝珠
item.itemMailCatalogue.name=邮购目录
item.inputRoutingFocus.name=输入路由核心
item.bloodMagicBaseItem.EnderShard.name=末影碎片
item.outputRoutingFocus.name=输出路由核心
item.outputRoutingFocus.default.logic=默认
item.outputRoutingFocus.modItem.logic=模组物品
item.outputRoutingFocus.ignMeta.logic=数据值忽视
item.outputRoutingFocus.matchNBT.logic=NBT匹配
item.outputRoutingFocus.default.name=输出路由核心(默认)
item.outputRoutingFocus.modItem.name=输出路由核心(模组物品)
item.outputRoutingFocus.ignMeta.name=输出路由核心(数据值忽视)
item.outputRoutingFocus.matchNBT.name=输出路由核心(NBT匹配)
item.outputRoutingFocus.global.name=输出路由核心(Global)
item.dawnScribeTool.name=元素铭文:破晓
item.boundHelmetEarth.name=土`欧米伽头盔
item.boundPlateEarth.name=土`欧米伽胸甲
@@ -539,8 +539,6 @@ message.masterstone.ritualresistyou=仪式似乎在积极的抵抗你!
message.masterstone.somethingstoppedyou=有什么东西使你的路径堵塞...
message.masterstone.youfeelapull=你感到一股拉力,但没有足够的能量促进其发生.
message.ritual.currentritual=目前仪式:
message.ritual.side.up=上
message.ritual.side.down=下
message.ritual.side.east=东
message.ritual.side.north=北
message.ritual.side.south=南
@@ -213,12 +213,11 @@ item.transcendentBloodOrb.name=卓越氣血寶珠
item.itemMailCatalogue.name=Mail Order Catalogue
item.inputRoutingFocus.name=Input Routing Focus
item.bloodMagicBaseItem.EnderShard.name=Ender Shard
item.outputRoutingFocus.name=Default Output Routing Focus
item.outputRoutingFocus.default.logic=Match Item & Meta
item.outputRoutingFocus.modItem.logic=Match Mod
item.outputRoutingFocus.ignMeta.logic=Match Item, Ignore Meta
item.outputRoutingFocus.matchNBT.logic=Match Item, Meta, & NBT
item.outputRoutingFocus.global.logic=Move Everything
item.outputRoutingFocus.default.name=Default Output Routing Focus
item.outputRoutingFocus.modItem.name=Output Routing Focus (ModItem)
item.outputRoutingFocus.ignMeta.name=Output Routing Focus (Ignore Meta)
item.outputRoutingFocus.matchNBT.name=Output Routing Focus (MatchNBT)
item.outputRoutingFocus.global.name=Output Routing Focus (Global)
item.dawnScribeTool.name=Elemental Inscription Tool: Dawn
item.boundHelmetEarth.name=Earth Omega Helmet
item.boundPlateEarth.name=Earth Omega Plate
@@ -453,8 +452,6 @@ message.masterstone.ritualresistyou=The ritual appears to actively resist you!
message.masterstone.somethingstoppedyou=Something stopped you in your tracks...
message.masterstone.youfeelapull=You feel a pull, but you are too weak to push any further.
message.ritual.currentritual=Current Ritual:
message.ritual.side.up=上
message.ritual.side.down=下
message.ritual.side.east=東
message.ritual.side.north=北
message.ritual.side.south=南