mirror of
https://github.com/GTNewHorizons/Gadomancy.git
synced 2026-11-18 19:29:28 +00:00
-Removed visibility of unknown sticky jar types
This commit is contained in:
1 parent
1b342aa1b3
commit
5cb59e46bb
7 files changed
+115
-40
No files matched your search
@@ -0,0 +1,50 @@
|
||||
package makeo.gadomancy.common.crafting;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import makeo.gadomancy.common.registration.RegisteredItems;
|
||||
import makeo.gadomancy.common.utils.NBTHelper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
import thaumcraft.api.crafting.ShapedArcaneRecipe;
|
||||
|
||||
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 makeo @ 19.12.2015 23:08
|
||||
*/
|
||||
public class RecipeVisualStickyJar extends ShapedArcaneRecipe {
|
||||
public RecipeVisualStickyJar() {
|
||||
super("Mirror mirror on the wall, who is the fairest one of all?", new ItemStack(Blocks.dirt), new AspectList().add(Aspect.WATER, 10).add(Aspect.EARTH, 10), " ", " A ", " ", 'A', new ItemStack(Items.diamond));
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public AspectList getAspects() {
|
||||
updateVisualStickyJarRecipes();
|
||||
return super.getAspects();
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private void updateVisualStickyJarRecipes() {
|
||||
List<ItemStack> stacks = RegisteredItems.getStickyJarStacks(Minecraft.getMinecraft().thePlayer);
|
||||
if(stacks.size() > 0) {
|
||||
ItemStack stack = stacks.get((int)(System.currentTimeMillis() / 1000L % stacks.size()));
|
||||
output = stack.copy();
|
||||
NBTHelper.getData(output).setBoolean("isStickyJar", true);
|
||||
|
||||
input = new Object[9];
|
||||
input[4] = stack;
|
||||
input[7] = new ItemStack(Items.slime_ball, 1, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -25,7 +25,7 @@ public class IntegrationThaumicExploration extends IntegrationMod {
|
||||
Block trashJar = Block.getBlockFromName("ThaumicExploration:trashJar");
|
||||
if(trashJar != null) {
|
||||
RegisteredBlocks.registerStickyJar(trashJar, 0, false, true);
|
||||
RegisteredItems.registerStickyJar(Item.getItemFromBlock(trashJar), 0, new ItemStack(trashJar));
|
||||
RegisteredItems.registerStickyJar(Item.getItemFromBlock(trashJar), 0, new ItemStack(trashJar), "TRASHJAR");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,8 +6,10 @@ 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.research.SimpleResearchItem;
|
||||
import makeo.gadomancy.common.utils.Injector;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -20,6 +22,7 @@ import thaumcraft.common.Thaumcraft;
|
||||
import thaumcraft.common.config.ConfigBlocks;
|
||||
import thaumcraft.common.config.ConfigItems;
|
||||
import thaumcraft.common.lib.crafting.ThaumcraftCraftingManager;
|
||||
import thaumcraft.common.lib.research.ResearchManager;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -147,20 +150,25 @@ public class RegisteredItems {
|
||||
registerStickyJar(ConfigItems.itemJarFilled, 3);
|
||||
|
||||
Item itemBlockJar = Item.getItemFromBlock(ConfigBlocks.blockJar);
|
||||
registerStickyJar(itemBlockJar, 0, new ItemStack(itemBlockJar, 1, 0));
|
||||
registerStickyJar(itemBlockJar, 3, new ItemStack(itemBlockJar, 1, 3));
|
||||
registerStickyJar(itemBlockJar, 0, new ItemStack(itemBlockJar, 1, 0), "JARLABEL");
|
||||
registerStickyJar(itemBlockJar, 3, new ItemStack(itemBlockJar, 1, 3), "JARVOID");
|
||||
|
||||
Item itemRemoteJar = Item.getItemFromBlock(RegisteredBlocks.blockRemoteJar);
|
||||
registerStickyJar(itemRemoteJar, 0, new ItemStack(itemRemoteJar));
|
||||
registerStickyJar(itemRemoteJar, 0, new ItemStack(itemRemoteJar), SimpleResearchItem.getFullName("REMOTEJAR"));
|
||||
}
|
||||
|
||||
private static List<StickyJarItemInfo> stickyJarItems = new ArrayList<StickyJarItemInfo>();
|
||||
|
||||
public static void registerStickyJar(Item item, int damage, ItemStack recipeStack) {
|
||||
registerStickyJar(item, damage, recipeStack, null);
|
||||
}
|
||||
|
||||
public static void registerStickyJar(Item item, int damage, ItemStack recipeStack, String research) {
|
||||
StickyJarItemInfo info = new StickyJarItemInfo();
|
||||
info.item = item;
|
||||
info.damage = damage;
|
||||
info.recipeStack = recipeStack;
|
||||
info.research = research;
|
||||
stickyJarItems.add(info);
|
||||
}
|
||||
|
||||
@@ -186,9 +194,14 @@ public class RegisteredItems {
|
||||
}
|
||||
|
||||
public static List<ItemStack> getStickyJarStacks() {
|
||||
return getStickyJarStacks(null);
|
||||
}
|
||||
|
||||
public static List<ItemStack> getStickyJarStacks(EntityPlayer player) {
|
||||
List<ItemStack> stacks = new ArrayList<ItemStack>();
|
||||
for(StickyJarItemInfo info : stickyJarItems) {
|
||||
if(info.recipeStack != null) {
|
||||
if(info.recipeStack != null && (player == null || info.research == null
|
||||
|| ResearchManager.isResearchComplete(player.getCommandSenderName(), info.research))) {
|
||||
stacks.add(info.recipeStack);
|
||||
}
|
||||
}
|
||||
@@ -199,5 +212,6 @@ public class RegisteredItems {
|
||||
public Item item;
|
||||
public int damage;
|
||||
public ItemStack recipeStack;
|
||||
public String research = null;
|
||||
}
|
||||
}
|
||||
@@ -322,32 +322,6 @@ public class RegisteredRecipes {
|
||||
return recipes;
|
||||
}
|
||||
|
||||
private static IArcaneRecipe[] stickyJarRecipes = null;
|
||||
|
||||
public static IArcaneRecipe[] getVisualStickyJarRecipes() {
|
||||
if(stickyJarRecipes == null) {
|
||||
List<ItemStack> stacks = RegisteredItems.getStickyJarStacks();
|
||||
stickyJarRecipes = new IArcaneRecipe[stacks.size()];
|
||||
|
||||
ItemStack slime = new ItemStack(Items.slime_ball, 1, 0);
|
||||
for(int i = 0; i < stacks.size(); i++) {
|
||||
ItemStack stack = stacks.get(i);
|
||||
|
||||
ItemStack output = stack.copy();
|
||||
NBTHelper.getData(output).setBoolean("isStickyJar", true);
|
||||
|
||||
stickyJarRecipes[i] = new ShapedArcaneRecipe(SimpleResearchItem.getFullName("STICKYJAR"), output,
|
||||
new AspectList().add(Aspect.WATER, 10).add(Aspect.EARTH, 10),
|
||||
" ",
|
||||
" A ",
|
||||
" B ",
|
||||
'A', stack, 'B', slime);
|
||||
}
|
||||
}
|
||||
|
||||
return stickyJarRecipes;
|
||||
}
|
||||
|
||||
public static InfusionRecipe[] createFamilarRecipes() {
|
||||
List<Aspect> aspects = new ArrayList<Aspect>(Aspect.aspects.values());
|
||||
InfusionRecipe[] recipes = new InfusionRecipe[aspects.size()];
|
||||
|
||||
@@ -2,12 +2,10 @@ package makeo.gadomancy.common.registration;
|
||||
|
||||
import makeo.gadomancy.common.Gadomancy;
|
||||
import makeo.gadomancy.common.aura.AuraResearchManager;
|
||||
import makeo.gadomancy.common.crafting.RecipeVisualStickyJar;
|
||||
import makeo.gadomancy.common.data.config.ModConfig;
|
||||
import makeo.gadomancy.common.items.ItemAuraCore;
|
||||
import makeo.gadomancy.common.research.AlternatingResearchItem;
|
||||
import makeo.gadomancy.common.research.MultiResearchPage;
|
||||
import makeo.gadomancy.common.research.PseudoResearchItem;
|
||||
import makeo.gadomancy.common.research.SimpleResearchItem;
|
||||
import makeo.gadomancy.common.research.*;
|
||||
import makeo.gadomancy.common.utils.NBTHelper;
|
||||
import makeo.gadomancy.common.utils.SimpleResourceLocation;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -15,6 +13,7 @@ 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;
|
||||
@@ -316,11 +315,13 @@ public class RegisteredResearches {
|
||||
researchBlockProtector.setParents(researchJar.key);
|
||||
}
|
||||
|
||||
researchStickyJar = new AlternatingResearchItem("STICKYJAR", -5, -5, 2,
|
||||
new AspectList().add(Aspect.SLIME, 8).add(Aspect.EARTH, 8),
|
||||
RegisteredItems.getStickyJarStacks())
|
||||
RecipeVisualStickyJar visualRecipe = new RecipeVisualStickyJar();
|
||||
ResearchPage page = new ResearchPage(visualRecipe);
|
||||
|
||||
researchStickyJar = new StickyJarResearchItem("STICKYJAR", -5, -5, 2,
|
||||
new AspectList().add(Aspect.SLIME, 8).add(Aspect.EARTH, 8))
|
||||
.setParents(researchJar.key).setConcealed()
|
||||
.setPages(new ResearchPage("gadomancy.research_page.STICKYJAR.1"), new ResearchPage(RegisteredRecipes.getVisualStickyJarRecipes())).registerResearchItem();
|
||||
.setPages(new ResearchPage("gadomancy.research_page.STICKYJAR.1"), page).registerResearchItem();
|
||||
|
||||
String[] parents = researchEssentiaMirror == null ? new String[] { researchJar.key } : new String[] { researchJar.key, researchEssentiaMirror.key };
|
||||
researchRemoteJar = new SimpleResearchItem("REMOTEJAR", -4, -3, 3,
|
||||
|
||||
@@ -21,7 +21,7 @@ public class AlternatingResearchItem extends SimpleResearchItem {
|
||||
private static final Field ICON_FIELD = Injector.getField("icon_item", ResearchItem.class);
|
||||
|
||||
private final Injector injector = new Injector(this, ResearchItem.class);
|
||||
private List<ItemStack> itemIcons = null;
|
||||
protected List<ItemStack> itemIcons = null;
|
||||
|
||||
public AlternatingResearchItem(String key, int col, int row, int complex, AspectList tags, List<ItemStack> icons) {
|
||||
super(key, col, row, complex, icons.get(0), tags);
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
package makeo.gadomancy.common.research;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import makeo.gadomancy.common.Gadomancy;
|
||||
import makeo.gadomancy.common.registration.RegisteredItems;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
import thaumcraft.common.config.ConfigBlocks;
|
||||
|
||||
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 makeo @ 20.12.2015 01:01
|
||||
*/
|
||||
public class StickyJarResearchItem extends AlternatingResearchItem {
|
||||
public StickyJarResearchItem(String key, int col, int row, int complex, AspectList tags) {
|
||||
super(key, col, row, complex, tags, new ItemStack(ConfigBlocks.blockJar));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSpecial() {
|
||||
if(Gadomancy.proxy.getSide() == Side.CLIENT) {
|
||||
List<ItemStack> items = RegisteredItems.getStickyJarStacks(Minecraft.getMinecraft().thePlayer);
|
||||
if(items.size() > 0) {
|
||||
itemIcons = items;
|
||||
}
|
||||
}
|
||||
return super.isSpecial();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user