mirror of
https://github.com/GTNewHorizons/BloodMagic.git
synced 2026-11-27 15:23:06 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3d480cb2e9 | ||
|
|
0c361f2482 | ||
|
|
d299b0a1b0 | ||
|
|
927e531af8 |
No files matched your search
@@ -3,9 +3,9 @@ name: Build and test
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [ master, main ]
|
branches: [ master, main, release/** ]
|
||||||
push:
|
push:
|
||||||
branches: [ master, main ]
|
branches: [ master, main, release/** ]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-and-test:
|
build-and-test:
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
package WayofTime.alchemicalWizardry.api.alchemy;
|
package WayofTime.alchemicalWizardry.api.alchemy;
|
||||||
|
|
||||||
import net.minecraft.item.ItemBlock;
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraftforge.oredict.OreDictionary;
|
import net.minecraftforge.oredict.OreDictionary;
|
||||||
|
|
||||||
public class AlchemyRecipe {
|
public class AlchemyRecipe {
|
||||||
|
|
||||||
|
private static final int MAX_INPUT_SLOTS = 5;
|
||||||
|
|
||||||
private final ItemStack output;
|
private final ItemStack output;
|
||||||
private final ItemStack[] recipe;
|
private final ItemStack[] recipe;
|
||||||
private final int bloodOrbLevel;
|
private final int bloodOrbLevel;
|
||||||
@@ -23,35 +24,13 @@ public class AlchemyRecipe {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemStack[] recipe;
|
if (items.length < MAX_INPUT_SLOTS) {
|
||||||
|
|
||||||
if (items.length < 5) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.recipe.length != 5) {
|
boolean[] checkList = new boolean[MAX_INPUT_SLOTS];
|
||||||
ItemStack[] newRecipe = new ItemStack[5];
|
|
||||||
|
|
||||||
for (int i = 0; i < 5; i++) {
|
for (int i = 0; i < Math.min(recipe.length, MAX_INPUT_SLOTS); i++) {
|
||||||
if (i + 1 > this.recipe.length) {
|
|
||||||
newRecipe[i] = null;
|
|
||||||
} else {
|
|
||||||
newRecipe[i] = this.recipe[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
recipe = newRecipe;
|
|
||||||
} else {
|
|
||||||
recipe = this.recipe;
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean[] checkList = new boolean[5];
|
|
||||||
|
|
||||||
for (int i = 0; i < 5; i++) {
|
|
||||||
checkList[i] = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i < 5; i++) {
|
|
||||||
ItemStack recipeItemStack = recipe[i];
|
ItemStack recipeItemStack = recipe[i];
|
||||||
|
|
||||||
if (recipeItemStack == null) {
|
if (recipeItemStack == null) {
|
||||||
@@ -60,7 +39,7 @@ public class AlchemyRecipe {
|
|||||||
|
|
||||||
boolean test = false;
|
boolean test = false;
|
||||||
|
|
||||||
for (int j = 0; j < 5; j++) {
|
for (int j = 0; j < MAX_INPUT_SLOTS; j++) {
|
||||||
if (checkList[j]) {
|
if (checkList[j]) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -71,20 +50,6 @@ public class AlchemyRecipe {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean quickTest = false;
|
|
||||||
|
|
||||||
if (recipeItemStack.getItem() instanceof ItemBlock) {
|
|
||||||
if (checkedItemStack.getItem() instanceof ItemBlock) {
|
|
||||||
quickTest = true;
|
|
||||||
}
|
|
||||||
} else if (!(checkedItemStack.getItem() instanceof ItemBlock)) {
|
|
||||||
quickTest = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!quickTest) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((checkedItemStack.getItemDamage() == recipeItemStack.getItemDamage()
|
if ((checkedItemStack.getItemDamage() == recipeItemStack.getItemDamage()
|
||||||
|| OreDictionary.WILDCARD_VALUE == recipeItemStack.getItemDamage())
|
|| OreDictionary.WILDCARD_VALUE == recipeItemStack.getItemDamage())
|
||||||
&& checkedItemStack.getItem() == recipeItemStack.getItem()) {
|
&& checkedItemStack.getItem() == recipeItemStack.getItem()) {
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ public class AlchemyRecipeRegistry {
|
|||||||
recipes.add(new AlchemyRecipe(output, amountNeeded, recipe, bloodOrbLevel));
|
recipes.add(new AlchemyRecipe(output, amountNeeded, recipe, bloodOrbLevel));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ItemStack getResult(ItemStack[] recipe, ItemStack bloodOrb) {
|
public static AlchemyRecipe findRecipe(ItemStack[] recipe, ItemStack bloodOrb) {
|
||||||
if (bloodOrb == null) {
|
if (bloodOrb == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -28,31 +28,23 @@ public class AlchemyRecipeRegistry {
|
|||||||
|
|
||||||
for (AlchemyRecipe ar : recipes) {
|
for (AlchemyRecipe ar : recipes) {
|
||||||
if (ar.doesRecipeMatch(recipe, bloodOrbLevel)) {
|
if (ar.doesRecipeMatch(recipe, bloodOrbLevel)) {
|
||||||
return (ar.getResult());
|
return ar;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static ItemStack getResult(ItemStack[] recipe, ItemStack bloodOrb) {
|
||||||
|
AlchemyRecipe ar = findRecipe(recipe, bloodOrb);
|
||||||
|
|
||||||
|
return ar == null ? null : ar.getResult();
|
||||||
|
}
|
||||||
|
|
||||||
public static int getAmountNeeded(ItemStack[] recipe, ItemStack bloodOrb) {
|
public static int getAmountNeeded(ItemStack[] recipe, ItemStack bloodOrb) {
|
||||||
if (bloodOrb == null) {
|
AlchemyRecipe ar = findRecipe(recipe, bloodOrb);
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(bloodOrb.getItem() instanceof IBloodOrb)) {
|
return ar == null ? 0 : ar.getAmountNeeded();
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int bloodOrbLevel = ((IBloodOrb) bloodOrb.getItem()).getOrbLevel();
|
|
||||||
|
|
||||||
for (AlchemyRecipe ar : recipes) {
|
|
||||||
if (ar.doesRecipeMatch(recipe, bloodOrbLevel)) {
|
|
||||||
return (ar.getAmountNeeded());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ItemStack[] getRecipeForItemStack(ItemStack itemStack) {
|
public static ItemStack[] getRecipeForItemStack(ItemStack itemStack) {
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ public class NEIBindingRitualHandler extends TemplateRecipeHandler {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getRecipeName() {
|
public String getRecipeName() {
|
||||||
return "Binding Ritual";
|
return StatCollector.translateToLocal("nei.recipe.bindingritual.category");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -216,6 +216,6 @@ public class NEICalcinatorHandler extends TemplateRecipeHandler {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getRecipeName() {
|
public String getRecipeName() {
|
||||||
return "Alchemic Calcinator";
|
return StatCollector.translateToLocal("nei.recipe.calcinator.category");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -46,6 +46,7 @@ public class BoundAxe extends ItemAxe implements IBindable {
|
|||||||
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||||
setEnergyUsed(5);
|
setEnergyUsed(5);
|
||||||
this.setHarvestLevel("axe", 7);
|
this.setHarvestLevel("axe", 7);
|
||||||
|
setMaxDamage(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEnergyUsed(int i) {
|
public void setEnergyUsed(int i) {
|
||||||
@@ -143,7 +144,6 @@ public class BoundAxe extends ItemAxe implements IBindable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
checkPassiveDrain(item, world, player);
|
checkPassiveDrain(item, world, player);
|
||||||
item.setItemDamage(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ public class BoundPickaxe extends ItemPickaxe implements IBindable {
|
|||||||
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||||
this.setEnergyUsed(5);
|
this.setEnergyUsed(5);
|
||||||
setHarvestLevel("pickaxe", 7);
|
setHarvestLevel("pickaxe", 7);
|
||||||
|
setMaxDamage(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEnergyUsed(int i) {
|
public void setEnergyUsed(int i) {
|
||||||
@@ -183,7 +184,6 @@ public class BoundPickaxe extends ItemPickaxe implements IBindable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
checkPassiveDrain(item, world, player);
|
checkPassiveDrain(item, world, player);
|
||||||
item.setItemDamage(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ import net.minecraft.entity.EntityLivingBase;
|
|||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemSpade;
|
import net.minecraft.item.ItemSpade;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
|
||||||
import net.minecraft.util.IIcon;
|
import net.minecraft.util.IIcon;
|
||||||
import net.minecraft.util.StatCollector;
|
import net.minecraft.util.StatCollector;
|
||||||
import net.minecraft.util.Vec3;
|
import net.minecraft.util.Vec3;
|
||||||
@@ -46,6 +45,7 @@ public class BoundShovel extends ItemSpade implements IBindable {
|
|||||||
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||||
setEnergyUsed(5);
|
setEnergyUsed(5);
|
||||||
setHarvestLevel("shovel", 7);
|
setHarvestLevel("shovel", 7);
|
||||||
|
setMaxDamage(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEnergyUsed(int i) {
|
public void setEnergyUsed(int i) {
|
||||||
@@ -145,13 +145,7 @@ public class BoundShovel extends ItemSpade implements IBindable {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.getTagCompound() == null) {
|
|
||||||
item.setTagCompound(new NBTTagCompound());
|
|
||||||
}
|
|
||||||
|
|
||||||
checkPassiveDrain(item, world, player);
|
checkPassiveDrain(item, world, player);
|
||||||
|
|
||||||
item.setItemDamage(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ public class EnergySword extends ItemSword implements IBindable {
|
|||||||
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||||
setEnergyUsed(50);
|
setEnergyUsed(50);
|
||||||
setFull3D();
|
setFull3D();
|
||||||
setMaxDamage(100);
|
setMaxDamage(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEnergyUsed(int i) {
|
public void setEnergyUsed(int i) {
|
||||||
@@ -106,7 +106,6 @@ public class EnergySword extends ItemSword implements IBindable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
checkPassiveDrain(item, world, player);
|
checkPassiveDrain(item, world, player);
|
||||||
item.setItemDamage(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -540,14 +540,22 @@ public class TEWritingTable extends TEInventory implements ISidedInventory, IBlo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!isRecipeValid()) {
|
ItemStack[] composedRecipe = new ItemStack[5];
|
||||||
|
|
||||||
|
System.arraycopy(inv, 1, composedRecipe, 0, 5);
|
||||||
|
|
||||||
|
AlchemyRecipe recipe = AlchemyRecipeRegistry.findRecipe(composedRecipe, inv[0]);
|
||||||
|
|
||||||
|
if (recipe == null) {
|
||||||
progress = 0;
|
progress = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ItemStack result = recipe.getResult();
|
||||||
|
|
||||||
if (progress <= 0) {
|
if (progress <= 0) {
|
||||||
progress = 0;
|
progress = 0;
|
||||||
amountUsed = this.getAmountNeeded(getStackInSlot(0));
|
amountUsed = recipe.getAmountNeeded();
|
||||||
|
|
||||||
if (worldObj != null) {
|
if (worldObj != null) {
|
||||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||||
@@ -580,60 +588,50 @@ public class TEWritingTable extends TEInventory implements ISidedInventory, IBlo
|
|||||||
|
|
||||||
if (progress >= progressNeeded) {
|
if (progress >= progressNeeded) {
|
||||||
progress = 0;
|
progress = 0;
|
||||||
this.setInventorySlotContents(6, getResultingItemStack());
|
this.setInventorySlotContents(6, result.copy());
|
||||||
|
|
||||||
ItemStack[] composedRecipe = new ItemStack[5];
|
this.decrementSlots(recipe.getRecipe());
|
||||||
|
|
||||||
System.arraycopy(inv, 1, composedRecipe, 0, 5);
|
|
||||||
|
|
||||||
this.decrementSlots(this.getRecipeForItems(composedRecipe, inv[0]));
|
|
||||||
|
|
||||||
if (worldObj != null) {
|
if (worldObj != null) {
|
||||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (getStackInSlot(6).getItem() == getResultingItemStack().getItem()
|
} else if (getStackInSlot(6).getItem() == result.getItem()
|
||||||
&& getResultingItemStack().stackSize
|
&& result.stackSize <= (getStackInSlot(6).getMaxStackSize() - getStackInSlot(6).stackSize)) {
|
||||||
<= (getStackInSlot(6).getMaxStackSize() - getStackInSlot(6).stackSize)) {
|
if (worldTime % 4 == 0) {
|
||||||
if (worldTime % 4 == 0) {
|
SpellHelper.sendIndexedParticleToAllAround(
|
||||||
SpellHelper.sendIndexedParticleToAllAround(
|
worldObj,
|
||||||
worldObj,
|
xCoord,
|
||||||
xCoord,
|
yCoord,
|
||||||
yCoord,
|
zCoord,
|
||||||
zCoord,
|
20,
|
||||||
20,
|
worldObj.provider.dimensionId,
|
||||||
worldObj.provider.dimensionId,
|
1,
|
||||||
1,
|
xCoord,
|
||||||
xCoord,
|
yCoord,
|
||||||
yCoord,
|
zCoord);
|
||||||
zCoord);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (!SoulNetworkHandler.syphonFromNetworkWhileInContainer(
|
if (!SoulNetworkHandler
|
||||||
getStackInSlot(0),
|
.syphonFromNetworkWhileInContainer(getStackInSlot(0), amountUsed * acceleration)) {
|
||||||
amountUsed * acceleration)) {
|
return;
|
||||||
return;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
progress += acceleration;
|
progress += acceleration;
|
||||||
|
|
||||||
if (progress >= progressNeeded) {
|
if (progress >= progressNeeded) {
|
||||||
progress = 0;
|
progress = 0;
|
||||||
ItemStack result = getResultingItemStack().copy();
|
ItemStack mergedResult = result.copy();
|
||||||
result.stackSize += getStackInSlot(6).stackSize;
|
mergedResult.stackSize += getStackInSlot(6).stackSize;
|
||||||
this.setInventorySlotContents(6, result);
|
this.setInventorySlotContents(6, mergedResult);
|
||||||
|
|
||||||
ItemStack[] composedRecipe = new ItemStack[5];
|
this.decrementSlots(recipe.getRecipe());
|
||||||
|
|
||||||
System.arraycopy(inv, 1, composedRecipe, 0, 5);
|
if (worldObj != null) {
|
||||||
|
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||||
this.decrementSlots(this.getRecipeForItems(composedRecipe, inv[0]));
|
|
||||||
|
|
||||||
if (worldObj != null) {
|
|
||||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -667,26 +665,6 @@ public class TEWritingTable extends TEInventory implements ISidedInventory, IBlo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack[] getRecipeForItems(ItemStack[] recipe, ItemStack bloodOrb) {
|
|
||||||
if (bloodOrb == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(bloodOrb.getItem() instanceof IBloodOrb)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
int bloodOrbLevel = ((IBloodOrb) bloodOrb.getItem()).getOrbLevel();
|
|
||||||
|
|
||||||
for (AlchemyRecipe ar : AlchemyRecipeRegistry.recipes) {
|
|
||||||
if (ar.doesRecipeMatch(recipe, bloodOrbLevel)) {
|
|
||||||
return ar.getRecipe();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getSpeedIncrease() {
|
public int getSpeedIncrease() {
|
||||||
return accelerationTime > 0 ? 5 : 1;
|
return accelerationTime > 0 ? 5 : 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -278,6 +278,8 @@ text.recipe.altar.tier=Tier: %s
|
|||||||
text.recipe.altar.bloodRequired=LP: %s
|
text.recipe.altar.bloodRequired=LP: %s
|
||||||
text.recipe.shapedOrb=Shaped Orb Recipe
|
text.recipe.shapedOrb=Shaped Orb Recipe
|
||||||
text.recipe.alchemicCalcinator.reagent=%s AR
|
text.recipe.alchemicCalcinator.reagent=%s AR
|
||||||
|
nei.recipe.bindingritual.category=Binding Ritual
|
||||||
|
nei.recipe.calcinator.category=Alchemic Calcinator
|
||||||
nei.recipe.meteor.category=Meteor Ritual
|
nei.recipe.meteor.category=Meteor Ritual
|
||||||
nei.recipe.meteor.cost=LP cost to summon this meteor
|
nei.recipe.meteor.cost=LP cost to summon this meteor
|
||||||
nei.recipe.meteor.tooExpensive=Insufficient LP in Soul Network
|
nei.recipe.meteor.tooExpensive=Insufficient LP in Soul Network
|
||||||
|
|||||||
Reference in new issue
Block a user