generated from tilera/1710mod
feat: implement auracore infusion recipes
This commit is contained in:
parent
517a6945c8
commit
0ac091d26b
|
@ -42,7 +42,7 @@ repositories {
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation "thaumcraft:Thaumcraft:1.7.10-4.2.3.5:deobf"
|
implementation "thaumcraft:Thaumcraft:1.7.10-4.2.3.5:deobf"
|
||||||
implementation "dev.tilera:auracore:1.3.0:deobf"
|
implementation "dev.tilera:auracore:1.4.1:deobf"
|
||||||
implementation "com.github.tox1cozZ:mixin-booter-legacy:1.1.2"
|
implementation "com.github.tox1cozZ:mixin-booter-legacy:1.1.2"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,6 @@ import dev.tilera.auracore.api.IWand;
|
||||||
import dev.tilera.auracore.api.crafting.IInfusionRecipe;
|
import dev.tilera.auracore.api.crafting.IInfusionRecipe;
|
||||||
import dev.tilera.auracore.crafting.AuracoreCraftingManager;
|
import dev.tilera.auracore.crafting.AuracoreCraftingManager;
|
||||||
import net.anvilcraft.classiccasting.WandManager;
|
import net.anvilcraft.classiccasting.WandManager;
|
||||||
import net.anvilcraft.classiccasting.recipes.InfusionCraftingManager;
|
|
||||||
import net.anvilcraft.classiccasting.tiles.TileInfusionWorkbench;
|
import net.anvilcraft.classiccasting.tiles.TileInfusionWorkbench;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.entity.player.InventoryPlayer;
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
|
@ -81,11 +80,10 @@ public class ContainerInfusionWorkbench extends Container {
|
||||||
ic, this.tileEntity.getWorldObj()
|
ic, this.tileEntity.getWorldObj()
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
TileMagicWorkbench bridge = AuracoreCraftingManager.createBridgeInventory(this.tileEntity, 0, 9);
|
||||||
if (this.tileEntity.getStackInSlot(9) == null
|
if (this.tileEntity.getStackInSlot(9) == null
|
||||||
&& this.tileEntity.getStackInSlot(10) != null
|
&& this.tileEntity.getStackInSlot(10) != null
|
||||||
&& this.tileEntity.getStackInSlot(10).getItem() instanceof IWand) {
|
&& this.tileEntity.getStackInSlot(10).getItem() instanceof IWand) {
|
||||||
TileMagicWorkbench bridge = AuracoreCraftingManager.createBridgeInventory(this.tileEntity, 0, 9);
|
|
||||||
IArcaneRecipe recipe = AuracoreCraftingManager.findMatchingArcaneRecipe(bridge, this.ip.player);
|
IArcaneRecipe recipe = AuracoreCraftingManager.findMatchingArcaneRecipe(bridge, this.ip.player);
|
||||||
if (recipe != null && WandManager.hasCharge(this.tileEntity.getStackInSlot(10), this.ip.player, AuracoreCraftingManager.getArcaneRecipeVisCost(recipe, bridge))) {
|
if (recipe != null && WandManager.hasCharge(this.tileEntity.getStackInSlot(10), this.ip.player, AuracoreCraftingManager.getArcaneRecipeVisCost(recipe, bridge))) {
|
||||||
this.tileEntity.setInventorySlotContentsSoftly(
|
this.tileEntity.setInventorySlotContentsSoftly(
|
||||||
|
@ -98,8 +96,8 @@ public class ContainerInfusionWorkbench extends Container {
|
||||||
if (this.tileEntity.getStackInSlot(9) == null
|
if (this.tileEntity.getStackInSlot(9) == null
|
||||||
&& this.tileEntity.getStackInSlot(10) != null) {
|
&& this.tileEntity.getStackInSlot(10) != null) {
|
||||||
IInfusionRecipe rec
|
IInfusionRecipe rec
|
||||||
= InfusionCraftingManager.INSTANCE.findMatchingInfusionRecipe(
|
= AuracoreCraftingManager.findMatchingInfusionRecipe(
|
||||||
this.tileEntity, this.ip.player
|
bridge, this.ip.player
|
||||||
);
|
);
|
||||||
|
|
||||||
if (rec != null
|
if (rec != null
|
||||||
|
|
|
@ -4,7 +4,6 @@ import cpw.mods.fml.common.FMLCommonHandler;
|
||||||
import dev.tilera.auracore.api.crafting.IInfusionRecipe;
|
import dev.tilera.auracore.api.crafting.IInfusionRecipe;
|
||||||
import dev.tilera.auracore.crafting.AuracoreCraftingManager;
|
import dev.tilera.auracore.crafting.AuracoreCraftingManager;
|
||||||
import net.anvilcraft.classiccasting.WandManager;
|
import net.anvilcraft.classiccasting.WandManager;
|
||||||
import net.anvilcraft.classiccasting.recipes.InfusionCraftingManager;
|
|
||||||
import net.anvilcraft.classiccasting.tiles.TileInfusionWorkbench;
|
import net.anvilcraft.classiccasting.tiles.TileInfusionWorkbench;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.IInventory;
|
import net.minecraft.inventory.IInventory;
|
||||||
|
@ -47,8 +46,8 @@ public class SlotCraftingInfusionWorkbench extends SlotCrafting {
|
||||||
IArcaneRecipe recipe = AuracoreCraftingManager.findMatchingArcaneRecipe(bridge, this.thePlayer);
|
IArcaneRecipe recipe = AuracoreCraftingManager.findMatchingArcaneRecipe(bridge, this.thePlayer);
|
||||||
cost = AuracoreCraftingManager.getArcaneRecipeVisCost(recipe, bridge);
|
cost = AuracoreCraftingManager.getArcaneRecipeVisCost(recipe, bridge);
|
||||||
if (cost == 0) {
|
if (cost == 0) {
|
||||||
IInfusionRecipe rec = InfusionCraftingManager.INSTANCE.findMatchingInfusionRecipe(
|
IInfusionRecipe rec = AuracoreCraftingManager.findMatchingInfusionRecipe(
|
||||||
this.craftMatrix, this.thePlayer
|
bridge, this.thePlayer
|
||||||
);
|
);
|
||||||
if (rec != null) {
|
if (rec != null) {
|
||||||
cost = rec.getCost();
|
cost = rec.getCost();
|
||||||
|
|
|
@ -4,9 +4,9 @@ import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import dev.tilera.auracore.api.IWand;
|
import dev.tilera.auracore.api.IWand;
|
||||||
import dev.tilera.auracore.api.crafting.IInfusionRecipe;
|
import dev.tilera.auracore.api.crafting.IInfusionRecipe;
|
||||||
|
import dev.tilera.auracore.crafting.AuracoreCraftingManager;
|
||||||
import net.anvilcraft.classiccasting.WandManager;
|
import net.anvilcraft.classiccasting.WandManager;
|
||||||
import net.anvilcraft.classiccasting.container.ContainerInfusionWorkbench;
|
import net.anvilcraft.classiccasting.container.ContainerInfusionWorkbench;
|
||||||
import net.anvilcraft.classiccasting.recipes.InfusionCraftingManager;
|
|
||||||
import net.anvilcraft.classiccasting.tiles.TileInfusionWorkbench;
|
import net.anvilcraft.classiccasting.tiles.TileInfusionWorkbench;
|
||||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||||
import net.minecraft.client.renderer.RenderHelper;
|
import net.minecraft.client.renderer.RenderHelper;
|
||||||
|
@ -18,8 +18,10 @@ import net.minecraft.util.ResourceLocation;
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
import thaumcraft.api.aspects.Aspect;
|
import thaumcraft.api.aspects.Aspect;
|
||||||
import thaumcraft.api.aspects.AspectList;
|
import thaumcraft.api.aspects.AspectList;
|
||||||
|
import thaumcraft.api.crafting.IArcaneRecipe;
|
||||||
import thaumcraft.client.lib.UtilsFX;
|
import thaumcraft.client.lib.UtilsFX;
|
||||||
import thaumcraft.codechicken.lib.math.MathHelper;
|
import thaumcraft.codechicken.lib.math.MathHelper;
|
||||||
|
import thaumcraft.common.tiles.TileMagicWorkbench;
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public class GuiInfusionWorkbench extends GuiContainer {
|
public class GuiInfusionWorkbench extends GuiContainer {
|
||||||
|
@ -85,17 +87,14 @@ public class GuiInfusionWorkbench extends GuiContainer {
|
||||||
this.drawTexturedModalRect(var5, var6, 0, 0, this.xSize, this.ySize);
|
this.drawTexturedModalRect(var5, var6, 0, 0, this.xSize, this.ySize);
|
||||||
GL11.glDisable(3042);
|
GL11.glDisable(3042);
|
||||||
ItemStack result = null;
|
ItemStack result = null;
|
||||||
// TODO: arcane crafting
|
TileMagicWorkbench bridge = AuracoreCraftingManager.createBridgeInventory(this.tileEntity, 0, 9);
|
||||||
//if (ThaumcraftCraftingManager.findMatchingArcaneRecipe(
|
IArcaneRecipe arcaneRecipe = AuracoreCraftingManager.findMatchingArcaneRecipe(bridge, this.ip.player);
|
||||||
// (IInventory) this.tileEntity, this.ip.player
|
IInfusionRecipe rec = null;
|
||||||
// )
|
if (arcaneRecipe != null) {
|
||||||
// != null) {
|
result = arcaneRecipe.getCraftingResult(bridge);
|
||||||
// result = ThaumcraftCraftingManager.findMatchingArcaneRecipe(
|
} else {
|
||||||
// (IInventory) this.tileEntity, this.ip.player
|
rec = AuracoreCraftingManager.findMatchingInfusionRecipe(
|
||||||
// );
|
bridge, this.ip.player
|
||||||
//} else
|
|
||||||
IInfusionRecipe rec = InfusionCraftingManager.INSTANCE.findMatchingInfusionRecipe(
|
|
||||||
this.tileEntity, this.ip.player
|
|
||||||
);
|
);
|
||||||
if (rec != null) {
|
if (rec != null) {
|
||||||
result = rec.getRecipeOutput();
|
result = rec.getRecipeOutput();
|
||||||
|
@ -124,6 +123,7 @@ public class GuiInfusionWorkbench extends GuiContainer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (this.tileEntity.getStackInSlot(10) != null) {
|
if (this.tileEntity.getStackInSlot(10) != null) {
|
||||||
final int charge = ((IWand)this.tileEntity.getStackInSlot(10).getItem()).getVis(this.tileEntity.getStackInSlot(10));
|
final int charge = ((IWand)this.tileEntity.getStackInSlot(10).getItem()).getVis(this.tileEntity.getStackInSlot(10));
|
||||||
if (charge > 0) {
|
if (charge > 0) {
|
||||||
|
@ -139,13 +139,11 @@ public class GuiInfusionWorkbench extends GuiContainer {
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
final int discount
|
final int discount
|
||||||
= 100 - Math.min(50, WandManager.getTotalVisDiscount(this.ip.player));
|
= 100 - Math.min(50, WandManager.getTotalVisDiscount(this.ip.player));
|
||||||
//int cost1 = ThaumcraftCraftingManager.findMatchingArcaneRecipeCost(
|
int cost1 = arcaneRecipe != null ? AuracoreCraftingManager.getArcaneRecipeVisCost(arcaneRecipe, bridge) : 0;
|
||||||
// this.tileEntity, this.ip.player
|
cost1 = Math.round(cost1 * (discount / 100.0f));
|
||||||
//);
|
int cost2 = rec != null ? rec.getCost() : 0;
|
||||||
//cost1 = Math.round(cost1 * (discount / 100.0f));
|
|
||||||
int cost2 = rec.getCost();
|
|
||||||
cost2 = Math.round(cost2 * (discount / 100.0f));
|
cost2 = Math.round(cost2 * (discount / 100.0f));
|
||||||
if (/*charge < cost1 ||*/ charge < cost2) {
|
if (charge < cost1 || charge < cost2) {
|
||||||
GL11.glPushMatrix();
|
GL11.glPushMatrix();
|
||||||
RenderHelper.enableGUIStandardItemLighting();
|
RenderHelper.enableGUIStandardItemLighting();
|
||||||
GL11.glDisable(2896);
|
GL11.glDisable(2896);
|
||||||
|
@ -174,10 +172,10 @@ public class GuiInfusionWorkbench extends GuiContainer {
|
||||||
GL11.glTranslatef((float) (var5 + 140), (float) (var6 + 85), 0.0f);
|
GL11.glTranslatef((float) (var5 + 140), (float) (var6 + 85), 0.0f);
|
||||||
GL11.glScalef(0.5f, 0.5f, 0.0f);
|
GL11.glScalef(0.5f, 0.5f, 0.0f);
|
||||||
String text2 = "Insufficient charge";
|
String text2 = "Insufficient charge";
|
||||||
if (/*cost1 > ((ItemWandCasting) this.tileEntity.getStackInSlot(10)
|
if (cost1 > ((IWand) this.tileEntity.getStackInSlot(10)
|
||||||
.getItem())
|
.getItem())
|
||||||
.getMaxVis()
|
.getMaxVis(this.tileEntity.getStackInSlot(10))
|
||||||
||*/ cost2 > ((IWand) this.tileEntity.getStackInSlot(10)
|
|| cost2 > ((IWand) this.tileEntity.getStackInSlot(10)
|
||||||
.getItem())
|
.getItem())
|
||||||
.getMaxVis(this.tileEntity.getStackInSlot(10))) {
|
.getMaxVis(this.tileEntity.getStackInSlot(10))) {
|
||||||
text2 = "This wand is too weak";
|
text2 = "This wand is too weak";
|
||||||
|
@ -187,12 +185,11 @@ public class GuiInfusionWorkbench extends GuiContainer {
|
||||||
GL11.glScalef(1.0f, 1.0f, 1.0f);
|
GL11.glScalef(1.0f, 1.0f, 1.0f);
|
||||||
GL11.glPopMatrix();
|
GL11.glPopMatrix();
|
||||||
}
|
}
|
||||||
if (/*cost1 > 0 ||*/ cost2 > 0) {
|
if (cost1 > 0 || cost2 > 0) {
|
||||||
GL11.glPushMatrix();
|
GL11.glPushMatrix();
|
||||||
GL11.glTranslatef((float) (var5 + 140), (float) (var6 + 81), 0.0f);
|
GL11.glTranslatef((float) (var5 + 140), (float) (var6 + 81), 0.0f);
|
||||||
GL11.glScalef(0.5f, 0.5f, 0.0f);
|
GL11.glScalef(0.5f, 0.5f, 0.0f);
|
||||||
//final String text2 = Math.max(cost1, cost2) + " vis";
|
final String text2 = Math.max(cost1, cost2) + " vis";
|
||||||
final String text2 = cost2 + " vis";
|
|
||||||
final int ll2 = this.fontRendererObj.getStringWidth(text2) / 2;
|
final int ll2 = this.fontRendererObj.getStringWidth(text2) / 2;
|
||||||
this.fontRendererObj.drawStringWithShadow(text2, -ll2, -64, 15658734);
|
this.fontRendererObj.drawStringWithShadow(text2, -ll2, -64, 15658734);
|
||||||
GL11.glScalef(1.0f, 1.0f, 1.0f);
|
GL11.glScalef(1.0f, 1.0f, 1.0f);
|
||||||
|
|
|
@ -1,75 +0,0 @@
|
||||||
package net.anvilcraft.classiccasting.recipes;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import dev.tilera.auracore.api.crafting.IInfusionRecipe;
|
|
||||||
import net.anvilcraft.classiccasting.CCBlocks;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.init.Items;
|
|
||||||
import net.minecraft.inventory.IInventory;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
import thaumcraft.api.aspects.Aspect;
|
|
||||||
import thaumcraft.api.aspects.AspectList;
|
|
||||||
|
|
||||||
public class InfusionCraftingManager {
|
|
||||||
public static InfusionCraftingManager INSTANCE = new InfusionCraftingManager();
|
|
||||||
public List<IInfusionRecipe> recipes = new ArrayList<>();
|
|
||||||
|
|
||||||
public InfusionCraftingManager() {
|
|
||||||
this.recipes.add(new IInfusionRecipe() {
|
|
||||||
@Override
|
|
||||||
public boolean matches(IInventory var1, World var2, EntityPlayer var3) {
|
|
||||||
return var1.getStackInSlot(0) != null
|
|
||||||
&& var1.getStackInSlot(0).getItem()
|
|
||||||
== Items.gold_nugget;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemStack getCraftingResult(IInventory var1) {
|
|
||||||
return this.getRecipeOutput();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getRecipeSize() {
|
|
||||||
return 9;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemStack getRecipeOutput() {
|
|
||||||
return new ItemStack(CCBlocks.alembic);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getCost() {
|
|
||||||
return 10;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public AspectList getAspects() {
|
|
||||||
return new AspectList().add(Aspect.GREED, 8);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getKey() {
|
|
||||||
return "alembus";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getResearch() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public IInfusionRecipe findMatchingInfusionRecipe(IInventory inv, EntityPlayer pl) {
|
|
||||||
for (IInfusionRecipe recipe : this.recipes) {
|
|
||||||
if (recipe.matches(inv, pl.worldObj, pl)) {
|
|
||||||
return recipe;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in a new issue