mirror of
https://github.com/GTNewHorizons/Gadomancy.git
synced 2026-11-22 12:59:48 +00:00
- Familiar preparation for 1.0.7
- Created Recipe + ItemStack generation for payback - Added new FamiliarItem + Augmenting System
This commit is contained in:
1 parent
cf96529de9
commit
2d4b5a7627
18 files changed
+812
-79
No files matched your search
@@ -16,7 +16,6 @@ import makeo.gadomancy.client.renderers.block.RenderBlockStoneMachine;
|
||||
import makeo.gadomancy.client.renderers.block.RenderBlockTransparent;
|
||||
import makeo.gadomancy.client.renderers.entity.RenderAdditionalGolemBase;
|
||||
import makeo.gadomancy.client.renderers.entity.RenderEntityAuraCore;
|
||||
import makeo.gadomancy.client.renderers.entity.RenderEntityItem;
|
||||
import makeo.gadomancy.client.renderers.item.ItemCreativeNodeRenderer;
|
||||
import makeo.gadomancy.client.renderers.item.ItemExNodeRenderer;
|
||||
import makeo.gadomancy.client.renderers.item.ItemJarExtendedNodeRenderer;
|
||||
@@ -34,7 +33,6 @@ import makeo.gadomancy.common.registration.RegisteredBlocks;
|
||||
import makeo.gadomancy.common.registration.RegisteredItems;
|
||||
import makeo.gadomancy.common.utils.Injector;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.ItemRenderer;
|
||||
import net.minecraft.client.renderer.entity.Render;
|
||||
import net.minecraft.client.resources.IResourceManager;
|
||||
import net.minecraft.client.resources.SimpleReloadableResourceManager;
|
||||
@@ -146,7 +144,7 @@ public class ClientProxy extends CommonProxy {
|
||||
itemRenderStoneMachine.registerRenderer(2, tileBlockProtector, renderTileBlockProtector);
|
||||
itemRenderStoneMachine.registerRenderer(4, new TileArcanePackager(), renderTileArcanePackager);
|
||||
|
||||
MinecraftForgeClient.registerItemRenderer(RegisteredItems.itemFamiliar, new ItemRenderFamiliar());
|
||||
MinecraftForgeClient.registerItemRenderer(RegisteredItems.itemFamiliar_old, new ItemRenderFamiliar());
|
||||
MinecraftForgeClient.registerItemRenderer(RegisteredItems.itemCreativeNode, new ItemCreativeNodeRenderer());
|
||||
|
||||
//Entities
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package makeo.gadomancy.client.renderers.item;
|
||||
|
||||
import makeo.gadomancy.client.util.FamiliarHandlerClient;
|
||||
import makeo.gadomancy.common.items.baubles.ItemFamiliar;
|
||||
import makeo.gadomancy.common.items.baubles.ItemFamiliar_Old;
|
||||
import makeo.gadomancy.common.utils.world.fake.FakeWorld;
|
||||
import net.minecraft.client.renderer.ActiveRenderInfo;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
@@ -27,7 +27,7 @@ public class ItemRenderFamiliar implements IItemRenderer {
|
||||
|
||||
@Override
|
||||
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
|
||||
return !(item == null || !(item.getItem() instanceof ItemFamiliar));
|
||||
return !(item == null || !(item.getItem() instanceof ItemFamiliar_Old));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -43,7 +43,7 @@ public class ItemRenderFamiliar implements IItemRenderer {
|
||||
|
||||
@Override
|
||||
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
|
||||
if(item == null || !(item.getItem() instanceof ItemFamiliar)) return;
|
||||
if(item == null || !(item.getItem() instanceof ItemFamiliar_Old)) return;
|
||||
GL11.glPushMatrix();
|
||||
if(type == ItemRenderType.EQUIPPED) {
|
||||
GL11.glTranslatef(0.5F, 0.5F, 0.7F);
|
||||
@@ -56,9 +56,9 @@ public class ItemRenderFamiliar implements IItemRenderer {
|
||||
try {
|
||||
cleanActiveRenderInfo(type);
|
||||
GL11.glScalef(1.2F, 1.2F, 1.2F);
|
||||
if(((ItemFamiliar) item.getItem()).hasAspect(item)) {
|
||||
if(((ItemFamiliar_Old) item.getItem()).hasAspect(item)) {
|
||||
ENTITY_WISP.ticksExisted = FamiliarHandlerClient.PartialEntityFamiliar.DUMMY_FAMILIAR.ticksExisted;
|
||||
ENTITY_WISP.setType(((ItemFamiliar) item.getItem()).getAspect(item).getTag());
|
||||
ENTITY_WISP.setType(((ItemFamiliar_Old) item.getItem()).getAspect(item).getTag());
|
||||
fallbackRenderer.doRender(ENTITY_WISP, 0, 0, 0, 0, 0);
|
||||
}
|
||||
} finally {
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
package makeo.gadomancy.client.util;
|
||||
|
||||
import baubles.api.BaublesApi;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import makeo.gadomancy.common.data.DataFamiliar;
|
||||
import makeo.gadomancy.common.items.baubles.ItemFamiliar;
|
||||
import makeo.gadomancy.common.network.packets.PacketFamiliarBolt;
|
||||
import makeo.gadomancy.common.utils.world.fake.FakeWorld;
|
||||
import net.minecraft.client.Minecraft;
|
||||
@@ -12,7 +10,6 @@ import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
@@ -56,8 +56,9 @@ public class TileAdditionalEldritchPortal extends TileEldritchPortal {
|
||||
if(toTeleport.dimension != ModConfig.dimOuterId) {
|
||||
//Teleporting there.
|
||||
|
||||
startTracking(toTeleport, new ExtendedChunkCoordinates(new ChunkCoordinates(xCoord, yCoord, zCoord), toTeleport.dimension));
|
||||
TCMazeHandler.createSessionWaitForTeleport(toTeleport);
|
||||
if(TCMazeHandler.createSessionWaitForTeleport(toTeleport)) {
|
||||
startTracking(toTeleport, new ExtendedChunkCoordinates(new ChunkCoordinates(xCoord, yCoord, zCoord), toTeleport.dimension));
|
||||
}
|
||||
} else {
|
||||
//Teleporting back.
|
||||
|
||||
|
||||
@@ -17,18 +17,18 @@ public abstract class AbstractData {
|
||||
|
||||
private byte providerId;
|
||||
|
||||
public void markDirty() {
|
||||
public final void markDirty() {
|
||||
AbstractDataProvider<? extends AbstractData> provider = Registry.getProvider(getProviderID());
|
||||
if(provider != null) {
|
||||
SyncDataHolder.markForUpdate(provider.getKey());
|
||||
}
|
||||
}
|
||||
|
||||
public void setProviderId(byte id) {
|
||||
public final void setProviderId(byte id) {
|
||||
this.providerId = id;
|
||||
}
|
||||
|
||||
public byte getProviderID() {
|
||||
public final byte getProviderID() {
|
||||
return providerId;
|
||||
}
|
||||
|
||||
@@ -67,11 +67,11 @@ public abstract class AbstractData {
|
||||
|
||||
public abstract T provideNewInstance();
|
||||
|
||||
public String getKey() {
|
||||
public final String getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
public byte getProviderId() {
|
||||
public final byte getProviderId() {
|
||||
return providerId;
|
||||
}
|
||||
|
||||
@@ -79,9 +79,10 @@ public abstract class AbstractData {
|
||||
|
||||
public abstract static class ProviderAutoAllocate<T extends AbstractData> extends AbstractDataProvider<T> {
|
||||
|
||||
protected ProviderAutoAllocate(String key) {
|
||||
public ProviderAutoAllocate(String key) {
|
||||
super(key, SyncDataHolder.allocateNewId());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,7 +3,7 @@ package makeo.gadomancy.common.data;
|
||||
import baubles.api.BaublesApi;
|
||||
import makeo.gadomancy.client.util.FamiliarHandlerClient;
|
||||
import makeo.gadomancy.common.familiar.FamiliarAIController;
|
||||
import makeo.gadomancy.common.items.baubles.ItemFamiliar;
|
||||
import makeo.gadomancy.common.items.baubles.ItemFamiliar_Old;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -88,12 +88,13 @@ public class DataFamiliar extends AbstractData {
|
||||
familiarAI.get(player).scheduleTick();
|
||||
}
|
||||
|
||||
//TODO adjust to new itemClass!
|
||||
public void checkPlayerEquipment(EntityPlayer p) {
|
||||
IInventory baublesInv = BaublesApi.getBaubles(p);
|
||||
if(baublesInv.getStackInSlot(0) != null) {
|
||||
ItemStack amulet = baublesInv.getStackInSlot(0);
|
||||
if(amulet.getItem() != null && amulet.getItem() instanceof ItemFamiliar) {
|
||||
ItemFamiliar fam = (ItemFamiliar) amulet.getItem();
|
||||
if(amulet.getItem() != null && amulet.getItem() instanceof ItemFamiliar_Old) {
|
||||
ItemFamiliar_Old fam = (ItemFamiliar_Old) amulet.getItem();
|
||||
Aspect a = fam.getAspect(amulet);
|
||||
if(a != null) {
|
||||
handleEquip(p.worldObj, p, a);
|
||||
|
||||
@@ -0,0 +1,171 @@
|
||||
package makeo.gadomancy.common.items.baubles;
|
||||
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* This class is part of the Gadomancy Mod
|
||||
* Gadomancy is Open Source and distributed under the
|
||||
* GNU LESSER GENERAL PUBLIC LICENSE
|
||||
* for more read the LICENSE file
|
||||
*
|
||||
* Created by HellFirePvP @ 28.12.2015 23:44
|
||||
*/
|
||||
public class FamiliarAugment {
|
||||
|
||||
private static final String FORMAT_NAME = "familiar.augment.%s.name";
|
||||
|
||||
//Main effects
|
||||
public static final FamiliarAugment SHOCK = new FamiliarAugment("shock");
|
||||
public static final FamiliarAugment POISON = new FamiliarAugment("poison").addConflict(SHOCK);
|
||||
public static final FamiliarAugment FIRE = new FamiliarAugment("fire").addConflict(SHOCK, POISON);
|
||||
public static final FamiliarAugment WEAKNESS = new FamiliarAugment("weakness").addConflict(SHOCK, POISON, FIRE);
|
||||
|
||||
//Side effects
|
||||
public static final FamiliarAugment DAMAGE_INCREASE = new FamiliarAugment("damage").addCondition(new PreconditionAny(SHOCK, POISON, FIRE, WEAKNESS));
|
||||
public static final FamiliarAugment RANGE_INCREASE = new FamiliarAugment("range").addConflict(DAMAGE_INCREASE).addCondition(new PreconditionAny(SHOCK, POISON, FIRE, WEAKNESS));
|
||||
public static final FamiliarAugment ATTACK_SPEED = new FamiliarAugment("speed").addConflict(DAMAGE_INCREASE, RANGE_INCREASE).addCondition(new PreconditionAny(SHOCK, POISON, FIRE, WEAKNESS));
|
||||
|
||||
|
||||
private final String unlocalizedName;
|
||||
private List<FamiliarAugmentPrecondition> preconditions = new ArrayList<FamiliarAugmentPrecondition>();
|
||||
private boolean requiresPrevLevel = true;
|
||||
private List<FamiliarAugment> conflicts = new ArrayList<FamiliarAugment>();
|
||||
|
||||
private static Map<String, FamiliarAugment> BY_NAME = new HashMap<String, FamiliarAugment>();
|
||||
|
||||
private FamiliarAugment(String unlocalizedName) {
|
||||
this.unlocalizedName = unlocalizedName;
|
||||
BY_NAME.put(this.unlocalizedName.toLowerCase(), this);
|
||||
}
|
||||
|
||||
private FamiliarAugment setIgnorePreviousLevel() {
|
||||
this.requiresPrevLevel = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
private FamiliarAugment addCondition(FamiliarAugmentPrecondition condition) {
|
||||
preconditions.add(condition);
|
||||
return this;
|
||||
}
|
||||
|
||||
private FamiliarAugment addConflict(FamiliarAugment... others) {
|
||||
for(FamiliarAugment augment : others) {
|
||||
if(augment == null) continue;
|
||||
addConflict(augment);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
private FamiliarAugment addConflict(FamiliarAugment other) {
|
||||
if(!conflicts.contains(other)) conflicts.add(other);
|
||||
if(!other.conflicts.contains(this)) other.conflicts.add(this);
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getUnlocalizedName() {
|
||||
return String.format(FORMAT_NAME, unlocalizedName);
|
||||
}
|
||||
|
||||
public String getLocalizedName() {
|
||||
return StatCollector.translateToLocal(getUnlocalizedName());
|
||||
}
|
||||
|
||||
public static FamiliarAugment getByUnlocalizedName(String name) {
|
||||
return BY_NAME.get(name.toLowerCase());
|
||||
}
|
||||
|
||||
//Returns true, if the current conditions for application are fulfilled for a familiar with given augments.
|
||||
public boolean checkConditions(List<FamiliarAugment.FamiliarAugmentPair> currentAugments, int levelToSet) {
|
||||
if(levelToSet <= 0) return false;
|
||||
for(FamiliarAugmentPair current : currentAugments) {
|
||||
if(conflicts.contains(current.augment)) return false;
|
||||
}
|
||||
if(requiresPrevLevel) {
|
||||
boolean containsAtAll = false;
|
||||
int foundLevel = -1;
|
||||
for(FamiliarAugmentPair pair : currentAugments) {
|
||||
if(pair.augment.equals(FamiliarAugment.this)) {
|
||||
containsAtAll = true;
|
||||
foundLevel = pair.level;
|
||||
}
|
||||
}
|
||||
if(!containsAtAll) {
|
||||
if(levelToSet != 1) return false;
|
||||
} else {
|
||||
if(foundLevel != (levelToSet - 1)) return false;
|
||||
}
|
||||
}
|
||||
for(FamiliarAugmentPrecondition precondition : preconditions) {
|
||||
if(precondition == null) continue;
|
||||
if(!precondition.isFulfilled(currentAugments, levelToSet)) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private abstract static class FamiliarAugmentPrecondition {
|
||||
|
||||
public abstract boolean isFulfilled(List<FamiliarAugmentPair> currentAugments, int levelToSet);
|
||||
|
||||
}
|
||||
|
||||
public static class PreconditionAny extends FamiliarAugmentPrecondition {
|
||||
|
||||
private FamiliarAugment[] anyPrevAugment;
|
||||
|
||||
private PreconditionAny(FamiliarAugment... any) {
|
||||
this.anyPrevAugment = any;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFulfilled(List<FamiliarAugmentPair> currentAugments, int levelToSet) {
|
||||
if(anyPrevAugment == null) return true;
|
||||
for(FamiliarAugment augment : anyPrevAugment) {
|
||||
if(augment == null) continue;
|
||||
for(FamiliarAugmentPair pair : currentAugments) {
|
||||
if(pair.augment.equals(augment)) return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static class PreconditionAll extends FamiliarAugmentPrecondition {
|
||||
|
||||
private FamiliarAugment[] prevAugments;
|
||||
|
||||
private PreconditionAll(FamiliarAugment... previous) {
|
||||
this.prevAugments = previous;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFulfilled(List<FamiliarAugmentPair> currentAugments, int levelToSet) {
|
||||
if(prevAugments == null) return true;
|
||||
for(FamiliarAugment augment : prevAugments) {
|
||||
if(augment == null) continue;
|
||||
boolean contains = false;
|
||||
for(FamiliarAugmentPair pair : currentAugments) {
|
||||
if(pair.augment.equals(augment)) contains = true;
|
||||
}
|
||||
if(!contains) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public static class FamiliarAugmentPair {
|
||||
|
||||
public final FamiliarAugment augment;
|
||||
public final int level;
|
||||
|
||||
public FamiliarAugmentPair(FamiliarAugment augment, int level) {
|
||||
this.augment = augment;
|
||||
this.level = level;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,188 @@
|
||||
package makeo.gadomancy.common.items.baubles;
|
||||
|
||||
import baubles.api.BaubleType;
|
||||
import baubles.api.IBauble;
|
||||
import makeo.gadomancy.common.Gadomancy;
|
||||
import makeo.gadomancy.common.data.DataFamiliar;
|
||||
import makeo.gadomancy.common.data.SyncDataHolder;
|
||||
import makeo.gadomancy.common.registration.RegisteredItems;
|
||||
import makeo.gadomancy.common.utils.MiscUtils;
|
||||
import makeo.gadomancy.common.utils.NBTHelper;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.common.lib.research.ResearchManager;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* This class is part of the Gadomancy Mod
|
||||
* Gadomancy is Open Source and distributed under the
|
||||
* GNU LESSER GENERAL PUBLIC LICENSE
|
||||
* for more read the LICENSE file
|
||||
*
|
||||
* Created by HellFirePvP @ 28.12.2015 23:09
|
||||
*/
|
||||
public class ItemEtherealFamiliar extends Item implements IBauble {
|
||||
|
||||
public ItemEtherealFamiliar() {
|
||||
setUnlocalizedName("ItemEtherealFamiliar");
|
||||
setMaxStackSize(1);
|
||||
setFull3D();
|
||||
setCreativeTab(RegisteredItems.creativeTab);
|
||||
|
||||
setTextureName(Gadomancy.MODID + ":category_icon");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubItems(Item item, CreativeTabs tab, List list) {
|
||||
ItemStack stack = new ItemStack(item);
|
||||
setFamiliarAspect(stack, Aspect.MAGIC);
|
||||
list.add(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List lore, boolean flag) {
|
||||
List<String> newLore = new ArrayList<String>();
|
||||
|
||||
if(hasFamiliarAspect(stack)) {
|
||||
newLore.add(EnumChatFormatting.GRAY + getFamiliarAspect(stack).getName());
|
||||
}
|
||||
|
||||
List<FamiliarAugment.FamiliarAugmentPair> augments = getAugments(stack);
|
||||
for (FamiliarAugment.FamiliarAugmentPair pair : augments) {
|
||||
newLore.add(EnumChatFormatting.GRAY + pair.augment.getLocalizedName() + " " + MiscUtils.toRomanNumeral(pair.level));
|
||||
}
|
||||
|
||||
|
||||
if(Keyboard.isKeyDown(42) || Keyboard.isKeyDown(54)) {
|
||||
lore.addAll(newLore);
|
||||
} else {
|
||||
if(!newLore.isEmpty()) lore.add(EnumChatFormatting.DARK_GRAY + "" + EnumChatFormatting.ITALIC + StatCollector.translateToLocal("gadomancy.lore.hasAdditionalLore"));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack p_77613_1_) {
|
||||
return RegisteredItems.raritySacred;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaubleType getBaubleType(ItemStack itemStack) {
|
||||
return BaubleType.AMULET;
|
||||
}
|
||||
|
||||
public static boolean hasFamiliarAspect(ItemStack stack) {
|
||||
return getFamiliarAspect(stack) != null;
|
||||
}
|
||||
|
||||
public static void setFamiliarAspect(ItemStack stack, Aspect aspect) {
|
||||
if(stack == null || !(stack.getItem() instanceof ItemEtherealFamiliar)) return;
|
||||
NBTHelper.getData(stack).setString("aspect", aspect.getTag());
|
||||
}
|
||||
|
||||
public static Aspect getFamiliarAspect(ItemStack stack) {
|
||||
if(stack == null || !(stack.getItem() instanceof ItemEtherealFamiliar)) return null;
|
||||
String tag = NBTHelper.getData(stack).getString("aspect");
|
||||
if(tag == null || tag.equalsIgnoreCase("")) return null;
|
||||
return Aspect.getAspect(tag);
|
||||
}
|
||||
|
||||
public static boolean hasAugment(ItemStack stack, FamiliarAugment augment) {
|
||||
List<FamiliarAugment.FamiliarAugmentPair> pairs = getAugments(stack);
|
||||
for (FamiliarAugment.FamiliarAugmentPair pair : pairs) {
|
||||
if(pair.augment.equals(augment)) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static List<FamiliarAugment.FamiliarAugmentPair> getAugments(ItemStack stack) {
|
||||
if(stack == null || !(stack.getItem() instanceof ItemEtherealFamiliar)) return new ArrayList<FamiliarAugment.FamiliarAugmentPair>();
|
||||
NBTTagCompound augmentTag = NBTHelper.getData(stack).getCompoundTag("augments");
|
||||
Set<String> strKeySet = augmentTag.func_150296_c();
|
||||
if(strKeySet == null || strKeySet.size() <= 0) return new ArrayList<FamiliarAugment.FamiliarAugmentPair>();
|
||||
List<FamiliarAugment.FamiliarAugmentPair> augmentList = new ArrayList<FamiliarAugment.FamiliarAugmentPair>();
|
||||
for(String key : strKeySet) {
|
||||
FamiliarAugment augment = FamiliarAugment.getByUnlocalizedName(key);
|
||||
int level = augmentTag.getInteger(key);
|
||||
augmentList.add(new FamiliarAugment.FamiliarAugmentPair(augment, level));
|
||||
}
|
||||
return augmentList;
|
||||
}
|
||||
|
||||
public static boolean doesAcceptAugment(ItemStack stack, FamiliarAugment augment, int level) {
|
||||
if(stack == null || !(stack.getItem() instanceof ItemEtherealFamiliar)) return false;
|
||||
List<FamiliarAugment.FamiliarAugmentPair> currentAugments = getAugments(stack);
|
||||
for(FamiliarAugment.FamiliarAugmentPair pair : currentAugments) {
|
||||
if(pair.augment.equals(augment)) return false;
|
||||
}
|
||||
return augment.checkConditions(currentAugments, level);
|
||||
}
|
||||
|
||||
public static boolean addAugment(ItemStack stack, FamiliarAugment augment, int level) {
|
||||
if(stack == null || !(stack.getItem() instanceof ItemEtherealFamiliar) || level <= 0) return false;
|
||||
return doesAcceptAugment(stack, augment, level) && addAugmentUnsafe(stack, augment, level);
|
||||
}
|
||||
|
||||
public static boolean addAugmentUnsafe(ItemStack stack, FamiliarAugment augment, int level) {
|
||||
if(stack == null || !(stack.getItem() instanceof ItemEtherealFamiliar) || level <= 0) return false;
|
||||
NBTTagCompound tag = NBTHelper.getData(stack);
|
||||
|
||||
NBTTagCompound augmentTag = NBTHelper.getData(stack).getCompoundTag("augments");
|
||||
augmentTag.setInteger(augment.getUnlocalizedName(), level);
|
||||
|
||||
tag.setTag("augments", augmentTag);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWornTick(ItemStack itemStack, EntityLivingBase entityLivingBase) {
|
||||
//TODO get and tick AI controlling
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEquipped(ItemStack itemStack, EntityLivingBase entity) {
|
||||
if(itemStack == null) return;
|
||||
if(entity instanceof EntityPlayer && itemStack.getItem() instanceof ItemEtherealFamiliar) {
|
||||
DataFamiliar familiarData = SyncDataHolder.getDataServer("FamiliarData");
|
||||
Aspect a = getFamiliarAspect(itemStack);
|
||||
if(a != null) {
|
||||
familiarData.handleEquip(((EntityPlayer) entity).worldObj, (EntityPlayer) entity, a);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUnequipped(ItemStack itemStack, EntityLivingBase entity) {
|
||||
if(itemStack == null) return;
|
||||
if(entity instanceof EntityPlayer && itemStack.getItem() instanceof ItemEtherealFamiliar) {
|
||||
DataFamiliar familiarData = SyncDataHolder.getDataServer("FamiliarData");
|
||||
Aspect a = getFamiliarAspect(itemStack);
|
||||
if(a != null) {
|
||||
familiarData.handleUnequip(((EntityPlayer) entity).worldObj, (EntityPlayer) entity, a);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canEquip(ItemStack itemStack, EntityLivingBase entityLivingBase) {
|
||||
if(!(entityLivingBase instanceof EntityPlayer)) return false;
|
||||
return ResearchManager.isResearchComplete(entityLivingBase.getCommandSenderName(), Gadomancy.MODID.toUpperCase() + ".FAMILIAR");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUnequip(ItemStack itemStack, EntityLivingBase entityLivingBase) {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
+50
-13
@@ -5,6 +5,7 @@ import baubles.api.IBauble;
|
||||
import makeo.gadomancy.common.Gadomancy;
|
||||
import makeo.gadomancy.common.data.DataFamiliar;
|
||||
import makeo.gadomancy.common.data.SyncDataHolder;
|
||||
import makeo.gadomancy.common.registration.DeprecationItemPaybacks;
|
||||
import makeo.gadomancy.common.registration.RegisteredItems;
|
||||
import makeo.gadomancy.common.utils.NBTHelper;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
@@ -13,12 +14,19 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
import thaumcraft.common.Thaumcraft;
|
||||
import thaumcraft.common.config.ConfigBlocks;
|
||||
import thaumcraft.common.config.ConfigItems;
|
||||
import thaumcraft.common.items.ItemEssence;
|
||||
import thaumcraft.common.items.ItemWispEssence;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -29,9 +37,9 @@ import java.util.List;
|
||||
*
|
||||
* Created by HellFirePvP @ 31.10.2015 11:38
|
||||
*/
|
||||
public class ItemFamiliar extends Item implements IBauble {
|
||||
public class ItemFamiliar_Old extends Item implements IBauble {
|
||||
|
||||
public ItemFamiliar() {
|
||||
public ItemFamiliar_Old() {
|
||||
setUnlocalizedName("ItemFamiliar");
|
||||
setMaxStackSize(1);
|
||||
setFull3D();
|
||||
@@ -106,26 +114,26 @@ public class ItemFamiliar extends Item implements IBauble {
|
||||
|
||||
public Aspect getAspect(ItemStack stack) {
|
||||
if(!hasAspect(stack)) return null;
|
||||
if(stack == null || !(stack.getItem() instanceof ItemFamiliar)) return null;
|
||||
if(stack == null || !(stack.getItem() instanceof ItemFamiliar_Old)) return null;
|
||||
if(!stack.hasTagCompound() || !stack.getTagCompound().hasKey("aspect")) return null;
|
||||
return Aspect.getAspect(stack.getTagCompound().getString("aspect"));
|
||||
}
|
||||
|
||||
public boolean hasAspect(ItemStack stack) {
|
||||
if(stack == null || !(stack.getItem() instanceof ItemFamiliar)) return false;
|
||||
if(stack == null || !(stack.getItem() instanceof ItemFamiliar_Old)) return false;
|
||||
if(!stack.hasTagCompound() || !stack.getTagCompound().hasKey("aspect")) return false;
|
||||
return Aspect.getAspect(stack.getTagCompound().getString("aspect")) != null;
|
||||
}
|
||||
|
||||
public void setAspect(ItemStack stack, Aspect aspect) {
|
||||
if(stack == null || !(stack.getItem() instanceof ItemFamiliar)) return;
|
||||
if(stack == null || !(stack.getItem() instanceof ItemFamiliar_Old)) return;
|
||||
NBTHelper.getData(stack).setString("aspect", aspect.getTag());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWornTick(ItemStack itemStack, EntityLivingBase entity) {
|
||||
if(itemStack == null) return;
|
||||
if(entity instanceof EntityPlayer && itemStack.getItem() instanceof ItemFamiliar) {
|
||||
if(entity instanceof EntityPlayer && itemStack.getItem() instanceof ItemFamiliar_Old) {
|
||||
DataFamiliar familiarData = SyncDataHolder.getDataServer("FamiliarData");
|
||||
Aspect a = getAspect(itemStack);
|
||||
if(a != null) {
|
||||
@@ -149,7 +157,7 @@ public class ItemFamiliar extends Item implements IBauble {
|
||||
@Override
|
||||
public void onEquipped(ItemStack itemStack, EntityLivingBase entity) {
|
||||
if(itemStack == null) return;
|
||||
if(entity instanceof EntityPlayer && itemStack.getItem() instanceof ItemFamiliar) {
|
||||
if(entity instanceof EntityPlayer && itemStack.getItem() instanceof ItemFamiliar_Old) {
|
||||
DataFamiliar familiarData = SyncDataHolder.getDataServer("FamiliarData");
|
||||
Aspect a = getAspect(itemStack);
|
||||
if(a != null) {
|
||||
@@ -161,7 +169,7 @@ public class ItemFamiliar extends Item implements IBauble {
|
||||
@Override
|
||||
public void onUnequipped(ItemStack itemStack, EntityLivingBase entity) {
|
||||
if(itemStack == null) return;
|
||||
if(entity instanceof EntityPlayer && itemStack.getItem() instanceof ItemFamiliar) {
|
||||
if(entity instanceof EntityPlayer && itemStack.getItem() instanceof ItemFamiliar_Old) {
|
||||
DataFamiliar familiarData = SyncDataHolder.getDataServer("FamiliarData");
|
||||
Aspect a = getAspect(itemStack);
|
||||
if(a != null) {
|
||||
@@ -183,7 +191,7 @@ public class ItemFamiliar extends Item implements IBauble {
|
||||
//Infusion stuff.
|
||||
|
||||
public int getAttackRangeIncrease(ItemStack itemStack) {
|
||||
if(!(itemStack.getItem() instanceof ItemFamiliar)) return 0;
|
||||
if(!(itemStack.getItem() instanceof ItemFamiliar_Old)) return 0;
|
||||
|
||||
int range = 0;
|
||||
|
||||
@@ -194,12 +202,12 @@ public class ItemFamiliar extends Item implements IBauble {
|
||||
}
|
||||
|
||||
public int getAttackCooldownReduction(ItemStack itemStack) {
|
||||
if(!(itemStack.getItem() instanceof ItemFamiliar)) return 0;
|
||||
if(!(itemStack.getItem() instanceof ItemFamiliar_Old)) return 0;
|
||||
return hasUpgrade(itemStack, FamiliarUpgrade.COOLDOWN_1) ? 10 : 0;
|
||||
}
|
||||
|
||||
public float getAttackStrength(ItemStack itemStack) {
|
||||
if(!(itemStack.getItem() instanceof ItemFamiliar)) return 0F;
|
||||
if(!(itemStack.getItem() instanceof ItemFamiliar_Old)) return 0F;
|
||||
|
||||
float attack = 1F;
|
||||
|
||||
@@ -216,17 +224,46 @@ public class ItemFamiliar extends Item implements IBauble {
|
||||
}
|
||||
|
||||
public boolean hasUpgrade(ItemStack stack, FamiliarUpgrade upgrade) {
|
||||
if(stack == null || !(stack.getItem() instanceof ItemFamiliar)) return false;
|
||||
if(stack == null || !(stack.getItem() instanceof ItemFamiliar_Old)) return false;
|
||||
if(upgrade == null) return true;
|
||||
if(!stack.hasTagCompound() || !stack.getTagCompound().hasKey(upgrade.getTag())) return false;
|
||||
return stack.getTagCompound().getBoolean(upgrade.getTag());
|
||||
}
|
||||
|
||||
public void addUpgrade(ItemStack stack, FamiliarUpgrade upgrade) {
|
||||
if(stack == null || !(stack.getItem() instanceof ItemFamiliar)) return;
|
||||
if(stack == null || !(stack.getItem() instanceof ItemFamiliar_Old)) return;
|
||||
NBTHelper.getData(stack).setBoolean(upgrade.getTag(), true);
|
||||
}
|
||||
|
||||
public static ItemStack getPaybackPackage(ItemStack oldFamiliarStack) {
|
||||
if(oldFamiliarStack == null || !(oldFamiliarStack.getItem() instanceof ItemFamiliar_Old)) return null;
|
||||
ItemStack arcPackage = new ItemStack(RegisteredItems.itemPackage, 1, 2);
|
||||
List<ItemStack> contents = new ArrayList<ItemStack>();
|
||||
arcPackage.setStackDisplayName(EnumChatFormatting.GOLD + "Used Familiar Items");
|
||||
|
||||
DeprecationItemPaybacks.addFamiliarCraftingPaybackStack(contents, oldFamiliarStack);
|
||||
|
||||
if(RegisteredItems.itemFamiliar_old.hasUpgrade(oldFamiliarStack, FamiliarUpgrade.ATTACK_1)) {
|
||||
DeprecationItemPaybacks.addFamiliarAttack1Payback(contents, oldFamiliarStack);
|
||||
}
|
||||
if(RegisteredItems.itemFamiliar_old.hasUpgrade(oldFamiliarStack, FamiliarUpgrade.ATTACK_2)) {
|
||||
DeprecationItemPaybacks.addFamiliarAttack2Payback(contents, oldFamiliarStack);
|
||||
}
|
||||
if(RegisteredItems.itemFamiliar_old.hasUpgrade(oldFamiliarStack, FamiliarUpgrade.ATTACK_3)) {
|
||||
DeprecationItemPaybacks.addFamiliarAttack3Payback(contents, oldFamiliarStack);
|
||||
}
|
||||
if(RegisteredItems.itemFamiliar_old.hasUpgrade(oldFamiliarStack, FamiliarUpgrade.COOLDOWN_1)) {
|
||||
DeprecationItemPaybacks.addFamiliarCooldownPayback(contents, oldFamiliarStack);
|
||||
}
|
||||
if(RegisteredItems.itemFamiliar_old.hasUpgrade(oldFamiliarStack, FamiliarUpgrade.RANGE_1)) {
|
||||
DeprecationItemPaybacks.addFamiliarRangePayback(contents, oldFamiliarStack);
|
||||
}
|
||||
|
||||
RegisteredItems.itemPackage.setContents(arcPackage, contents);
|
||||
|
||||
return arcPackage;
|
||||
}
|
||||
|
||||
public static enum FamiliarUpgrade {
|
||||
|
||||
ATTACK_1("AttackUpgrade1"),
|
||||
@@ -0,0 +1,262 @@
|
||||
package makeo.gadomancy.common.registration;
|
||||
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
import thaumcraft.common.config.ConfigBlocks;
|
||||
import thaumcraft.common.config.ConfigItems;
|
||||
import thaumcraft.common.items.ItemEssence;
|
||||
import thaumcraft.common.items.ItemWispEssence;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* This class is part of the Gadomancy Mod
|
||||
* Gadomancy is Open Source and distributed under the
|
||||
* GNU LESSER GENERAL PUBLIC LICENSE
|
||||
* for more read the LICENSE file
|
||||
* <p/>
|
||||
* Created by HellFirePvP @ 29.12.2015 15:03
|
||||
*/
|
||||
public class DeprecationItemPaybacks {
|
||||
|
||||
public static void addFamiliarRangePayback(List<ItemStack> contents, ItemStack oldFamiliarStack) {
|
||||
Aspect aspect = RegisteredItems.itemFamiliar_old.getAspect(oldFamiliarStack);
|
||||
ItemWispEssence itemEssence = (ItemWispEssence) ConfigItems.itemWispEssence;
|
||||
ItemStack wispyEssence = null;
|
||||
if(aspect != null) {
|
||||
wispyEssence = new ItemStack(ConfigItems.itemWispEssence, 1, 0);
|
||||
itemEssence.setAspects(wispyEssence, new AspectList().add(aspect, 2));
|
||||
}
|
||||
|
||||
List<ItemStack> reward = new ArrayList<ItemStack>();
|
||||
reward.add(new ItemStack(ConfigItems.itemResource, 2, 17));
|
||||
reward.add(new ItemStack(ConfigItems.itemResource, 2, 0));
|
||||
|
||||
if(wispyEssence != null) {
|
||||
ItemStack add = wispyEssence.copy();
|
||||
add.stackSize = 4;
|
||||
reward.add(add);
|
||||
}
|
||||
|
||||
int auram = 44;
|
||||
int magic = 51;
|
||||
int other = 37;
|
||||
ItemStack phials = getPhialStack(Aspect.AURA, auram);
|
||||
if(phials != null) reward.add(phials);
|
||||
phials = getPhialStack(Aspect.MAGIC, magic);
|
||||
if(phials != null) reward.add(phials);
|
||||
if(aspect != null) {
|
||||
phials = getPhialStack(aspect, other);
|
||||
if(phials != null) reward.add(phials);
|
||||
}
|
||||
|
||||
ItemStack craftingPackage = new ItemStack(RegisteredItems.itemPackage, 1, 1);
|
||||
RegisteredItems.itemPackage.setContents(craftingPackage, reward);
|
||||
contents.add(craftingPackage);
|
||||
}
|
||||
|
||||
public static void addFamiliarCooldownPayback(List<ItemStack> contents, ItemStack oldFamiliarStack) {
|
||||
Aspect aspect = RegisteredItems.itemFamiliar_old.getAspect(oldFamiliarStack);
|
||||
ItemWispEssence itemEssence = (ItemWispEssence) ConfigItems.itemWispEssence;
|
||||
ItemStack wispyEssence = null;
|
||||
if(aspect != null) {
|
||||
wispyEssence = new ItemStack(ConfigItems.itemWispEssence, 1, 0);
|
||||
itemEssence.setAspects(wispyEssence, new AspectList().add(aspect, 2));
|
||||
}
|
||||
|
||||
List<ItemStack> reward = new ArrayList<ItemStack>();
|
||||
reward.add(new ItemStack(ConfigItems.itemEldritchObject, 1, 3));
|
||||
reward.add(new ItemStack(ConfigItems.itemFocusPrimal));
|
||||
reward.add(new ItemStack(ConfigItems.itemFocusPrimal));
|
||||
reward.add(new ItemStack(ConfigItems.itemBathSalts, 2, 0));
|
||||
|
||||
if(wispyEssence != null) {
|
||||
ItemStack add = wispyEssence.copy();
|
||||
add.stackSize = 2;
|
||||
reward.add(add);
|
||||
}
|
||||
|
||||
int auram = 79;
|
||||
int magic = 101;
|
||||
int permutatio = 54;
|
||||
int other = 81;
|
||||
ItemStack phials = getPhialStack(Aspect.AURA, auram);
|
||||
if(phials != null) reward.add(phials);
|
||||
phials = getPhialStack(Aspect.EXCHANGE, permutatio);
|
||||
if(phials != null) reward.add(phials);
|
||||
phials = getPhialStack(Aspect.MAGIC, magic);
|
||||
if(phials != null) reward.add(phials);
|
||||
if(aspect != null) {
|
||||
phials = getPhialStack(aspect, other);
|
||||
if(phials != null) reward.add(phials);
|
||||
}
|
||||
|
||||
ItemStack craftingPackage = new ItemStack(RegisteredItems.itemPackage, 1, 1);
|
||||
RegisteredItems.itemPackage.setContents(craftingPackage, reward);
|
||||
contents.add(craftingPackage);
|
||||
}
|
||||
|
||||
public static void addFamiliarAttack3Payback(List<ItemStack> contents, ItemStack oldFamiliarStack) {
|
||||
Aspect aspect = RegisteredItems.itemFamiliar_old.getAspect(oldFamiliarStack);
|
||||
ItemWispEssence itemEssence = (ItemWispEssence) ConfigItems.itemWispEssence;
|
||||
ItemStack wispyEssence = null;
|
||||
if(aspect != null) {
|
||||
wispyEssence = new ItemStack(ConfigItems.itemWispEssence, 1, 0);
|
||||
itemEssence.setAspects(wispyEssence, new AspectList().add(aspect, 2));
|
||||
}
|
||||
|
||||
List<ItemStack> reward = new ArrayList<ItemStack>();
|
||||
reward.add(new ItemStack(ConfigItems.itemEldritchObject, 1, 3));
|
||||
reward.add(new ItemStack(Items.nether_star));
|
||||
reward.add(new ItemStack(ConfigBlocks.blockCustomPlant, 2, 4));
|
||||
|
||||
if(wispyEssence != null) {
|
||||
ItemStack add = wispyEssence.copy();
|
||||
add.stackSize = 4;
|
||||
reward.add(add);
|
||||
}
|
||||
|
||||
int auram = 77;
|
||||
int magic = 93;
|
||||
int telum = 49;
|
||||
int other = 104;
|
||||
ItemStack phials = getPhialStack(Aspect.AURA, auram);
|
||||
if(phials != null) reward.add(phials);
|
||||
phials = getPhialStack(Aspect.WEAPON, telum);
|
||||
if(phials != null) reward.add(phials);
|
||||
phials = getPhialStack(Aspect.MAGIC, magic);
|
||||
if(phials != null) reward.add(phials);
|
||||
if(aspect != null) {
|
||||
phials = getPhialStack(aspect, other);
|
||||
if(phials != null) reward.add(phials);
|
||||
}
|
||||
|
||||
ItemStack craftingPackage = new ItemStack(RegisteredItems.itemPackage, 1, 1);
|
||||
RegisteredItems.itemPackage.setContents(craftingPackage, reward);
|
||||
contents.add(craftingPackage);
|
||||
}
|
||||
|
||||
public static void addFamiliarAttack2Payback(List<ItemStack> contents, ItemStack oldFamiliarStack) {
|
||||
Aspect aspect = RegisteredItems.itemFamiliar_old.getAspect(oldFamiliarStack);
|
||||
ItemWispEssence itemEssence = (ItemWispEssence) ConfigItems.itemWispEssence;
|
||||
ItemStack wispyEssence = null;
|
||||
if(aspect != null) {
|
||||
wispyEssence = new ItemStack(ConfigItems.itemWispEssence, 1, 0);
|
||||
itemEssence.setAspects(wispyEssence, new AspectList().add(aspect, 2));
|
||||
}
|
||||
|
||||
List<ItemStack> reward = new ArrayList<ItemStack>();
|
||||
reward.add(new ItemStack(ConfigBlocks.blockCrystal, 4, 6));
|
||||
reward.add(new ItemStack(ConfigItems.itemResource, 2, 15));
|
||||
reward.add(new ItemStack(ConfigItems.itemResource, 2, 17));
|
||||
if(wispyEssence != null) {
|
||||
ItemStack add = wispyEssence.copy();
|
||||
add.stackSize = 4;
|
||||
reward.add(add);
|
||||
}
|
||||
|
||||
int auram = 43;
|
||||
int magic = 71;
|
||||
int other = 59;
|
||||
int eldritch = 37;
|
||||
ItemStack phials = getPhialStack(Aspect.AURA, auram);
|
||||
if(phials != null) reward.add(phials);
|
||||
phials = getPhialStack(Aspect.ELDRITCH, eldritch);
|
||||
if(phials != null) reward.add(phials);
|
||||
phials = getPhialStack(Aspect.MAGIC, magic);
|
||||
if(phials != null) reward.add(phials);
|
||||
if(aspect != null) {
|
||||
phials = getPhialStack(aspect, other);
|
||||
if(phials != null) reward.add(phials);
|
||||
}
|
||||
ItemStack craftingPackage = new ItemStack(RegisteredItems.itemPackage, 1, 1);
|
||||
RegisteredItems.itemPackage.setContents(craftingPackage, reward);
|
||||
contents.add(craftingPackage);
|
||||
}
|
||||
|
||||
public static void addFamiliarAttack1Payback(List<ItemStack> contents, ItemStack oldFamiliarStack) {
|
||||
Aspect aspect = RegisteredItems.itemFamiliar_old.getAspect(oldFamiliarStack);
|
||||
ItemWispEssence itemEssence = (ItemWispEssence) ConfigItems.itemWispEssence;
|
||||
ItemStack wispyEssence = null;
|
||||
if(aspect != null) {
|
||||
wispyEssence = new ItemStack(ConfigItems.itemWispEssence, 1, 0);
|
||||
itemEssence.setAspects(wispyEssence, new AspectList().add(aspect, 2));
|
||||
}
|
||||
|
||||
List<ItemStack> reward = new ArrayList<ItemStack>();
|
||||
reward.add(new ItemStack(ConfigItems.itemResource, 2, 4));
|
||||
reward.add(new ItemStack(ConfigItems.itemResource, 2, 6));
|
||||
if(wispyEssence != null) {
|
||||
ItemStack add = wispyEssence.copy();
|
||||
add.stackSize = 4;
|
||||
reward.add(add);
|
||||
}
|
||||
int auram = 37;
|
||||
int magic = 53;
|
||||
int other = 35;
|
||||
ItemStack phials = getPhialStack(Aspect.AURA, auram);
|
||||
if(phials != null) reward.add(phials);
|
||||
phials = getPhialStack(Aspect.MAGIC, magic);
|
||||
if(phials != null) reward.add(phials);
|
||||
if(aspect != null) {
|
||||
phials = getPhialStack(aspect, other);
|
||||
if(phials != null) reward.add(phials);
|
||||
}
|
||||
ItemStack craftingPackage = new ItemStack(RegisteredItems.itemPackage, 1, 1);
|
||||
RegisteredItems.itemPackage.setContents(craftingPackage, reward);
|
||||
contents.add(craftingPackage);
|
||||
}
|
||||
|
||||
public static void addFamiliarCraftingPaybackStack(List<ItemStack> outputList, ItemStack oldFamiliar) {
|
||||
Aspect aspect = RegisteredItems.itemFamiliar_old.getAspect(oldFamiliar);
|
||||
ItemWispEssence itemEssence = (ItemWispEssence) ConfigItems.itemWispEssence;
|
||||
ItemStack wispyEssence = null;
|
||||
if(aspect != null) {
|
||||
wispyEssence = new ItemStack(ConfigItems.itemWispEssence, 1, 0);
|
||||
itemEssence.setAspects(wispyEssence, new AspectList().add(aspect, 2));
|
||||
}
|
||||
|
||||
List<ItemStack> rewardCrafting = new ArrayList<ItemStack>();
|
||||
rewardCrafting.add(new ItemStack(ConfigItems.itemResource, 2, 15));
|
||||
rewardCrafting.add(new ItemStack(ConfigBlocks.blockCrystal, 2, 6));
|
||||
rewardCrafting.add(new ItemStack(ConfigItems.itemResource, 2, 14));
|
||||
rewardCrafting.add(new ItemStack(ConfigItems.itemResource, 2, 1));
|
||||
rewardCrafting.add(new ItemStack(ConfigItems.itemAmuletRunic, 1, 0));
|
||||
if(wispyEssence != null) {
|
||||
ItemStack add = wispyEssence.copy();
|
||||
add.stackSize = 4;
|
||||
rewardCrafting.add(add);
|
||||
}
|
||||
int auram = 34;
|
||||
int magic = 51;
|
||||
int otherAspect = 46;
|
||||
ItemStack phials = getPhialStack(Aspect.AURA, auram);
|
||||
if(phials != null) rewardCrafting.add(phials);
|
||||
phials = getPhialStack(Aspect.MAGIC, magic);
|
||||
if(phials != null) rewardCrafting.add(phials);
|
||||
if(aspect != null) {
|
||||
phials = getPhialStack(aspect, otherAspect);
|
||||
if(phials != null) rewardCrafting.add(phials);
|
||||
}
|
||||
ItemStack craftingPackage = new ItemStack(RegisteredItems.itemPackage, 1, 1);
|
||||
RegisteredItems.itemPackage.setContents(craftingPackage, rewardCrafting);
|
||||
outputList.add(craftingPackage);
|
||||
}
|
||||
|
||||
private static ItemStack getPhialStack(Aspect aspect, int aspectAmount) {
|
||||
ItemEssence phial = (ItemEssence) ConfigItems.itemEssence;
|
||||
ItemStack phialStack = new ItemStack(phial, getPhialAmount(aspectAmount), 1);
|
||||
if(phialStack.stackSize > 0) {
|
||||
phial.setAspects(phialStack, new AspectList().add(aspect, 8));
|
||||
return phialStack;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static int getPhialAmount(int aspectAmount) {
|
||||
return (aspectAmount / 8) + (aspectAmount % 8 == 0 ? 0 : 1);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
package makeo.gadomancy.common.registration;
|
||||
|
||||
import makeo.gadomancy.common.items.baubles.ItemFamiliar;
|
||||
import makeo.gadomancy.common.items.baubles.ItemFamiliar_Old;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
@@ -20,24 +20,24 @@ import java.util.ArrayList;
|
||||
*/
|
||||
public class FamiliarAugmentInfusion extends InfusionRecipe {
|
||||
|
||||
private ItemFamiliar.FamiliarUpgrade upgradeToAdd;
|
||||
private ItemFamiliar_Old.FamiliarUpgrade upgradeToAdd;
|
||||
|
||||
public FamiliarAugmentInfusion(String research, int inst, AspectList aspects2, ItemStack input, ItemFamiliar.FamiliarUpgrade upgradeToAdd, ItemStack[] recipe) {
|
||||
public FamiliarAugmentInfusion(String research, int inst, AspectList aspects2, ItemStack input, ItemFamiliar_Old.FamiliarUpgrade upgradeToAdd, ItemStack[] recipe) {
|
||||
super(research, null, inst, aspects2, input, recipe);
|
||||
this.upgradeToAdd = upgradeToAdd;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(ArrayList<ItemStack> input, ItemStack central, World world, EntityPlayer player) {
|
||||
if(central == null || !(central.getItem() instanceof ItemFamiliar)) return false; //We call it "FamiliarAugment" Recipe for a reason..
|
||||
if(getRecipeInput() == null || !(getRecipeInput().getItem() instanceof ItemFamiliar)) return false; //A bit late but still working..
|
||||
if(central == null || !(central.getItem() instanceof ItemFamiliar_Old)) return false; //We call it "FamiliarAugment" Recipe for a reason..
|
||||
if(getRecipeInput() == null || !(getRecipeInput().getItem() instanceof ItemFamiliar_Old)) return false; //A bit late but still working..
|
||||
|
||||
if ((this.research.length() > 0) && (!ThaumcraftApiHelper.isResearchComplete(player.getCommandSenderName(), this.research))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ItemStack centralCopy = central.copy();
|
||||
if(!((ItemFamiliar) centralCopy.getItem()).hasUpgrade(centralCopy, getUpgradeToAdd().getNeededPreviousUpgrade())) return false;
|
||||
if(!((ItemFamiliar_Old) centralCopy.getItem()).hasUpgrade(centralCopy, getUpgradeToAdd().getNeededPreviousUpgrade())) return false;
|
||||
|
||||
ArrayList<ItemStack> ii = new ArrayList<ItemStack>();
|
||||
for (ItemStack is : input) {
|
||||
@@ -66,11 +66,11 @@ public class FamiliarAugmentInfusion extends InfusionRecipe {
|
||||
@Override
|
||||
public Object getRecipeOutput(ItemStack input) {
|
||||
ItemStack inputCopy = input.copy();
|
||||
((ItemFamiliar) input.getItem()).addUpgrade(inputCopy, getUpgradeToAdd());
|
||||
((ItemFamiliar_Old) input.getItem()).addUpgrade(inputCopy, getUpgradeToAdd());
|
||||
return inputCopy;
|
||||
}
|
||||
|
||||
public ItemFamiliar.FamiliarUpgrade getUpgradeToAdd() {
|
||||
public ItemFamiliar_Old.FamiliarUpgrade getUpgradeToAdd() {
|
||||
return upgradeToAdd;
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,7 @@ package makeo.gadomancy.common.registration;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
import makeo.gadomancy.common.familiar.FamiliarAIController;
|
||||
import makeo.gadomancy.common.familiar.FamiliarAIProcess;
|
||||
import makeo.gadomancy.common.items.baubles.ItemFamiliar;
|
||||
import makeo.gadomancy.common.items.baubles.ItemFamiliar_Old;
|
||||
import makeo.gadomancy.common.network.PacketHandler;
|
||||
import makeo.gadomancy.common.network.packets.PacketFamiliarBolt;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
@@ -47,13 +47,13 @@ public class RegisteredFamiliarAI {
|
||||
|
||||
@Override
|
||||
public boolean canRun(World world, double x, double y, double z, EntityPlayer parent, ItemStack itemStack) {
|
||||
int rangeInc = ((ItemFamiliar) itemStack.getItem()).getAttackRangeIncrease(itemStack);
|
||||
int rangeInc = ((ItemFamiliar_Old) itemStack.getItem()).getAttackRangeIncrease(itemStack);
|
||||
return getPotentialTargets(world, parent, rangeInc).size() > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick(int ticksSoFar, World world, EntityPlayer parent, ItemStack itemStack) {
|
||||
int rangeInc = ((ItemFamiliar) itemStack.getItem()).getAttackRangeIncrease(itemStack);
|
||||
int rangeInc = ((ItemFamiliar_Old) itemStack.getItem()).getAttackRangeIncrease(itemStack);
|
||||
|
||||
List<EntityLivingBase> lastTargetters = getPotentialTargets(world, parent, rangeInc);
|
||||
if(lastTargetters.size() == 0) {
|
||||
@@ -66,7 +66,7 @@ public class RegisteredFamiliarAI {
|
||||
return;
|
||||
}
|
||||
|
||||
mob.attackEntityFrom(DamageSource.magic, ((ItemFamiliar) itemStack.getItem()).getAttackStrength(itemStack));
|
||||
mob.attackEntityFrom(DamageSource.magic, ((ItemFamiliar_Old) itemStack.getItem()).getAttackStrength(itemStack));
|
||||
|
||||
world.playSoundEffect(mob.posX + 0.5, mob.posY + 0.5, mob.posZ + 0.5, "thaumcraft:zap", 0.8F, 1.0F);
|
||||
|
||||
@@ -112,7 +112,7 @@ public class RegisteredFamiliarAI {
|
||||
|
||||
@Override
|
||||
public int getCooldownDuration(ItemStack itemStack) {
|
||||
return 20 - ((ItemFamiliar) itemStack.getItem()).getAttackCooldownReduction(itemStack);
|
||||
return 20 - ((ItemFamiliar_Old) itemStack.getItem()).getAttackCooldownReduction(itemStack);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -5,7 +5,8 @@ import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import makeo.gadomancy.common.Gadomancy;
|
||||
import makeo.gadomancy.common.items.*;
|
||||
import makeo.gadomancy.common.items.baubles.ItemFamiliar;
|
||||
import makeo.gadomancy.common.items.baubles.ItemEtherealFamiliar;
|
||||
import makeo.gadomancy.common.items.baubles.ItemFamiliar_Old;
|
||||
import makeo.gadomancy.common.research.SimpleResearchItem;
|
||||
import makeo.gadomancy.common.utils.Injector;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
@@ -49,7 +50,8 @@ public class RegisteredItems {
|
||||
public static ItemTransformationFocus itemTransformationFocus;
|
||||
public static ItemGolemCoreBreak itemGolemCoreBreak;
|
||||
public static ItemExtendedNodeJar itemExtendedNodeJar;
|
||||
public static ItemFamiliar itemFamiliar;
|
||||
public static ItemFamiliar_Old itemFamiliar_old;
|
||||
//public static ItemEtherealFamiliar itemEtherealFamiliar;
|
||||
public static ItemCreativeNode itemCreativeNode;
|
||||
public static ItemArcanePackage itemPackage;
|
||||
public static ItemFakeLootbag itemFakeLootbag;
|
||||
@@ -78,7 +80,8 @@ public class RegisteredItems {
|
||||
private static void registerItems() {
|
||||
itemTransformationFocus = registerItem(new ItemTransformationFocus());
|
||||
itemGolemCoreBreak = registerItem(new ItemGolemCoreBreak());
|
||||
itemFamiliar = registerItem(new ItemFamiliar());
|
||||
itemFamiliar_old = registerItem(new ItemFamiliar_Old(), "ItemFamiliar");
|
||||
//itemEtherealFamiliar = registerItem(new ItemEtherealFamiliar());
|
||||
itemAuraCore = registerItem(new ItemAuraCore());
|
||||
|
||||
itemCreativeNode = registerItem(new ItemCreativeNode());
|
||||
|
||||
@@ -8,9 +8,9 @@ import makeo.gadomancy.common.crafting.InfusionUpgradeRecipe;
|
||||
import makeo.gadomancy.common.crafting.RecipeStickyJar;
|
||||
import makeo.gadomancy.common.data.config.ModConfig;
|
||||
import makeo.gadomancy.common.items.ItemAuraCore;
|
||||
import makeo.gadomancy.common.items.baubles.ItemFamiliar;
|
||||
import makeo.gadomancy.common.items.baubles.ItemFamiliar_Old;
|
||||
import makeo.gadomancy.common.research.SimpleResearchItem;
|
||||
import makeo.gadomancy.common.utils.NBTHelper;
|
||||
import makeo.gadomancy.common.utils.FamiliarUndoRecipe;
|
||||
import makeo.gadomancy.common.utils.RandomizedAspectList;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
@@ -233,6 +233,8 @@ public class RegisteredRecipes {
|
||||
ThaumcraftApi.getCraftingRecipes().add(new InfusionDisguiseArmor());
|
||||
|
||||
recipeRevealer = ThaumcraftApi.addInfusionEnchantmentRecipe("", RegisteredEnchantments.revealer, 4, new AspectList().add(Aspect.SENSES, 16).add(Aspect.MAGIC, 8), new ItemStack[]{new ItemStack(ConfigItems.itemGoggles), new ItemStack(ConfigItems.itemResource, 1, 14), new ItemStack(ConfigItems.itemResource, 1, 14)});
|
||||
|
||||
//CraftingManager.getInstance().getRecipeList().add(new FamiliarUndoRecipe());
|
||||
}
|
||||
|
||||
private static List[] createAuraCoreRecipes() {
|
||||
@@ -268,7 +270,7 @@ public class RegisteredRecipes {
|
||||
private static InfusionRecipe[][] createFamiliarAugmentationRecipes() {
|
||||
InfusionRecipe[][] recipes = new InfusionRecipe[5][];
|
||||
ItemWispEssence wispEssence = (ItemWispEssence) ConfigItems.itemWispEssence;
|
||||
ItemFamiliar familiar = RegisteredItems.itemFamiliar;
|
||||
ItemFamiliar_Old familiar = RegisteredItems.itemFamiliar_old;
|
||||
|
||||
List<Aspect> aspects = new ArrayList<Aspect>(Aspect.aspects.values());
|
||||
InfusionRecipe[] upgradeArrayStr1 = new InfusionRecipe[aspects.size()];
|
||||
@@ -282,47 +284,47 @@ public class RegisteredRecipes {
|
||||
ItemStack wispyEssence = new ItemStack(wispEssence, 1, 0);
|
||||
wispEssence.setAspects(wispyEssence, new AspectList().add(aspect, 2));
|
||||
|
||||
ItemStack familiarIn = new ItemStack(RegisteredItems.itemFamiliar);
|
||||
ItemStack familiarIn = new ItemStack(RegisteredItems.itemFamiliar_old);
|
||||
familiar.setAspect(familiarIn, aspect);
|
||||
|
||||
FamiliarAugmentInfusion infusion = new FamiliarAugmentInfusion(Gadomancy.MODID.toUpperCase() + ".FAM_ATTACK_1", 4, new AspectList().add(Aspect.AURA, 37).add(Aspect.MAGIC, 53).add(aspect, 35), familiarIn, ItemFamiliar.FamiliarUpgrade.ATTACK_1,
|
||||
FamiliarAugmentInfusion infusion = new FamiliarAugmentInfusion(Gadomancy.MODID.toUpperCase() + ".FAM_ATTACK_1", 4, new AspectList().add(Aspect.AURA, 37).add(Aspect.MAGIC, 53).add(aspect, 35), familiarIn, ItemFamiliar_Old.FamiliarUpgrade.ATTACK_1,
|
||||
new ItemStack[]{ wispyEssence, new ItemStack(ConfigItems.itemResource, 1, 6), wispyEssence, new ItemStack(ConfigItems.itemResource, 1, 4), wispyEssence, new ItemStack(ConfigItems.itemResource, 1, 6), wispyEssence, new ItemStack(ConfigItems.itemResource, 1, 4)});
|
||||
ThaumcraftApi.getCraftingRecipes().add(infusion);
|
||||
upgradeArrayStr1[i] = infusion;
|
||||
|
||||
familiarIn = new ItemStack(RegisteredItems.itemFamiliar);
|
||||
familiarIn = new ItemStack(RegisteredItems.itemFamiliar_old);
|
||||
familiar.setAspect(familiarIn, aspect);
|
||||
familiar.addUpgrade(familiarIn, ItemFamiliar.FamiliarUpgrade.ATTACK_1);
|
||||
familiar.addUpgrade(familiarIn, ItemFamiliar_Old.FamiliarUpgrade.ATTACK_1);
|
||||
|
||||
infusion = new FamiliarAugmentInfusion(Gadomancy.MODID.toUpperCase() + ".FAM_ATTACK_2", 6, new AspectList().add(Aspect.AURA, 43).add(Aspect.MAGIC, 71).add(Aspect.ELDRITCH, 37).add(aspect, 59), familiarIn, ItemFamiliar.FamiliarUpgrade.ATTACK_2,
|
||||
infusion = new FamiliarAugmentInfusion(Gadomancy.MODID.toUpperCase() + ".FAM_ATTACK_2", 6, new AspectList().add(Aspect.AURA, 43).add(Aspect.MAGIC, 71).add(Aspect.ELDRITCH, 37).add(aspect, 59), familiarIn, ItemFamiliar_Old.FamiliarUpgrade.ATTACK_2,
|
||||
new ItemStack[] { wispyEssence, new ItemStack(ConfigBlocks.blockCrystal, 1, 6), new ItemStack(ConfigItems.itemResource, 1, 15), wispyEssence, new ItemStack(ConfigBlocks.blockCrystal, 1, 6), new ItemStack(ConfigItems.itemResource, 1, 17), wispyEssence, new ItemStack(ConfigBlocks.blockCrystal, 1, 6), new ItemStack(ConfigItems.itemResource, 1, 15), wispyEssence, new ItemStack(ConfigBlocks.blockCrystal, 1, 6), new ItemStack(ConfigItems.itemResource, 1, 17)});
|
||||
ThaumcraftApi.getCraftingRecipes().add(infusion);
|
||||
upgradeArrayStr2[i] = infusion;
|
||||
|
||||
|
||||
familiarIn = new ItemStack(RegisteredItems.itemFamiliar);
|
||||
familiarIn = new ItemStack(RegisteredItems.itemFamiliar_old);
|
||||
familiar.setAspect(familiarIn, aspect);
|
||||
familiar.addUpgrade(familiarIn, ItemFamiliar.FamiliarUpgrade.ATTACK_1);
|
||||
familiar.addUpgrade(familiarIn, ItemFamiliar.FamiliarUpgrade.ATTACK_2);
|
||||
familiar.addUpgrade(familiarIn, ItemFamiliar_Old.FamiliarUpgrade.ATTACK_1);
|
||||
familiar.addUpgrade(familiarIn, ItemFamiliar_Old.FamiliarUpgrade.ATTACK_2);
|
||||
|
||||
infusion = new FamiliarAugmentInfusion(Gadomancy.MODID.toUpperCase() + ".FAM_ATTACK_3", 10, new AspectList().add(Aspect.AURA, 77).add(Aspect.MAGIC, 93).add(Aspect.WEAPON, 49).add(aspect, 104), familiarIn, ItemFamiliar.FamiliarUpgrade.ATTACK_3,
|
||||
infusion = new FamiliarAugmentInfusion(Gadomancy.MODID.toUpperCase() + ".FAM_ATTACK_3", 10, new AspectList().add(Aspect.AURA, 77).add(Aspect.MAGIC, 93).add(Aspect.WEAPON, 49).add(aspect, 104), familiarIn, ItemFamiliar_Old.FamiliarUpgrade.ATTACK_3,
|
||||
new ItemStack[] { new ItemStack(ConfigItems.itemEldritchObject, 1, 3), wispyEssence, new ItemStack(ConfigBlocks.blockCustomPlant, 1, 4), wispyEssence, new ItemStack(Items.nether_star, 1, 0), wispyEssence, new ItemStack(ConfigBlocks.blockCustomPlant, 1, 4), wispyEssence });
|
||||
ThaumcraftApi.getCraftingRecipes().add(infusion);
|
||||
upgradeArrayStr3[i] = infusion;
|
||||
|
||||
familiarIn = new ItemStack(RegisteredItems.itemFamiliar);
|
||||
familiarIn = new ItemStack(RegisteredItems.itemFamiliar_old);
|
||||
familiar.setAspect(familiarIn, aspect);
|
||||
|
||||
infusion = new FamiliarAugmentInfusion(Gadomancy.MODID.toUpperCase() + ".FAM_RANGE_1", 8, new AspectList().add(Aspect.AURA, 44).add(Aspect.MAGIC, 51).add(aspect, 37), familiarIn, ItemFamiliar.FamiliarUpgrade.RANGE_1,
|
||||
infusion = new FamiliarAugmentInfusion(Gadomancy.MODID.toUpperCase() + ".FAM_RANGE_1", 8, new AspectList().add(Aspect.AURA, 44).add(Aspect.MAGIC, 51).add(aspect, 37), familiarIn, ItemFamiliar_Old.FamiliarUpgrade.RANGE_1,
|
||||
new ItemStack[] { new ItemStack(ConfigItems.itemResource, 1, 0), wispyEssence, new ItemStack(ConfigItems.itemResource, 1, 17), wispyEssence, new ItemStack(ConfigItems.itemResource, 1, 0), wispyEssence, new ItemStack(ConfigItems.itemResource, 1, 17), wispyEssence });
|
||||
ThaumcraftApi.getCraftingRecipes().add(infusion);
|
||||
upgradeArrayRange1[i] = infusion;
|
||||
|
||||
|
||||
familiarIn = new ItemStack(RegisteredItems.itemFamiliar);
|
||||
familiarIn = new ItemStack(RegisteredItems.itemFamiliar_old);
|
||||
familiar.setAspect(familiarIn, aspect);
|
||||
|
||||
infusion = new FamiliarAugmentInfusion(Gadomancy.MODID.toUpperCase() + ".FAM_COOLDOWN_1", 10, new AspectList().add(Aspect.AURA, 79).add(Aspect.MAGIC, 101).add(Aspect.EXCHANGE, 54).add(aspect, 81), familiarIn, ItemFamiliar.FamiliarUpgrade.COOLDOWN_1,
|
||||
infusion = new FamiliarAugmentInfusion(Gadomancy.MODID.toUpperCase() + ".FAM_COOLDOWN_1", 10, new AspectList().add(Aspect.AURA, 79).add(Aspect.MAGIC, 101).add(Aspect.EXCHANGE, 54).add(aspect, 81), familiarIn, ItemFamiliar_Old.FamiliarUpgrade.COOLDOWN_1,
|
||||
new ItemStack[] { new ItemStack(ConfigItems.itemEldritchObject, 1, 3), new ItemStack(ConfigItems.itemFocusPrimal, 1, 0), wispyEssence, new ItemStack(ConfigItems.itemBathSalts, 1, 0), new ItemStack(ConfigItems.itemFocusPrimal, 1, 0), wispyEssence, new ItemStack(ConfigItems.itemBathSalts, 1, 0) });
|
||||
ThaumcraftApi.getCraftingRecipes().add(infusion);
|
||||
upgradeArrayCd1[i] = infusion;
|
||||
@@ -340,7 +342,6 @@ public class RegisteredRecipes {
|
||||
public static InfusionRecipe[] createFamilarRecipes() {
|
||||
List<Aspect> aspects = new ArrayList<Aspect>(Aspect.aspects.values());
|
||||
InfusionRecipe[] recipes = new InfusionRecipe[aspects.size()];
|
||||
ItemFamiliar familiar = (ItemFamiliar) RegisteredItems.itemFamiliar;
|
||||
|
||||
ItemWispEssence itemEssence = (ItemWispEssence) ConfigItems.itemWispEssence;
|
||||
for (int i = 0; i < aspects.size(); i++) {
|
||||
@@ -349,8 +350,8 @@ public class RegisteredRecipes {
|
||||
ItemStack wispyEssence = new ItemStack(itemEssence, 1, 0);
|
||||
itemEssence.setAspects(wispyEssence, new AspectList().add(aspect, 2));
|
||||
|
||||
ItemStack result = new ItemStack(RegisteredItems.itemFamiliar);
|
||||
familiar.setAspect(result, aspect);
|
||||
ItemStack result = new ItemStack(RegisteredItems.itemFamiliar_old);
|
||||
RegisteredItems.itemFamiliar_old.setAspect(result, aspect);
|
||||
|
||||
recipes[i] = ThaumcraftApi.addInfusionCraftingRecipe(Gadomancy.MODID.toUpperCase() + ".FAMILIAR", result, 4, new AspectList().add(aspect, 46).add(Aspect.AURA, 34).add(Aspect.MAGIC, 51), new ItemStack(ConfigItems.itemAmuletRunic, 1, 0), new ItemStack[] { wispyEssence, new ItemStack(ConfigItems.itemResource, 1, 15), new ItemStack(ConfigBlocks.blockCrystal, 1, 6) , wispyEssence, new ItemStack(ConfigItems.itemResource, 1, 14), new ItemStack(ConfigItems.itemResource, 1, 1), wispyEssence, new ItemStack(ConfigItems.itemResource, 1, 15), new ItemStack(ConfigBlocks.blockCrystal, 1, 6), wispyEssence, new ItemStack(ConfigItems.itemResource, 1, 14), new ItemStack(ConfigItems.itemResource, 1, 1) });
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ import net.minecraft.util.ResourceLocation;
|
||||
import thaumcraft.api.ThaumcraftApi;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
import thaumcraft.api.crafting.IArcaneRecipe;
|
||||
import thaumcraft.api.research.ResearchCategories;
|
||||
import thaumcraft.api.research.ResearchItem;
|
||||
import thaumcraft.api.research.ResearchPage;
|
||||
@@ -182,7 +181,7 @@ public class RegisteredResearches {
|
||||
ResearchItem nitorResearch = PseudoResearchItem.create("NITOR", 2, -4).registerResearchItem();
|
||||
ResearchItem runicResearch = PseudoResearchItem.create("RUNICARMOR", 4, -4).registerResearchItem();
|
||||
|
||||
ItemStack familiarResearchStack = new ItemStack(RegisteredItems.itemFamiliar, 1, 0);
|
||||
ItemStack familiarResearchStack = new ItemStack(RegisteredItems.itemFamiliar_old, 1, 0);
|
||||
NBTHelper.getData(familiarResearchStack).setString("aspect", Aspect.MAGIC.getTag());
|
||||
|
||||
researchFamiliarBasic = new ResearchItem(Gadomancy.MODID.toUpperCase() + ".FAMILIAR", Gadomancy.MODID,
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
package makeo.gadomancy.common.utils;
|
||||
|
||||
import makeo.gadomancy.common.items.baubles.ItemFamiliar_Old;
|
||||
import makeo.gadomancy.common.registration.RegisteredItems;
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.ShapelessRecipes;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* This class is part of the Gadomancy Mod
|
||||
* Gadomancy is Open Source and distributed under the
|
||||
* GNU LESSER GENERAL PUBLIC LICENSE
|
||||
* for more read the LICENSE file
|
||||
* <p/>
|
||||
* Created by HellFirePvP @ 29.12.2015 15:29
|
||||
*/
|
||||
public class FamiliarUndoRecipe extends ShapelessRecipes {
|
||||
|
||||
public FamiliarUndoRecipe() {
|
||||
super(new ItemStack(RegisteredItems.itemPackage, 1, 2).setStackDisplayName(EnumChatFormatting.GOLD + "Used Familiar Items"), new ArrayList() {
|
||||
{
|
||||
add(new ItemStack(RegisteredItems.itemFamiliar_old));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(InventoryCrafting inv, World world) {
|
||||
|
||||
boolean foundOldFamiliar = false;
|
||||
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
for (int j = 0; j < 3; ++j) {
|
||||
ItemStack itemstack = inv.getStackInRowAndColumn(j, i);
|
||||
|
||||
if(itemstack != null && itemstack.getItem() != null && itemstack.getItem() instanceof ItemFamiliar_Old) {
|
||||
if(foundOldFamiliar) return false;
|
||||
foundOldFamiliar = true;
|
||||
} else if(itemstack != null && itemstack.getItem() != null) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return foundOldFamiliar;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getCraftingResult(InventoryCrafting inv) {
|
||||
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
for (int j = 0; j < 3; ++j) {
|
||||
ItemStack itemstack = inv.getStackInRowAndColumn(j, i);
|
||||
if(itemstack != null && itemstack.getItem() != null && itemstack.getItem() instanceof ItemFamiliar_Old) {
|
||||
return ItemFamiliar_Old.getPaybackPackage(itemstack);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -28,14 +28,21 @@ public final class MiscUtils {
|
||||
|
||||
private MiscUtils() {}
|
||||
|
||||
public static String getNumberSuffix(int number) {
|
||||
int digit = number % 10;
|
||||
switch (digit) {
|
||||
case 1: return "st";
|
||||
case 2: return "nd";
|
||||
case 3: return "rd";
|
||||
private static final int[] R_NUMBERS = {1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1};
|
||||
private static final String[] R_CHARS = {"M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV", "I"};
|
||||
|
||||
public static String toRomanNumeral(int number) {
|
||||
if(number < 0 || number > 3999) {
|
||||
return String.valueOf(number);
|
||||
}
|
||||
return "th";
|
||||
String roman = "";
|
||||
for (int i = 0; i < R_NUMBERS.length; i++) {
|
||||
while (number >= R_NUMBERS[i]) {
|
||||
roman += R_CHARS[i];
|
||||
number -= R_NUMBERS[i];
|
||||
}
|
||||
}
|
||||
return roman;
|
||||
}
|
||||
|
||||
public static int ticksForDays(int days) {
|
||||
|
||||
Reference in new issue
Block a user