mirror of
https://github.com/GTNewHorizons/JustEnoughCalculation.git
synced 2026-11-12 16:27:32 +00:00
Generally finished record edit, start on percentage support
This commit is contained in:
1 parent
e227cdc927
commit
2e50583d36
16 files changed
+342
-227
No files matched your search
@@ -75,12 +75,12 @@ public class Calculator {
|
||||
List<ItemRecord> input = new LinkedList<>();
|
||||
for(ItemStack itemStack : currentOperate.recipe.output){
|
||||
if(itemStack != null){
|
||||
output.add(new ItemRecord(itemStack, currentOperate.count*itemStack.stackSize));
|
||||
output.add(new ItemRecord(itemStack, currentOperate.count*ItemStackWrapper.getUnifiedAmount(itemStack)));
|
||||
}
|
||||
}
|
||||
for(ItemStack itemStack : currentOperate.recipe.input){
|
||||
if(itemStack != null){
|
||||
input.add(new ItemRecord(itemStack, currentOperate.count*itemStack.stackSize));
|
||||
input.add(new ItemRecord(itemStack, currentOperate.count*ItemStackWrapper.getUnifiedAmount(itemStack)));
|
||||
}
|
||||
}
|
||||
return new Calculator.CostRecord(output, input);
|
||||
|
||||
@@ -16,54 +16,41 @@ public class ItemStackWrapper {
|
||||
return ItemStack.areItemStacksEqual(one, two);
|
||||
}
|
||||
|
||||
public static boolean isSwapAcceptable(ItemStack in, ItemStack out){
|
||||
return !isTypeEqual(in, out) || getUnifiedAmount(in) < getUnifiedAmount(out);
|
||||
}
|
||||
|
||||
public static ItemStack unify(ItemStack itemStack){
|
||||
if(itemStack == null){
|
||||
return null;
|
||||
}
|
||||
NBTTagCompound nbtTagCompound = new NBTTagCompound();
|
||||
nbtTagCompound.setInteger("count", getNormalAmount(itemStack));
|
||||
nbtTagCompound.setBoolean("approx", false);
|
||||
ItemStack buffer = new ItemStack(itemStack.getItem(), 1, itemStack.getMetadata());
|
||||
buffer.setTagCompound(nbtTagCompound);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
public static ItemStack unify(ItemStack itemStack, int amount){
|
||||
NBTTagCompound nbtTagCompound = new NBTTagCompound();
|
||||
nbtTagCompound.setInteger("count", amount*100);
|
||||
nbtTagCompound.setBoolean("approx", false);
|
||||
ItemStack buffer = new ItemStack(itemStack.getItem(), 1, itemStack.getMetadata());
|
||||
buffer.setTagCompound(nbtTagCompound);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
public static int getUnifiedAmount(ItemStack itemStack){
|
||||
if(itemStack.hasTagCompound()){
|
||||
return itemStack.getTagCompound().getInteger("count");
|
||||
return itemStack.getTagCompound().getInteger("percentage");
|
||||
}else {
|
||||
return itemStack.stackSize;
|
||||
return itemStack.stackSize*100;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean getUnifiedApprox(ItemStack itemStack) {
|
||||
return itemStack.hasTagCompound() && itemStack.getTagCompound().getBoolean("approx");
|
||||
}
|
||||
|
||||
public static int getNormalAmount(ItemStack itemStack){
|
||||
return itemStack.stackSize*100;
|
||||
}
|
||||
|
||||
public static String getDisplayAmount(ItemStack itemStack){
|
||||
if(itemStack != null && itemStack.getTagCompound() != null){
|
||||
return itemStack.getTagCompound().getLong("amount")+"";
|
||||
long l = itemStack.getTagCompound().getLong("amount");
|
||||
if(l%100==0){
|
||||
return String.valueOf(l/100);
|
||||
}else {
|
||||
return String.valueOf(l/100 + 1);
|
||||
}
|
||||
}
|
||||
else return "";
|
||||
}
|
||||
|
||||
public static ItemStack toPercentage(ItemStack itemStack){
|
||||
NBT.setInt(itemStack, "percentage", 50);
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
public static ItemStack toNormal(ItemStack itemStack){
|
||||
itemStack.setTagCompound(null);
|
||||
itemStack.stackSize = 1;
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
public static class NBT {
|
||||
public static void initNBT(ItemStack itemStack){
|
||||
if(!itemStack.hasTagCompound()){
|
||||
@@ -100,6 +87,11 @@ public class ItemStackWrapper {
|
||||
dest.getTagCompound().setString(key, value);
|
||||
}
|
||||
|
||||
public static void setInt(ItemStack dest, String key, int value){
|
||||
initNBT(dest);
|
||||
dest.getTagCompound().setInteger(key, value);
|
||||
}
|
||||
|
||||
public static String getString(ItemStack dest, String key){
|
||||
if(dest.getTagCompound() != null){
|
||||
return dest.getTagCompound().getString(key);
|
||||
@@ -107,6 +99,13 @@ public class ItemStackWrapper {
|
||||
else return "";
|
||||
}
|
||||
|
||||
public static int getInt(ItemStack dest, String key){
|
||||
if(dest.getTagCompound() != null){
|
||||
return dest.getTagCompound().getInteger(key);
|
||||
}
|
||||
else return 0;
|
||||
}
|
||||
|
||||
public static long getLong(ItemStack dest, String key){
|
||||
if(dest.getTagCompound() != null){
|
||||
return dest.getTagCompound().getLong(key);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package pers.towdium.justEnoughCalculation.core;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -117,6 +118,26 @@ public class Recipe {
|
||||
return true;
|
||||
}
|
||||
|
||||
public ImmutableList<ItemStack> getOutput(){
|
||||
ImmutableList.Builder<ItemStack> builder = new ImmutableList.Builder<>();
|
||||
for(ItemStack itemStack : output){
|
||||
if(itemStack != null){
|
||||
builder.add(itemStack.copy());
|
||||
}
|
||||
}
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
public ImmutableList<ItemStack> getInput(){
|
||||
ImmutableList.Builder<ItemStack> builder = new ImmutableList.Builder<>();
|
||||
for(ItemStack itemStack : input){
|
||||
if(itemStack != null){
|
||||
builder.add(itemStack.copy());
|
||||
}
|
||||
}
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
public static class ByteBufUtl{
|
||||
public static Recipe fromByte(ByteBuf buf){
|
||||
short a = buf.readShort();
|
||||
@@ -207,6 +228,4 @@ public class Recipe {
|
||||
return new Recipe(output, input);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -3,10 +3,9 @@ package pers.towdium.justEnoughCalculation.gui;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.common.network.IGuiHandler;
|
||||
import pers.towdium.justEnoughCalculation.JustEnoughCalculation;
|
||||
import pers.towdium.justEnoughCalculation.gui.guis.calculator.ContainerCalculator;
|
||||
import pers.towdium.justEnoughCalculation.gui.guis.calculator.GuiCalculator;
|
||||
import pers.towdium.justEnoughCalculation.gui.guis.itemPicker.ContainerItemPicker;
|
||||
import pers.towdium.justEnoughCalculation.gui.guis.itemPicker.GuiItemPicker;
|
||||
import pers.towdium.justEnoughCalculation.gui.commom.recipe.ContainerRecipe;
|
||||
import pers.towdium.justEnoughCalculation.gui.guis.recipeEditor.ContainerRecipeEditor;
|
||||
import pers.towdium.justEnoughCalculation.gui.guis.recipeEditor.GuiRecipeEditor;
|
||||
@@ -33,9 +32,8 @@ public class GuiHandler implements IGuiHandler {
|
||||
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
switch (ID) {
|
||||
case GuiId.CALCULATOR: return new GuiCalculator(new ContainerCalculator(player, player.getHeldItem()));
|
||||
case GuiId.ITEM_PICKER: return new GuiItemPicker(new ContainerItemPicker());
|
||||
case GuiId.RECIPE_EDITOR: return new GuiRecipeEditor(new ContainerRecipeEditor());
|
||||
case GuiId.RECIPE_PICKER: return new GuiRecipePicker(new ContainerRecipe());
|
||||
case GuiId.RECIPE_PICKER: return new GuiRecipePicker(new ContainerRecipe(), JustEnoughCalculation.proxy.getPlayerHandler().getAllRecipeIndex(null));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -5,10 +5,13 @@ import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import pers.towdium.justEnoughCalculation.JustEnoughCalculation;
|
||||
import pers.towdium.justEnoughCalculation.core.Recipe;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Towdium
|
||||
@@ -17,7 +20,6 @@ public class GuiRecipe extends GuiContainer{
|
||||
protected GuiScreen parent;
|
||||
protected int activeSlot = -1;
|
||||
|
||||
|
||||
public GuiRecipe(ContainerRecipe containerRecipe, GuiScreen parent){
|
||||
super(containerRecipe);
|
||||
this.parent = parent;
|
||||
@@ -34,13 +36,13 @@ public class GuiRecipe extends GuiContainer{
|
||||
i = 0; left = 31 + guiLeft; top = 7 + guiTop;
|
||||
for(int a = 0; a < 2; a++){
|
||||
for(int b =0; b < 2; b++){
|
||||
buttonList.add(new GuiButton(i+2*a+b, left+b*59, top+a*24, 20, 20, "X"));
|
||||
buttonList.add(new GuiButton(i+2*a+b, left+b*59, top+a*24, 20, 20, "N"));
|
||||
}
|
||||
}
|
||||
i = 4; left = 31 + guiLeft; top = 67 + guiTop;
|
||||
for(int a = 0; a < 4; a++){
|
||||
for(int b =0; b < 3; b++){
|
||||
buttonList.add(new GuiButton(i+3*a+b, left+b*59, top+a*24, 20, 20, "X"));
|
||||
buttonList.add(new GuiButton(i+3*a+b, left+b*59, top+a*24, 20, 20, "N"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -73,7 +75,7 @@ public class GuiRecipe extends GuiContainer{
|
||||
super.mouseClicked(mouseX, mouseY, mouseButton);
|
||||
Slot slot = getSlotUnderMouse();
|
||||
if(slot != null && mouseButton == 0 && slot.getStack() == null){
|
||||
activeSlot = slot.getSlotIndex();
|
||||
setActiveSlot(slot.getSlotIndex());
|
||||
mc.thePlayer.playSound("random.click", 1f, 1f );
|
||||
}
|
||||
}
|
||||
@@ -90,7 +92,11 @@ public class GuiRecipe extends GuiContainer{
|
||||
@Override
|
||||
protected void keyTyped(char typedChar, int keyCode) throws IOException {
|
||||
if (keyCode == 1) {
|
||||
mc.displayGuiScreen(parent);
|
||||
if(activeSlot != -1){
|
||||
setActiveSlot(-1);
|
||||
}else {
|
||||
mc.displayGuiScreen(parent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,6 +106,16 @@ public class GuiRecipe extends GuiContainer{
|
||||
} catch (IOException ignored) {}
|
||||
}
|
||||
|
||||
public void click(int index){
|
||||
for(GuiButton button : buttonList){
|
||||
if(button.id == index){
|
||||
try {
|
||||
actionPerformed(button);
|
||||
} catch (IOException ignored) {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int getActiveSlot() {
|
||||
return activeSlot;
|
||||
}
|
||||
@@ -107,4 +123,23 @@ public class GuiRecipe extends GuiContainer{
|
||||
public void setActiveSlot(int activeSlot) {
|
||||
this.activeSlot = activeSlot;
|
||||
}
|
||||
|
||||
public void displayRecipe(Recipe recipe){
|
||||
List<ItemStack> output = recipe.getOutput();
|
||||
List<ItemStack> input = recipe.getInput();
|
||||
for(int i=0; i<4; i++){
|
||||
if(i<output.size()){
|
||||
this.inventorySlots.getSlot(i).putStack(output.get(i));
|
||||
}else {
|
||||
this.inventorySlots.getSlot(i).putStack(null);
|
||||
}
|
||||
}
|
||||
for(int i=0; i<12; i++){
|
||||
if(i<input.size()){
|
||||
this.inventorySlots.getSlot(i+4).putStack(input.get(i));
|
||||
}else {
|
||||
this.inventorySlots.getSlot(i+4).putStack(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+67
-22
@@ -14,13 +14,17 @@ import net.minecraft.util.StatCollector;
|
||||
import pers.towdium.justEnoughCalculation.JustEnoughCalculation;
|
||||
import pers.towdium.justEnoughCalculation.core.Calculator;
|
||||
import pers.towdium.justEnoughCalculation.core.ItemStackWrapper;
|
||||
import pers.towdium.justEnoughCalculation.core.Recipe;
|
||||
import pers.towdium.justEnoughCalculation.gui.commom.GuiTooltipScreen;
|
||||
import pers.towdium.justEnoughCalculation.gui.commom.recipe.ContainerRecipe;
|
||||
import pers.towdium.justEnoughCalculation.gui.guis.recipeEditor.ContainerRecipeEditor;
|
||||
import pers.towdium.justEnoughCalculation.gui.guis.recipeEditor.GuiRecipeEditor;
|
||||
import pers.towdium.justEnoughCalculation.gui.guis.recipePicker.GuiRecipePicker;
|
||||
import pers.towdium.justEnoughCalculation.network.packets.PacketSyncRecord;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.List;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
@@ -29,13 +33,16 @@ import java.util.TimerTask;
|
||||
*/
|
||||
public class GuiCalculator extends GuiTooltipScreen{
|
||||
GuiTextField textFieldAmount;
|
||||
GuiButton editButton;
|
||||
GuiButton modeButton;
|
||||
GuiButton buttonEdit;
|
||||
GuiButton buttonMode;
|
||||
GuiButton buttonCalculate;
|
||||
GuiButton buttonView;
|
||||
Calculator.CostRecord costRecord;
|
||||
int activeSlot = -1;
|
||||
int page = 1;
|
||||
int total = 1;
|
||||
EnumMode mode = EnumMode.INPUT;
|
||||
ItemStack buffer;
|
||||
|
||||
public enum EnumMode {INPUT, OUTPUT, CATALYST}
|
||||
|
||||
@@ -47,20 +54,23 @@ public class GuiCalculator extends GuiTooltipScreen{
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
editButton = new GuiButton(3, guiLeft+90, guiTop+7, 37, 20, StatCollector.translateToLocal("gui.calculator.edit"));
|
||||
editButton.enabled = false;
|
||||
buttonList.add(new GuiButton(1, guiLeft+7, guiTop+31, 79, 20, StatCollector.translateToLocal("gui.calculator.calculate")));
|
||||
buttonList.add(new GuiButton(2, guiLeft+131, guiTop+7, 37, 20, StatCollector.translateToLocal("gui.calculator.add")));
|
||||
buttonList.add(editButton);
|
||||
buttonEdit = new GuiButton(3, guiLeft+89, guiTop+7, 38, 20, StatCollector.translateToLocal("gui.calculator.edit"));
|
||||
buttonCalculate = new GuiButton(1, guiLeft+7, guiTop+31, 78, 20, StatCollector.translateToLocal("gui.calculator.calculate"));
|
||||
buttonView = new GuiButton(7, guiLeft+131, guiTop+7, 38, 20, StatCollector.translateToLocal("gui.calculator.view"));
|
||||
buttonList.add(buttonCalculate);
|
||||
buttonList.add(new GuiButton(2, guiLeft+89, guiTop+31, 80, 20, StatCollector.translateToLocal("gui.calculator.add")));
|
||||
buttonList.add(buttonEdit);
|
||||
buttonList.add(buttonView);
|
||||
buttonList.add(new GuiButton(4, guiLeft+7, guiTop+139, 20, 20, "<"));
|
||||
buttonList.add(new GuiButton(5, guiLeft+149, guiTop+139, 20, 20, ">"));
|
||||
modeButton = new GuiButton(6, guiLeft+90, guiTop+31, 79, 20, StatCollector.translateToLocal("gui.calculator.input"));
|
||||
buttonList.add(modeButton);
|
||||
buttonList.add(new GuiButton(5, guiLeft+65, guiTop+139, 20, 20, ">"));
|
||||
buttonMode = new GuiButton(6, guiLeft+89, guiTop+139, 80, 20, StatCollector.translateToLocal("gui.calculator.input"));
|
||||
buttonList.add(buttonMode);
|
||||
textFieldAmount = new GuiTextField(0, fontRendererObj, guiLeft+39, guiTop+8, 45, 18);
|
||||
Slot dest = inventorySlots.getSlot(0);
|
||||
ItemStack itemStack = ((ContainerCalculator)inventorySlots).getPlayer().getHeldItem();
|
||||
dest.inventory.setInventorySlotContents(dest.getSlotIndex(), ItemStackWrapper.NBT.getItem(itemStack, "dest"));
|
||||
textFieldAmount.setText(ItemStackWrapper.NBT.getString(itemStack, "text"));
|
||||
updateLayout();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -81,7 +91,7 @@ public class GuiCalculator extends GuiTooltipScreen{
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) {
|
||||
fontRendererObj.drawString("x", 30, 13, 4210752);
|
||||
drawCenteredStringWithoutShadow(fontRendererObj, page + " / " + total, 88, 145, 4210752);
|
||||
drawCenteredString(fontRendererObj, page + "/" + total, 46, 145, 4210752);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -89,6 +99,7 @@ public class GuiCalculator extends GuiTooltipScreen{
|
||||
switch (buttonId){
|
||||
case 2: return StatCollector.translateToLocal("gui.calculator.addTooltip");
|
||||
case 3: return StatCollector.translateToLocal("gui.calculator.editTooltip");
|
||||
case 7: return StatCollector.translateToLocal("gui.calculator.viewTooltip");
|
||||
}
|
||||
|
||||
return null;
|
||||
@@ -101,7 +112,7 @@ public class GuiCalculator extends GuiTooltipScreen{
|
||||
if(inventorySlots.getSlot(0).getStack() != null){
|
||||
try{
|
||||
int i = Integer.valueOf(textFieldAmount.getText());
|
||||
Calculator calculator = new Calculator(inventorySlots.getSlot(0).getStack(), i);
|
||||
Calculator calculator = new Calculator(inventorySlots.getSlot(0).getStack(), i*100);
|
||||
Calculator.CostRecord record = calculator.getCost();
|
||||
record.unify();
|
||||
costRecord = record;
|
||||
@@ -123,6 +134,16 @@ public class GuiCalculator extends GuiTooltipScreen{
|
||||
JustEnoughCalculation.proxy.getPlayerHandler().syncItemCalculator(inventorySlots.getSlot(0).getStack(), textFieldAmount.getText());
|
||||
mc.displayGuiScreen(new GuiRecipeEditor(new ContainerRecipeEditor(), this));
|
||||
break;
|
||||
case 3:
|
||||
List<Integer> list;
|
||||
if (activeSlot == -1) {
|
||||
list = JustEnoughCalculation.proxy.getPlayerHandler().getAllRecipeIndexOf(inventorySlots.getSlot(0).getStack(), null);
|
||||
}else {
|
||||
list = JustEnoughCalculation.proxy.getPlayerHandler().getAllRecipeIndexOf(inventorySlots.getSlot(activeSlot).getStack(), null);
|
||||
}
|
||||
|
||||
mc.displayGuiScreen(new GuiRecipePicker(new ContainerRecipe(), this, list));
|
||||
break;
|
||||
case 6:
|
||||
switch (mode){
|
||||
case INPUT:
|
||||
@@ -135,29 +156,41 @@ public class GuiCalculator extends GuiTooltipScreen{
|
||||
mode = EnumMode.INPUT;
|
||||
break;
|
||||
}
|
||||
updateLayout();
|
||||
break;
|
||||
case 7:
|
||||
mc.displayGuiScreen(new GuiRecipePicker(new ContainerRecipe(), this, JustEnoughCalculation.proxy.getPlayerHandler().getAllRecipeIndex(null)));
|
||||
break;
|
||||
}
|
||||
updateLayout();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException {
|
||||
JustEnoughCalculation.proxy.getPlayerHandler().syncItemCalculator(inventorySlots.getSlot(0).getStack(), textFieldAmount.getText());
|
||||
textFieldAmount.mouseClicked(mouseX, mouseY, mouseButton);
|
||||
super.mouseClicked(mouseX, mouseY, mouseButton);
|
||||
Slot slot = getSlotUnderMouse();
|
||||
if(slot != null && mouseButton == 0){
|
||||
activeSlot = slot.getSlotIndex();
|
||||
setActiveSlot(slot.getSlotIndex());
|
||||
((ContainerCalculator)inventorySlots).getPlayer().playSound("random.click", 1f, 1f );
|
||||
updateLayout();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void keyTyped(char typedChar, int keyCode) throws IOException {
|
||||
if (!this.textFieldAmount.textboxKeyTyped(typedChar, keyCode)){
|
||||
|
||||
if(keyCode == 1){
|
||||
JustEnoughCalculation.proxy.getPlayerHandler().syncItemCalculator(inventorySlots.getSlot(0).getStack(), textFieldAmount.getText());
|
||||
((ContainerCalculator)inventorySlots).getPlayer().closeScreen();
|
||||
if(activeSlot != -1){
|
||||
inventorySlots.getSlot(activeSlot).putStack(buffer);
|
||||
setActiveSlot(-1);
|
||||
}else {
|
||||
((ContainerCalculator)inventorySlots).getPlayer().closeScreen();
|
||||
}
|
||||
}
|
||||
}else {
|
||||
JustEnoughCalculation.proxy.getPlayerHandler().syncItemCalculator(inventorySlots.getSlot(0).getStack(), textFieldAmount.getText());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -203,16 +236,23 @@ public class GuiCalculator extends GuiTooltipScreen{
|
||||
public void updateLayout(){
|
||||
switch (mode){
|
||||
case OUTPUT:
|
||||
modeButton.displayString = StatCollector.translateToLocal("gui.calculator.output");
|
||||
buttonMode.displayString = StatCollector.translateToLocal("gui.calculator.output");
|
||||
break;
|
||||
case INPUT:
|
||||
modeButton.displayString = StatCollector.translateToLocal("gui.calculator.input");
|
||||
buttonMode.displayString = StatCollector.translateToLocal("gui.calculator.input");
|
||||
break;
|
||||
case CATALYST:
|
||||
modeButton.displayString = StatCollector.translateToLocal("gui.calculator.catalyst");
|
||||
buttonMode.displayString = StatCollector.translateToLocal("gui.calculator.catalyst");
|
||||
break;
|
||||
}
|
||||
editButton.enabled = JustEnoughCalculation.proxy.getPlayerHandler().getHasRecipeOf(inventorySlots.getSlot(0).getStack(), null);
|
||||
boolean b = JustEnoughCalculation.proxy.getPlayerHandler().getHasRecipeOf(inventorySlots.getSlot(0).getStack(), null);
|
||||
if(activeSlot == -1){
|
||||
buttonEdit.enabled = b;
|
||||
}else {
|
||||
buttonEdit.enabled = JustEnoughCalculation.proxy.getPlayerHandler().getHasRecipeOf(inventorySlots.getSlot(activeSlot).getStack(), null);
|
||||
}
|
||||
buttonCalculate.enabled = b;
|
||||
buttonView.enabled = JustEnoughCalculation.proxy.getPlayerHandler().getHasRecipe(null);
|
||||
if(costRecord != null){
|
||||
switch (mode){
|
||||
case OUTPUT:
|
||||
@@ -230,10 +270,15 @@ public class GuiCalculator extends GuiTooltipScreen{
|
||||
}
|
||||
|
||||
public void setActiveSlot(int activeSlot) {
|
||||
this.activeSlot = activeSlot;
|
||||
|
||||
if(activeSlot == -1){
|
||||
|
||||
JustEnoughCalculation.proxy.getPlayerHandler().syncItemCalculator(inventorySlots.getSlot(0).getStack(), textFieldAmount.getText());
|
||||
}else {
|
||||
buffer = inventorySlots.getSlot(activeSlot).getStack();
|
||||
}
|
||||
this.activeSlot = activeSlot;
|
||||
updateLayout();
|
||||
}
|
||||
|
||||
public void drawCenteredStringWithoutShadow(FontRenderer fontRendererIn, String text, int x, int y, int color) {
|
||||
|
||||
-39
@@ -1,39 +0,0 @@
|
||||
package pers.towdium.justEnoughCalculation.gui.guis.itemPicker;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import pers.towdium.justEnoughCalculation.JustEnoughCalculation;
|
||||
|
||||
|
||||
/**
|
||||
* @author Towdium
|
||||
*/
|
||||
public class ContainerItemPicker extends Container {
|
||||
|
||||
InventoryItemPicker inventoryItemPicker;
|
||||
|
||||
public ContainerItemPicker(){
|
||||
inventoryItemPicker = new InventoryItemPicker();
|
||||
addSlotToContainer(new Slot(inventoryItemPicker ,0,0,0));
|
||||
addSlotToContainer(new Slot(inventoryItemPicker,1,18,0));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer playerIn) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer playerIn, int index) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack slotClick(int slotId, int clickedButton, int mode, EntityPlayer playerIn) {
|
||||
JustEnoughCalculation.log.info("Activated");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
-84
@@ -1,84 +0,0 @@
|
||||
package pers.towdium.justEnoughCalculation.gui.guis.itemPicker;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiTextField;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import pers.towdium.justEnoughCalculation.JustEnoughCalculation;
|
||||
import pers.towdium.justEnoughCalculation.plugin.JEIPlugin;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* @author Towdium
|
||||
*/
|
||||
public class GuiItemPicker extends GuiContainer{
|
||||
ContainerItemPicker containerItemPicker;
|
||||
GuiTextField searchTextField;
|
||||
|
||||
public GuiItemPicker(ContainerItemPicker containerItemPicker){
|
||||
super(containerItemPicker);
|
||||
this.containerItemPicker = containerItemPicker;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
buttonList.add(new GuiButton(0, guiLeft+31, guiTop+7, 50, 20, StatCollector.translateToLocal("gui.itemPicker.confirm")));
|
||||
buttonList.add(new GuiButton(0, guiLeft+7, guiTop+137, 20, 20, "<"));
|
||||
buttonList.add(new GuiButton(0, guiLeft+149, guiTop+137, 20, 20, ">"));
|
||||
searchTextField = new GuiTextField(4, fontRendererObj, guiLeft+90, guiTop+7, 79, 20){
|
||||
@Override
|
||||
public boolean textboxKeyTyped(char p_146201_1_, int p_146201_2_) {
|
||||
boolean b = super.textboxKeyTyped(p_146201_1_, p_146201_2_);
|
||||
JustEnoughCalculation.log.info("执行了!"+JEIPlugin.runtime.getItemListOverlay().getFilterText());
|
||||
JEIPlugin.runtime.getItemListOverlay().setFilterText("apple");
|
||||
return b;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {
|
||||
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.mc.getTextureManager().bindTexture(new ResourceLocation(JustEnoughCalculation.Reference.MODID,"textures/gui/guiItemPicker.png"));
|
||||
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, this.xSize, this.ySize);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) {
|
||||
|
||||
this.fontRendererObj.drawString(StatCollector.translateToLocal("container.itemPicker"), 8, 6, 4210752);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
|
||||
super.drawScreen(mouseX, mouseY, partialTicks);
|
||||
searchTextField.drawTextBox();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onGuiClosed() {
|
||||
super.onGuiClosed();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton button) throws IOException {
|
||||
super.actionPerformed(button);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException {
|
||||
searchTextField.mouseClicked(mouseX, mouseY, mouseButton);
|
||||
super.mouseClicked(mouseX, mouseY, mouseButton);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void keyTyped(char typedChar, int keyCode) throws IOException {
|
||||
if (!this.searchTextField.textboxKeyTyped(typedChar, keyCode)){
|
||||
super.keyTyped(typedChar, keyCode);
|
||||
}
|
||||
}
|
||||
}
|
||||
-13
@@ -1,13 +0,0 @@
|
||||
package pers.towdium.justEnoughCalculation.gui.guis.itemPicker;
|
||||
|
||||
import net.minecraft.inventory.InventoryBasic;
|
||||
|
||||
/**
|
||||
* @author Towdium
|
||||
*/
|
||||
public class InventoryItemPicker extends InventoryBasic {
|
||||
public InventoryItemPicker() {
|
||||
super("Item picker", false, 55);
|
||||
|
||||
}
|
||||
}
|
||||
+101
-10
@@ -2,10 +2,8 @@ package pers.towdium.justEnoughCalculation.gui.guis.recipeEditor;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import pers.towdium.justEnoughCalculation.JustEnoughCalculation;
|
||||
import pers.towdium.justEnoughCalculation.core.Recipe;
|
||||
@@ -14,11 +12,19 @@ import pers.towdium.justEnoughCalculation.gui.commom.recipe.GuiRecipe;
|
||||
import pers.towdium.justEnoughCalculation.network.packets.PacketRecipeUpdate;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* @author Towdium
|
||||
*/
|
||||
public class GuiRecipeEditor extends GuiRecipe{
|
||||
int index = -1;
|
||||
|
||||
public GuiRecipeEditor(ContainerRecipeEditor containerRecipeEditor, GuiScreen parent, int index){
|
||||
super(containerRecipeEditor, parent);
|
||||
this.index = index;
|
||||
}
|
||||
|
||||
public GuiRecipeEditor(ContainerRecipeEditor containerRecipeEditor, GuiScreen parent){
|
||||
super(containerRecipeEditor, parent);
|
||||
}
|
||||
@@ -27,6 +33,16 @@ public class GuiRecipeEditor extends GuiRecipe{
|
||||
super(containerRecipeEditor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int mouseX, int mouseY, float f) {
|
||||
super.drawScreen(mouseX, mouseY, f);
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
if(activeSlot != -1){
|
||||
RenderTooltip(mouseX, mouseY, new String[]{"haha"});
|
||||
}
|
||||
RenderHelper.enableStandardItemLighting();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
@@ -38,18 +54,93 @@ public class GuiRecipeEditor extends GuiRecipe{
|
||||
protected void actionPerformed(GuiButton button) throws IOException {
|
||||
super.actionPerformed(button);
|
||||
int buttonId = button.id;
|
||||
if(buttonId <= 15){
|
||||
Slot slot = inventorySlots.getSlot(buttonId);
|
||||
slot.inventory.setInventorySlotContents(slot.getSlotIndex(), null);
|
||||
}else if(buttonId == 16) {
|
||||
if(buttonId == 16) {
|
||||
Recipe recipe = ((ContainerRecipe)inventorySlots).buildRecipe();
|
||||
JustEnoughCalculation.proxy.getPlayerHandler().addRecipe(recipe, null);
|
||||
JustEnoughCalculation.networkWrapper.sendToServer(new PacketRecipeUpdate(recipe, -1));
|
||||
mc.displayGuiScreen(parent);
|
||||
if(recipe == null){
|
||||
mc.displayGuiScreen(parent);
|
||||
return;
|
||||
}
|
||||
if(index == -1){
|
||||
JustEnoughCalculation.proxy.getPlayerHandler().addRecipe(recipe, null);
|
||||
JustEnoughCalculation.networkWrapper.sendToServer(new PacketRecipeUpdate(recipe, -1));
|
||||
mc.displayGuiScreen(parent);
|
||||
}else {
|
||||
JustEnoughCalculation.proxy.getPlayerHandler().setRecipe(recipe, index, null);
|
||||
JustEnoughCalculation.networkWrapper.sendToServer(new PacketRecipeUpdate(recipe, index));
|
||||
mc.displayGuiScreen(parent);
|
||||
}
|
||||
}else if(buttonId == 17) {
|
||||
for(Slot slot : inventorySlots.inventorySlots){
|
||||
slot.inventory.setInventorySlotContents(slot.getSlotIndex(), null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//copied code start
|
||||
|
||||
protected int tooltipXOffset = 0;
|
||||
protected int tooltipYOffset = 10;
|
||||
|
||||
private final static int LINE_HEIGHT = 11;
|
||||
|
||||
protected void RenderTooltip(int x, int y, String[] tooltip)
|
||||
{
|
||||
|
||||
int tooltipWidth = GetTooltipWidth(tooltip);
|
||||
int tooltipHeight = GetTooltipHeight(tooltip);
|
||||
|
||||
int tooltipX = x + tooltipXOffset;
|
||||
int tooltipY = y + tooltipYOffset;
|
||||
|
||||
if(tooltipX > width - tooltipWidth - 7)
|
||||
tooltipX = width - tooltipWidth - 7;
|
||||
if(tooltipY > height - tooltipHeight - 8)
|
||||
tooltipY = height - tooltipHeight - 8;
|
||||
|
||||
//render the background inside box
|
||||
int innerAlpha = -0xFEFFFF0; //very very dark purple
|
||||
drawGradientRect(tooltipX, tooltipY - 1, tooltipX + tooltipWidth + 6, tooltipY, innerAlpha, innerAlpha);
|
||||
drawGradientRect(tooltipX, tooltipY + tooltipHeight + 6, tooltipX + tooltipWidth + 6, tooltipY + tooltipHeight + 7, innerAlpha, innerAlpha);
|
||||
drawGradientRect(tooltipX, tooltipY, tooltipX + tooltipWidth + 6, tooltipY + tooltipHeight + 6, innerAlpha, innerAlpha);
|
||||
drawGradientRect(tooltipX - 1, tooltipY, tooltipX, tooltipY + tooltipHeight + 6, innerAlpha, innerAlpha);
|
||||
drawGradientRect(tooltipX + tooltipWidth + 6, tooltipY, tooltipX + tooltipWidth + 7, tooltipY + tooltipHeight + 6, innerAlpha, innerAlpha);
|
||||
|
||||
//render the background outside box
|
||||
int outerAlpha1 = 0x505000FF;
|
||||
int outerAlpha2 = (outerAlpha1 & 0xFEFEFE) >> 1 | outerAlpha1 & -0x1000000;
|
||||
drawGradientRect(tooltipX, tooltipY + 1, tooltipX + 1, tooltipY + tooltipHeight + 6 - 1, outerAlpha1, outerAlpha2);
|
||||
drawGradientRect(tooltipX + tooltipWidth + 5, tooltipY + 1, tooltipX + tooltipWidth + 7, tooltipY + tooltipHeight + 6 - 1, outerAlpha1, outerAlpha2);
|
||||
drawGradientRect(tooltipX, tooltipY, tooltipX + tooltipWidth + 3, tooltipY + 1, outerAlpha1, outerAlpha1);
|
||||
drawGradientRect(tooltipX, tooltipY + tooltipHeight + 5, tooltipX + tooltipWidth + 7, tooltipY + tooltipHeight + 6, outerAlpha2, outerAlpha2);
|
||||
|
||||
//render the foreground text
|
||||
int lineCount = 0;
|
||||
for (String s : tooltip)
|
||||
{
|
||||
mc.fontRendererObj.drawStringWithShadow(s, tooltipX + 2, tooltipY + 2 + lineCount * LINE_HEIGHT, 0xFFFFFF);
|
||||
lineCount++;
|
||||
}
|
||||
}
|
||||
|
||||
private int GetTooltipWidth(String[] tooltipArray)
|
||||
{
|
||||
int longestWidth = 0;
|
||||
for(String s : tooltipArray)
|
||||
{
|
||||
int width = mc.fontRendererObj.getStringWidth(s);
|
||||
if(width > longestWidth)
|
||||
longestWidth = width;
|
||||
}
|
||||
return longestWidth;
|
||||
}
|
||||
|
||||
private int GetTooltipHeight(String[] tooltipArray)
|
||||
{
|
||||
int tooltipHeight = mc.fontRendererObj.FONT_HEIGHT - 2;
|
||||
if (tooltipArray.length > 1)
|
||||
{
|
||||
tooltipHeight += (tooltipArray.length - 1) * LINE_HEIGHT;
|
||||
}
|
||||
return tooltipHeight;
|
||||
}
|
||||
}
|
||||
+30
-12
@@ -6,11 +6,12 @@ import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import pers.towdium.justEnoughCalculation.JustEnoughCalculation;
|
||||
import pers.towdium.justEnoughCalculation.core.Recipe;
|
||||
import pers.towdium.justEnoughCalculation.gui.commom.recipe.ContainerRecipe;
|
||||
import pers.towdium.justEnoughCalculation.gui.commom.recipe.GuiRecipe;
|
||||
import pers.towdium.justEnoughCalculation.gui.guis.recipeEditor.ContainerRecipeEditor;
|
||||
import pers.towdium.justEnoughCalculation.gui.guis.recipeEditor.GuiRecipeEditor;
|
||||
import pers.towdium.justEnoughCalculation.network.packets.PacketRecipeUpdate;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
@@ -18,31 +19,42 @@ import java.util.List;
|
||||
* @author Towdium
|
||||
*/
|
||||
public class GuiRecipePicker extends GuiRecipe{
|
||||
ItemStack dest;
|
||||
List<Recipe> recipes;
|
||||
int index;
|
||||
protected List<Integer> recipes;
|
||||
protected int index;
|
||||
protected GuiButton buttonLeft;
|
||||
protected GuiButton buttonRight;
|
||||
|
||||
public GuiRecipePicker(ContainerRecipe containerRecipe, GuiScreen parent){
|
||||
public GuiRecipePicker(ContainerRecipe containerRecipe, GuiScreen parent, List<Integer> recipes){
|
||||
super(containerRecipe, parent);
|
||||
this.recipes = recipes;
|
||||
}
|
||||
|
||||
public GuiRecipePicker(ContainerRecipe containerRecipe){
|
||||
public GuiRecipePicker(ContainerRecipe containerRecipe, List<Integer> recipes){
|
||||
super(containerRecipe);
|
||||
this.recipes = recipes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
buttonList.add(new GuiButton(16, guiLeft+125, guiTop+7, 20, 20, StatCollector.translateToLocal("<")));
|
||||
buttonList.add(new GuiButton(17, guiLeft+149, guiTop+7, 20, 20, StatCollector.translateToLocal(">")));
|
||||
buttonLeft = new GuiButton(16, guiLeft+125, guiTop+7, 20, 20, "<");
|
||||
buttonRight = new GuiButton(17, guiLeft+149, guiTop+7, 20, 20, ">");
|
||||
buttonList.add(buttonLeft);
|
||||
buttonList.add(buttonRight);
|
||||
buttonList.add(new GuiButton(18, guiLeft+125, guiTop+31, 44, 20, StatCollector.translateToLocal("gui.recipePicker.delete")));
|
||||
updateLayout();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton button) throws IOException {
|
||||
super.actionPerformed(button);
|
||||
int buttonId = button.id;
|
||||
if(buttonId == 16) {
|
||||
if(buttonId>=0 && buttonId<=15){
|
||||
GuiRecipeEditor recipeEditor = new GuiRecipeEditor(new ContainerRecipeEditor(), parent, recipes.get(index));
|
||||
mc.displayGuiScreen(recipeEditor);
|
||||
recipeEditor.displayRecipe(JustEnoughCalculation.proxy.getPlayerHandler().getRecipe(recipes.get(index), null));
|
||||
recipeEditor.click(buttonId);
|
||||
}else if(buttonId == 16) {
|
||||
if(index>0){
|
||||
index--;
|
||||
updateLayout();
|
||||
@@ -54,6 +66,7 @@ public class GuiRecipePicker extends GuiRecipe{
|
||||
}
|
||||
}else if(buttonId == 18) {
|
||||
JustEnoughCalculation.proxy.getPlayerHandler().removeRecipe(recipes.get(index), null);
|
||||
JustEnoughCalculation.networkWrapper.sendToServer(new PacketRecipeUpdate(null, recipes.get(index)));
|
||||
mc.displayGuiScreen(parent);
|
||||
}
|
||||
}
|
||||
@@ -63,14 +76,19 @@ public class GuiRecipePicker extends GuiRecipe{
|
||||
super.mouseClicked(mouseX, mouseY, mouseButton);
|
||||
Slot slot = getSlotUnderMouse();
|
||||
if(slot != null){
|
||||
GuiRecipeEditor recipeEditor = new GuiRecipeEditor(new ContainerRecipeEditor(), parent);
|
||||
GuiRecipeEditor recipeEditor = new GuiRecipeEditor(new ContainerRecipeEditor(), parent, recipes.get(index));
|
||||
mc.displayGuiScreen(recipeEditor);
|
||||
recipeEditor.displayRecipe(JustEnoughCalculation.proxy.getPlayerHandler().getRecipe(recipes.get(index), null));
|
||||
recipeEditor.click(mouseX, mouseY, mouseButton);
|
||||
recipeEditor.setActiveSlot(slot.getSlotIndex());
|
||||
if(slot.getStack() == null){
|
||||
recipeEditor.setActiveSlot(slot.getSlotIndex());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void updateLayout(){
|
||||
|
||||
displayRecipe(JustEnoughCalculation.proxy.getPlayerHandler().getRecipe(recipes.get(index), null));
|
||||
buttonRight.enabled = index != recipes.size() - 1;
|
||||
buttonLeft.enabled = index != 0;
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,7 @@ public class ItemCalculator extends Item {
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn) {
|
||||
playerIn.openGui(JustEnoughCalculation.instance, GuiHandler.GuiId.RECIPE_PICKER, worldIn, 0, 0, 0);
|
||||
playerIn.openGui(JustEnoughCalculation.instance, GuiHandler.GuiId.CALCULATOR, worldIn, 0, 0, 0);
|
||||
return itemStackIn;
|
||||
}
|
||||
|
||||
|
||||
@@ -38,4 +38,10 @@ public interface IPlayerHandler {
|
||||
boolean removeRecipe(Recipe recipe, UUID uuid);
|
||||
|
||||
boolean containsRecipe(Recipe recipe, UUID uuid);
|
||||
|
||||
boolean getHasRecipe(UUID uuid);
|
||||
|
||||
ImmutableList<Recipe> getAllRecipe(UUID uuid);
|
||||
|
||||
ImmutableList<Integer> getAllRecipeIndex(UUID uuid);
|
||||
}
|
||||
@@ -36,8 +36,26 @@ public class PlayerHandlerClient implements IPlayerHandler {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getHasRecipe(UUID uuid) {
|
||||
return recipes.size()!=0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ImmutableList<Integer> getAllRecipeIndex(UUID uuid) {
|
||||
int a = recipes.size();
|
||||
ImmutableList.Builder<Integer> builder = new ImmutableList.Builder<>();
|
||||
for (int i = 0; i<a; i++){
|
||||
builder.add(i);
|
||||
}
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getHasRecipeOf(ItemStack itemStack, UUID uuid) {
|
||||
if(itemStack == null){
|
||||
return false;
|
||||
}
|
||||
for (Recipe recipe : recipes){
|
||||
if(recipe.getHasOutput(itemStack)){
|
||||
return true;
|
||||
@@ -153,6 +171,11 @@ public class PlayerHandlerClient implements IPlayerHandler {
|
||||
return recipes.contains(recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ImmutableList<Recipe> getAllRecipe(UUID uuid) {
|
||||
return ImmutableList.copyOf(recipes);
|
||||
}
|
||||
|
||||
ImmutableList<int[]> getAllUnsortedRecipeIndexOf(ItemStack itemStack){
|
||||
ImmutableList.Builder<int[]> builder = new ImmutableList.Builder<>();
|
||||
int size = recipes.size();
|
||||
|
||||
@@ -57,6 +57,16 @@ public class PlayerHandlerServer implements IPlayerHandler {
|
||||
players.get(uuid).setRecipe(recipe, index, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ImmutableList<Recipe> getAllRecipe(UUID uuid) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ImmutableList<Integer> getAllRecipeIndex(UUID uuid) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Recipe getRecipe(int index, UUID uuid) {
|
||||
return null;
|
||||
@@ -75,6 +85,11 @@ public class PlayerHandlerServer implements IPlayerHandler {
|
||||
//JustEnoughCalculation.networkWrapper.sendTo(new PacketSyncRecord(client), ((EntityPlayerMP) event.entityPlayer));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getHasRecipe(UUID uuid) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleSave(PlayerEvent.SaveToFile event) {
|
||||
players.get(UUID.fromString(event.playerUUID)).handleSave(event);
|
||||
|
||||
@@ -4,8 +4,10 @@ gui.calculator.add=Add
|
||||
gui.calculator.output=Output
|
||||
gui.calculator.input=Input
|
||||
gui.calculator.catalyst=Catalyst
|
||||
gui.calculator.editTooltip=Edit records of recipes
|
||||
gui.calculator.view=View
|
||||
gui.calculator.editTooltip=Edit recorded recipes of selected item
|
||||
gui.calculator.addTooltip=Add preferred recipe
|
||||
gui.calculator.viewTooltip=View all recorded recipes
|
||||
gui.itemPicker.confirm=Confirm
|
||||
gui.itemPicker.search=Search
|
||||
gui.recipePicker.delete=Delete
|
||||
|
||||
Reference in new issue
Block a user