- Book of Knowledge <init> and finished.

This commit is contained in:
HellFirePvP committed 2016-04-19 20:03:12 +02:00
1 parent 26a1f3b07b
commit 7f40306d8b
21 files changed
+1048 -53

No files matched your search

@@ -22,6 +22,7 @@ import makeo.gadomancy.client.renderers.item.ItemJarExtendedNodeRenderer;
import makeo.gadomancy.client.renderers.item.ItemRenderFamiliar;
import makeo.gadomancy.client.renderers.item.ItemRenderRemoteJar;
import makeo.gadomancy.client.renderers.item.ItemRenderStoneMachine;
import makeo.gadomancy.client.renderers.item.ItemRenderTEKnowledgeBook;
import makeo.gadomancy.client.renderers.item.ItemRenderTileEntity;
import makeo.gadomancy.client.renderers.item.ItemRenderTileEntityMulti;
import makeo.gadomancy.client.renderers.tile.*;
@@ -118,15 +119,20 @@ public class ClientProxy extends CommonProxy {
RenderTileArcanePackager renderTileArcanePackager = new RenderTileArcanePackager();
ClientRegistry.bindTileEntitySpecialRenderer(TileArcanePackager.class, renderTileArcanePackager);
RenderTileKnowledgeBook bookRender = new RenderTileKnowledgeBook();
ClientRegistry.bindTileEntitySpecialRenderer(TileKnowledgeBook.class, bookRender);
//Items
TileArcaneDropper fakeTile = new TileArcaneDropper();
fakeTile.blockMetadata = 8 | ForgeDirection.SOUTH.ordinal();
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(RegisteredBlocks.blockArcaneDropper), new ItemRenderTileEntity(renderTileArcaneDropper, fakeTile));
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(RegisteredBlocks.blockArcaneDropper), new ItemRenderTileEntity<TileArcaneDropper>(renderTileArcaneDropper, fakeTile));
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(RegisteredBlocks.blockInfusionClaw), new ItemRenderTileEntity(renderTileInfusionClaw, new TileInfusionClaw()));
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(RegisteredBlocks.blockInfusionClaw), new ItemRenderTileEntity<TileInfusionClaw>(renderTileInfusionClaw, new TileInfusionClaw()));
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ConfigBlocks.blockAiry), new ItemExNodeRenderer());
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(RegisteredBlocks.blockKnowledgeBook), new ItemRenderTEKnowledgeBook(bookRender));
ItemRenderTileEntityMulti multi = new ItemRenderTileEntityMulti(new ItemRenderTileEntityMulti.RenderSet(renderTileAuraPylon, new TileAuraPylon(), 0),
new ItemRenderTileEntityMulti.RenderSet(renderTileAuraPylon, new TileAuraPylonTop(), 1));
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(RegisteredBlocks.blockAuraPylon), multi);
@@ -0,0 +1,40 @@
package makeo.gadomancy.client.renderers.item;
import makeo.gadomancy.client.renderers.tile.RenderTileKnowledgeBook;
import makeo.gadomancy.common.blocks.tiles.TileKnowledgeBook;
import net.minecraft.item.ItemStack;
import org.lwjgl.opengl.GL11;
/**
* HellFirePvP@Admin
* Date: 19.04.2016 / 16:02
* on Gadomancy
* ItemRenderTEKnowledgeBook
*/
public class ItemRenderTEKnowledgeBook extends ItemRenderTileEntity<TileKnowledgeBook> {
public ItemRenderTEKnowledgeBook(RenderTileKnowledgeBook bookRender) {
super(bookRender, new TileKnowledgeBook());
}
@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
GL11.glPushMatrix();
if(type.equals(ItemRenderType.INVENTORY)) {
GL11.glScalef(1.4F, 1.4F, 1.4F);
} else if(type.equals(ItemRenderType.ENTITY)) {
GL11.glScalef(2F, 2F, 2F);
} else if(type.equals(ItemRenderType.EQUIPPED)) {
GL11.glRotatef(15F, 1, 0, 0);
GL11.glRotatef(-50F, 0, 1, 0);
GL11.glTranslatef(-0.4F, 0F, -1.25F);
GL11.glScalef(1.8F, 1.8F, 1.8F);
} else if(type.equals(ItemRenderType.EQUIPPED_FIRST_PERSON)) {
GL11.glTranslatef(-0.2F, 0.4F, 0);
GL11.glRotatef(30F, 0, 1, 0);
GL11.glRotatef(55F, 0, 0, 1);
}
super.renderItem(type, item, data);
GL11.glPopMatrix();
}
}
@@ -0,0 +1,80 @@
package makeo.gadomancy.client.renderers.tile;
import makeo.gadomancy.common.blocks.tiles.TileKnowledgeBook;
import net.minecraft.client.model.ModelBook;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
/**
* HellFirePvP@Admin
* Date: 19.04.2016 / 14:57
* on Gadomancy
* RenderTileKnowledgeBook
*/
public class RenderTileKnowledgeBook extends TileEntitySpecialRenderer {
private static final ResourceLocation bookTexture = new ResourceLocation("minecraft", "textures/entity/enchanting_table_book.png");
private static final ModelBook modelBook = new ModelBook();
@Override
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float partialTicks) {
if(te == null || !(te instanceof TileKnowledgeBook)) return;
renderFloatingBook((TileKnowledgeBook) te, x, y, z, partialTicks);
}
private void renderFloatingBook(TileKnowledgeBook te, double x, double y, double z, float partialTicks) {
TileKnowledgeBook.FloatingBookAttributes attributes = te.getBookAttributes();
GL11.glPushMatrix();
GL11.glTranslatef((float)x + 0.5F, (float)y + 0.2F, (float)z + 0.5F);
float f1 = (float)attributes.field_145926_a + partialTicks;
GL11.glTranslatef(0.0F, 0.1F + MathHelper.sin(f1 * 0.1F) * 0.03F, 0.0F);
float f2;
for (f2 = attributes.field_145928_o - attributes.field_145925_p; f2 >= (float)Math.PI; f2 -= ((float)Math.PI * 2F)) {}
while (f2 < -(float)Math.PI)
{
f2 += ((float)Math.PI * 2F);
}
float f3 = attributes.field_145925_p + f2 * partialTicks;
GL11.glRotatef(-f3 * 180.0F / (float)Math.PI, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(80.0F, 0.0F, 0.0F, 1.0F);
this.bindTexture(bookTexture);
float f4 = attributes.field_145931_j + (attributes.field_145933_i - attributes.field_145931_j) * partialTicks + 0.25F;
float f5 = attributes.field_145931_j + (attributes.field_145933_i - attributes.field_145931_j) * partialTicks + 0.75F;
f4 = (f4 - (float)MathHelper.truncateDoubleToInt((double)f4)) * 1.6F - 0.3F;
f5 = (f5 - (float)MathHelper.truncateDoubleToInt((double)f5)) * 1.6F - 0.3F;
if (f4 < 0.0F)
{
f4 = 0.0F;
}
if (f5 < 0.0F)
{
f5 = 0.0F;
}
if (f4 > 1.0F)
{
f4 = 1.0F;
}
if (f5 > 1.0F)
{
f5 = 1.0F;
}
//float f6 = attributes.field_145927_n + (attributes.field_145930_m - attributes.field_145927_n) * partialTicks; We don't want it to close..
GL11.glEnable(GL11.GL_CULL_FACE);
modelBook.render(null, 45F, f4, f5, 0.9F, 0.0F, 0.0625F);
GL11.glPopMatrix();
}
}
@@ -20,6 +20,7 @@ import java.util.Random;
* Created by HellFirePvP @ 30.10.2015 20:08
*/
public class UtilsFX {
private static final Color[] RUNE_COLORS_RED = new Color[] { new Color(0xB60707), new Color(0xEE3782), new Color(0xF37B20), new Color(0xFF6722), new Color(0xFF6D30), new Color(0xFF0000) };
private static final Color[] RUNE_COLORS_GREEN = new Color[] { new Color(0x015629), new Color(0x0E9C00), new Color(0x010000), new Color(0x01FF00), new Color(0x014C3E)};
private static final Color[] RUNE_COLORS_BLUE = new Color[] { new Color(0x060956), new Color(0x012578), new Color(0x0C1556), new Color(0x0100FF), new Color(0x01018C)};
@@ -17,6 +17,7 @@ import thaumcraft.common.config.ConfigBlocks;
* Created by makeo @ 06.11.2015 23:23
*/
public class BlockAdditionalEldritchPortal extends BlockEldritchPortal {
public BlockAdditionalEldritchPortal() {
setCreativeTab(RegisteredItems.creativeTab);
}
@@ -32,7 +33,5 @@ public class BlockAdditionalEldritchPortal extends BlockEldritchPortal {
}
@Override
public void onNeighborBlockChange(World world, int x, int y, int z, Block block) {
}
public void onNeighborBlockChange(World world, int x, int y, int z, Block block) {}
}
@@ -0,0 +1,121 @@
package makeo.gadomancy.common.blocks;
import makeo.gadomancy.common.Gadomancy;
import makeo.gadomancy.common.blocks.tiles.TileKnowledgeBook;
import makeo.gadomancy.common.registration.RegisteredBlocks;
import makeo.gadomancy.common.registration.RegisteredItems;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import thaumcraft.common.Thaumcraft;
import thaumcraft.common.config.ConfigBlocks;
import java.util.ArrayList;
/**
* HellFirePvP@Admin
* Date: 19.04.2016 / 14:52
* on Gadomancy
* BlockKnowledgeBook
*/
public class BlockKnowledgeBook extends BlockContainer implements IBlockTransparent, TileKnowledgeBook.IKnowledgeProvider {
private IIcon icon;
public BlockKnowledgeBook() {
super(Material.circuits);
setBlockBounds(0.0625F, 0.1875F, 0.0625F, 0.9375F, 0.75F, 0.9375F);
setCreativeTab(RegisteredItems.creativeTab);
}
@Override
public String getTextureName() {
return "minecraft:wool_colored_white";
}
@Override
public int getLightValue(IBlockAccess world, int x, int y, int z) {
return 8;
}
@Override
public void registerBlockIcons(IIconRegister ir) {
icon = ir.registerIcon(Gadomancy.MODID + ":transparent");
super.registerBlockIcons(ir);
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_) {
if(world.isRemote) {
try {
player.openGui(Thaumcraft.instance, 12, world, x, y, z);
Minecraft.getMinecraft().theWorld.playSound(Minecraft.getMinecraft().thePlayer.posX, Minecraft.getMinecraft().thePlayer.posY, Minecraft.getMinecraft().thePlayer.posZ, "thaumcraft:page", 0.66F, 1.0F, false);
} catch (Throwable tr) {
Gadomancy.log.warn("Error on opening Thaumcraft Thaumonomicon via KnowledgeBook at world " + world.getWorldInfo().getWorldName() + ", x=" + x + ", y=" + y + ", z=" + z);
}
}
return true;
}
@Override
public void onNeighborBlockChange(World world, int x, int y, int z, Block neighbor) {
if(world.isRemote) return;
Block lower = world.getBlock(x, y - 1, z);
int metaLower = world.getBlockMetadata(x, y - 1, z);
if(!lower.equals(ConfigBlocks.blockStoneDevice) || metaLower != 1) {
breakThisBlock(world, x, y, z);
}
}
public void breakThisBlock(World world, int x, int y, int z) {
if(world.isRemote) return;
ArrayList<ItemStack> stacks = getDrops(world, x, y, z, 0, 0);
for(ItemStack i : stacks) {
EntityItem item = new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, i);
world.spawnEntityInWorld(item);
}
world.removeTileEntity(x, y, z);
world.setBlockToAir(x, y, z);
world.markBlockForUpdate(x, y, z);
}
@Override
public boolean isOpaqueCube() {
return false;
}
@Override
public IIcon getTransparentIcon() {
return icon;
}
@Override
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
return new TileKnowledgeBook();
}
@Override
public int getRenderType() {
return RegisteredBlocks.rendererTransparentBlock;
}
@Override
public boolean renderAsNormalBlock() {
return false;
}
@Override
public int getProvidedKnowledge(World world, int blockX, int blockY, int blockZ) {
return 2;
}
}
@@ -205,6 +205,10 @@ public class BlockStoneMachine extends Block {
dropBlockAsItem(world, x, y, z, metadata, 0);
world.setBlockToAir(x, y, z);
}
} else if(metadata == 1) {
if (!world.isAirBlock(x, y + 1, z)) {
InventoryUtils.dropItems(world, x, y, z);
}
} else if(metadata == 4) {
if(!world.isRemote) {
TileArcanePackager tile = (TileArcanePackager) world.getTileEntity(x, y, z);
@@ -247,7 +251,10 @@ public class BlockStoneMachine extends Block {
return world.getBlock(x, y - 1, z).onBlockActivated(world, x, y - 1, z, player, side, hitX, hitY, hitZ);
}
} else if (metadata == 1) {
return ConfigBlocks.blockStoneDevice.onBlockActivated(world, x, y, z, player, side, hitX, hitY, hitZ);
if(world.isAirBlock(x, y + 1, z)) {
return ConfigBlocks.blockStoneDevice.onBlockActivated(world, x, y, z, player, side, hitX, hitY, hitZ);
}
return true;
} else if(metadata == 4) {
player.openGui(Gadomancy.instance, 2, world, x, y, z);
return true;
@@ -16,6 +16,7 @@ import net.minecraft.util.IIcon;
* Created by makeo @ 29.09.2015 22:07
*/
public abstract class BlockTransparent extends Block implements IBlockTransparent {
protected BlockTransparent(Material material) {
super(material);
}
@@ -15,29 +15,28 @@ import net.minecraft.tileentity.TileEntity;
* Created by makeo @ 07.10.2015 18:39
*/
public class SynchronizedTileEntity extends TileEntity {
public void readFromNBT(NBTTagCompound compound) {
public final void readFromNBT(NBTTagCompound compound) {
super.readFromNBT(compound);
readCustomNBT(compound);
}
public void readCustomNBT(NBTTagCompound compound) {
}
public void readCustomNBT(NBTTagCompound compound) {}
public void writeToNBT(NBTTagCompound compound) {
public final void writeToNBT(NBTTagCompound compound) {
super.writeToNBT(compound);
writeCustomNBT(compound);
}
public void writeCustomNBT(NBTTagCompound compound) {
}
public void writeCustomNBT(NBTTagCompound compound) {}
public Packet getDescriptionPacket() {
public final Packet getDescriptionPacket() {
NBTTagCompound compound = new NBTTagCompound();
writeCustomNBT(compound);
return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 255, compound);
}
public void onDataPacket(NetworkManager manager, S35PacketUpdateTileEntity paket) {
public final void onDataPacket(NetworkManager manager, S35PacketUpdateTileEntity paket) {
super.onDataPacket(manager, paket);
readCustomNBT(paket.func_148857_g());
}
@@ -37,12 +37,12 @@ import java.util.List;
* <p/>
* Created by HellFirePvP @ 11.11.2015 14:30
*/
public class TileAuraPylon extends SynchronizedTileEntity implements IAspectContainer, IEssentiaTransport {
public class TileAuraPylon extends SynchronizedTileEntity implements IAspectContainer, IEssentiaTransport, EntityPermNoClipItem.IItemMasterTile {
private ItemStack crystalEssentiaStack = null;
private boolean isPartOfMultiblock = false;
public int timeSinceLastItemInfo = 0;
private int timeSinceLastItemInfo = 0;
private int ticksExisted = 0;
private Aspect holdingAspect;
@@ -75,7 +75,7 @@ public class TileAuraPylon extends SynchronizedTileEntity implements IAspectCont
doAuraEffects(holdingAspect);
}
if(holdingAspect != null && timeSinceLastItemInfo > 8) {
informItemPickup();
informItemRemoval();
}
}
} else {
@@ -92,6 +92,16 @@ public class TileAuraPylon extends SynchronizedTileEntity implements IAspectCont
}
}
@Override
public boolean canStillHoldItem() {
return isMasterTile();
}
@Override
public void informMaster() {
this.timeSinceLastItemInfo = 0;
}
private void doAuraEffects(Aspect aspect) {
if(aspect == null) return;
if(!isMasterTile()) return;
@@ -145,6 +155,7 @@ public class TileAuraPylon extends SynchronizedTileEntity implements IAspectCont
private void tryVortexPossibleItems() {
TileAuraPylon io = getInputTile();
if (io == null) return;
int masterY = yCoord + 1;
float dst = ((float) (masterY - io.yCoord)) / 2F;
float yC = masterY - dst;
@@ -240,7 +251,8 @@ public class TileAuraPylon extends SynchronizedTileEntity implements IAspectCont
}
}
public void informItemPickup() {
@Override
public void informItemRemoval() {
if(!isMasterTile()) return;
this.crystalEssentiaStack = null;
this.holdingAspect = null;
@@ -254,6 +266,17 @@ public class TileAuraPylon extends SynchronizedTileEntity implements IAspectCont
io.markDirty();
}
//We don't want the item to change at any given point...
@Override
public EntityPermNoClipItem.ItemChangeTask getAndRemoveScheduledChangeTask() {
return null;
}
@Override
public void broadcastItemStack(ItemStack itemStack) {
this.crystalEssentiaStack = itemStack;
}
//Individual.
//Returns true, if state has changed, false if still complete state.
private boolean checkComponents() {
@@ -583,4 +606,5 @@ public class TileAuraPylon extends SynchronizedTileEntity implements IAspectCont
TileEntity te = worldObj.getTileEntity(xCoord, yCoord - 1, zCoord);
return te == null || !(te instanceof TileAuraPylon);
}
}
@@ -0,0 +1,604 @@
package makeo.gadomancy.common.blocks.tiles;
import cpw.mods.fml.common.network.NetworkRegistry;
import makeo.gadomancy.client.util.UtilsFX;
import makeo.gadomancy.common.entities.EntityPermNoClipItem;
import makeo.gadomancy.common.network.PacketHandler;
import makeo.gadomancy.common.network.packets.PacketStartAnimation;
import makeo.gadomancy.common.utils.NBTHelper;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.command.IEntitySelector;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import thaumcraft.api.aspects.Aspect;
import thaumcraft.api.aspects.AspectList;
import thaumcraft.api.aspects.IAspectContainer;
import thaumcraft.api.research.ResearchCategories;
import thaumcraft.api.research.ResearchItem;
import thaumcraft.common.entities.EntityPermanentItem;
import thaumcraft.common.entities.EntitySpecialItem;
import thaumcraft.common.items.ItemResearchNotes;
import thaumcraft.common.lib.events.EssentiaHandler;
import thaumcraft.common.lib.research.ResearchManager;
import thaumcraft.common.lib.research.ResearchNoteData;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;
/**
* HellFirePvP@Admin
* Date: 19.04.2016 / 14:53
* on Gadomancy
* TileKnowledgeBook
*/
public class TileKnowledgeBook extends SynchronizedTileEntity implements EntityPermNoClipItem.IItemMasterTile, IAspectContainer {
private static final Random rand = new Random();
private static final int LOWEST_AMOUNT = 10;
private static final int COGNITIO_TICKS = 300;
private static final int MAX_NEEDED_KNOWLEDGE = 100;
private static final int SURROUNDINGS_SEARCH_XZ = 4;
private static final int SURROUNDINGS_SEARCH_Y = 3;
private static final double MULTIPLIER = 4;
@Deprecated
public static Map<BlockSnapshot, Integer> knowledgeIncreaseMap = new HashMap<BlockSnapshot, Integer>();
private FloatingBookAttributes bookAttributes = new FloatingBookAttributes();
//The itemstack this is connected to.
private ItemStack storedResearchNote = null;
private EntityPermNoClipItem.ItemChangeTask scheduledTask = null;
//Ticks
private int timeSinceLastItemInfo = 0;
private int ticksExisted = 0;
private int ticksCognitio = 0;
//Sound effect stuff. I didn't like it when it's like changing pages 4 times in a row...
private boolean turnedPagesLastTick = false;
//General research stuff
private boolean researching = false;
private AspectList workResearchAspects = null;
private int surroundingKnowledge = 0;
@Override
public void updateEntity() {
bookAttributes.updateFloatingBook();
ticksExisted++;
timeSinceLastItemInfo++;
if (!worldObj.isRemote) {
if(timeSinceLastItemInfo > 8) {
informItemRemoval();
}
if(updateResearchStatus()) {
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
markDirty();
}
if(researching) {
doResearchCycle();
}
} else {
if(researching && hasCognitio()) {
doResearchEffects();
}
}
if (storedResearchNote == null) {
tryVortexUnfinishedResearchNotes();
}
}
public boolean hasCognitio() {
return ticksCognitio > 0;
}
private void doResearchCycle() {
drainCognitio();
if(!hasCognitio()) {
return;
}
checkSurroundings();
int chance = Math.max(0, MAX_NEEDED_KNOWLEDGE - this.surroundingKnowledge) + 100;
if(rand.nextInt(chance) == 0) {
doResearchProgress();
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
markDirty();
}
}
private void doResearchProgress() {
List<Aspect> aspects = new ArrayList<Aspect>(this.workResearchAspects.aspects.keySet());
if(aspects.isEmpty()) {
finishResearch();
return;
}
Aspect a = aspects.get(rand.nextInt(aspects.size()));
int value = this.workResearchAspects.aspects.get(a);
value--;
if(value <= 0) {
this.workResearchAspects.aspects.remove(a);
} else {
this.workResearchAspects.aspects.put(a, value);
}
}
private void checkSurroundings() {
this.surroundingKnowledge = 0;
for (int xx = -SURROUNDINGS_SEARCH_XZ; xx <= SURROUNDINGS_SEARCH_XZ; xx++) {
for (int zz = -SURROUNDINGS_SEARCH_XZ; zz <= SURROUNDINGS_SEARCH_XZ; zz++) {
lblYLoop:
for (int yy = -SURROUNDINGS_SEARCH_Y; yy <= SURROUNDINGS_SEARCH_Y; yy++) {
int absX = xx + xCoord;
int absY = yy + yCoord;
int absZ = zz + zCoord;
Block at = worldObj.getBlock(absX, absY, absZ);
int meta = worldObj.getBlockMetadata(absX, absY, absZ);
TileEntity te = worldObj.getTileEntity(absX, absY, absZ);
if(at.equals(Blocks.bookshelf)) {
this.surroundingKnowledge += 1;
} else if(te != null && te instanceof IKnowledgeProvider) {
this.surroundingKnowledge += ((IKnowledgeProvider) te).getProvidedKnowledge(worldObj, absX, absY, absZ);
} else if(at instanceof IKnowledgeProvider) {
this.surroundingKnowledge += ((IKnowledgeProvider) at).getProvidedKnowledge(worldObj, absX, absY, absZ);
} else {
for (BlockSnapshot sn : knowledgeIncreaseMap.keySet()) {
if(sn.block.equals(at) && sn.metadata == meta) {
this.surroundingKnowledge += knowledgeIncreaseMap.get(sn);
continue lblYLoop;
}
}
}
}
}
}
}
private void drainCognitio() {
if(ticksCognitio <= 0) {
searchForCognitio();
} else {
ticksCognitio--;
if(ticksCognitio <= 40) {
searchForCognitio();
}
if(ticksCognitio <= 0) {
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
markDirty();
}
}
}
private void searchForCognitio() {
if((ticksExisted & 31) == 0) {
int drainRange = 4;
ForgeDirection[] toTry = ForgeDirection.VALID_DIRECTIONS;
for (ForgeDirection dir : toTry) {
if(dir == null) continue; //LUL should not happen...
if(EssentiaHandler.drainEssentia(this, Aspect.MIND, dir, drainRange)) {
ticksCognitio += COGNITIO_TICKS;
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
markDirty();
break;
}
}
}
}
private void doResearchEffects() {
if((ticksExisted & 15) == 0) {
UtilsFX.doRuneEffects(Minecraft.getMinecraft().theWorld, xCoord, yCoord - 1, zCoord, 0);
}
if((ticksExisted & 31) == 0) {
switch (rand.nextInt(5)) {
case 0:
if(!turnedPagesLastTick) {
worldObj.playSound(xCoord + 0.5, yCoord + 0.3, zCoord + 0.5, "thaumcraft:page", 0.4F, 1.0F, false);
turnedPagesLastTick = true;
break;
}
case 1:
case 2:
case 3:
worldObj.playSound(xCoord + 0.5, yCoord + 0.3, zCoord + 0.5, "thaumcraft:write", 0.2F, 1.0F, false);
turnedPagesLastTick = false;
break;
}
}
}
private void finishResearch() {
stopResearch();
scheduleFinishItemChange();
PacketStartAnimation packet = new PacketStartAnimation(PacketStartAnimation.ID_SPARKLE_SPREAD, xCoord, yCoord, zCoord);
PacketHandler.INSTANCE.sendToAllAround(packet, getTargetPoint(32));
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
markDirty();
}
private NetworkRegistry.TargetPoint getTargetPoint(double radius) {
return new NetworkRegistry.TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, radius);
}
private void scheduleFinishItemChange() {
scheduledTask = new EntityPermNoClipItem.ItemChangeTask() {
@Override
public void changeItem(EntityPermNoClipItem item) {
ItemStack stack = item.getEntityItem();
stack.stackTagCompound.setBoolean("complete", true);
stack.setItemDamage(64);
}
};
}
//Returns true, if updating/sync is required.
private boolean updateResearchStatus() {
if(researching) {
if(storedResearchNote != null) {
ResearchNoteData nd = ResearchManager.getData(storedResearchNote);
if(nd == null || nd.isComplete()) {
stopResearch();
return true;
}
} else {
stopResearch();
return true;
}
} else {
if(storedResearchNote != null) {
ResearchNoteData nd = ResearchManager.getData(storedResearchNote);
if(nd != null && !nd.isComplete()) {
ResearchItem ri = ResearchCategories.getResearch(nd.key);
if(ri != null) {
beginResearch(ri.tags);
return true;
}
}
}
}
return false;
}
private void beginResearch(AspectList researchTags) {
AspectList workResearchList = new AspectList();
for (Aspect a : researchTags.aspects.keySet()) {
int value = researchTags.aspects.get(a);
int newVal = (int) Math.max(LOWEST_AMOUNT, ((double) value) * MULTIPLIER);
workResearchList.add(a, newVal);
}
this.workResearchAspects = workResearchList;
this.researching = true;
}
private void stopResearch() {
this.storedResearchNote = null;
this.workResearchAspects = null;
this.researching = false;
}
@Override
public boolean canStillHoldItem() {
return true;
}
@Override
public void informMaster() {
this.timeSinceLastItemInfo = 0;
}
@Override
public void informItemRemoval() {
this.storedResearchNote = null;
stopResearch();
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
markDirty();
}
@Override
public EntityPermNoClipItem.ItemChangeTask getAndRemoveScheduledChangeTask() {
if(scheduledTask != null) {
EntityPermNoClipItem.ItemChangeTask buffer = scheduledTask;
scheduledTask = null;
return buffer;
}
return null;
}
@Override
public void broadcastItemStack(ItemStack itemStack) {
this.storedResearchNote = itemStack;
}
private void tryVortexUnfinishedResearchNotes() {
float centerY = yCoord + 0.4F;
List entityItems = worldObj.selectEntitiesWithinAABB(EntityItem.class,
AxisAlignedBB.getBoundingBox(xCoord - 0.5, centerY - 0.5, zCoord - 0.5, xCoord + 0.5, centerY + 0.5, zCoord + 0.5).expand(8, 8, 8), new IEntitySelector() {
@Override
public boolean isEntityApplicable(Entity e) {
return !(e instanceof EntityPermanentItem) && !(e instanceof EntitySpecialItem) &&
e instanceof EntityItem && ((EntityItem) e).getEntityItem() != null &&
((EntityItem) e).getEntityItem().getItem() instanceof ItemResearchNotes &&
shouldVortexResearchNote(((EntityItem) e).getEntityItem());
}
});
Entity dummy = new EntityItem(worldObj);
dummy.posX = xCoord + 0.5;
dummy.posY = centerY + 0.5;
dummy.posZ = zCoord + 0.5;
//MC code.
EntityItem entity = null;
double d0 = Double.MAX_VALUE;
for (Object entityItem : entityItems) {
EntityItem entityIt = (EntityItem) entityItem;
if (entityIt != dummy) {
double d1 = dummy.getDistanceSqToEntity(entityIt);
if (d1 <= d0) {
entity = entityIt;
d0 = d1;
}
}
}
if(entity == null) return;
if(dummy.getDistanceToEntity(entity) < 1 && !worldObj.isRemote) {
ItemStack inter = entity.getEntityItem();
inter.stackSize--;
this.storedResearchNote = inter.copy();
this.storedResearchNote.stackSize = 1;
EntityPermNoClipItem item = new EntityPermNoClipItem(entity.worldObj, xCoord + 0.5F, centerY + 0.3F, zCoord + 0.5F, storedResearchNote, xCoord, yCoord, zCoord);
entity.worldObj.spawnEntityInWorld(item);
item.motionX = 0;
item.motionY = 0;
item.motionZ = 0;
item.hoverStart = entity.hoverStart;
item.age = entity.age;
item.noClip = true;
timeSinceLastItemInfo = 0;
if(inter.stackSize <= 0) entity.setDead();
entity.noClip = false;
item.delayBeforeCanPickup = 60;
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
markDirty();
} else {
entity.noClip = true;
applyMovementVectors(entity);
}
}
//Special to masterTile only!
private void applyMovementVectors(EntityItem entity) {
double var3 = (this.xCoord + 0.5D - entity.posX) / 15.0D;
double var5 = (this.yCoord + 0.5D - entity.posY) / 15.0D;
double var7 = (this.zCoord + 0.5D - entity.posZ) / 15.0D;
double var9 = Math.sqrt(var3 * var3 + var5 * var5 + var7 * var7);
double var11 = 1.0D - var9;
if (var11 > 0.0D) {
var11 *= var11;
entity.motionX += var3 / var9 * var11 * 0.15D;
entity.motionY += var5 / var9 * var11 * 0.25D;
entity.motionZ += var7 / var9 * var11 * 0.15D;
}
}
private boolean shouldVortexResearchNote(ItemStack stack) {
ResearchNoteData nd = ResearchManager.getData(stack);
if(nd == null) return false;
if(nd.isComplete()) return false;
ResearchItem ri = ResearchCategories.getResearch(nd.key);
return ri != null;
}
public FloatingBookAttributes getBookAttributes() {
return bookAttributes;
}
@Override
public void readCustomNBT(NBTTagCompound compound) {
this.ticksCognitio = compound.getInteger("cognitio");
this.workResearchAspects = NBTHelper.getAspectList(compound, "workAspects");
this.researching = compound.getBoolean("researching");
this.storedResearchNote = NBTHelper.getStack(compound, "crystalStack");
}
@Override
public void writeCustomNBT(NBTTagCompound compound) {
if(workResearchAspects != null) {
NBTHelper.setAspectList(compound, "workAspects", workResearchAspects);
}
compound.setInteger("cognitio", ticksCognitio);
compound.setBoolean("researching", researching);
if(storedResearchNote != null)
NBTHelper.setStack(compound, "crystalStack", storedResearchNote);
}
@Override
public AspectList getAspects() {
return workResearchAspects;
}
@Override
public void setAspects(AspectList list) {}
@Override
public boolean doesContainerAccept(Aspect aspect) {
return false;
}
@Override
public int addToContainer(Aspect aspect, int i) {
return 0;
}
@Override
public boolean takeFromContainer(Aspect aspect, int i) {
return false;
}
@Override
public boolean takeFromContainer(AspectList list) {
return false;
}
@Override
public boolean doesContainerContainAmount(Aspect aspect, int i) {
return false;
}
@Override
public boolean doesContainerContain(AspectList list) {
return false;
}
@Override
public int containerContains(Aspect aspect) {
return 0;
}
public static class BlockSnapshot {
public final Block block;
public final int metadata;
public BlockSnapshot(Block block, int metadata) {
this.block = block;
this.metadata = metadata;
}
}
public static interface IKnowledgeProvider {
public int getProvidedKnowledge(World world, int blockX, int blockY, int blockZ);
}
public class FloatingBookAttributes {
//Ugh. EnchantmentTable stuff... I DON'T UNDERSTAND THIS FLOATING BOOK
//Well not that i tried... copy pasta please.
public int field_145926_a;
public float field_145933_i;
public float field_145931_j;
public float field_145932_k;
public float field_145929_l;
public float field_145930_m;
public float field_145927_n;
public float field_145928_o;
public float field_145925_p;
public float field_145924_q;
private void updateFloatingBook() {
this.field_145927_n = this.field_145930_m;
this.field_145925_p = this.field_145928_o;
EntityPlayer entityplayer = TileKnowledgeBook.this.worldObj.getClosestPlayer((double)((float)TileKnowledgeBook.this.xCoord + 0.5F), (double)((float)TileKnowledgeBook.this.yCoord + 0.5F), (double)((float)TileKnowledgeBook.this.zCoord + 0.5F), 3.0D);
if (entityplayer != null)
{
double d0 = entityplayer.posX - (double)((float)TileKnowledgeBook.this.xCoord + 0.5F);
double d1 = entityplayer.posZ - (double)((float)TileKnowledgeBook.this.zCoord + 0.5F);
this.field_145924_q = (float)Math.atan2(d1, d0);
this.field_145930_m += 0.1F;
if (this.field_145930_m < 0.5F || rand.nextInt(40) == 0)
{
float f1 = this.field_145932_k;
do
{
this.field_145932_k += (float)(rand.nextInt(4) - rand.nextInt(4));
}
while (f1 == this.field_145932_k);
}
}
else
{
this.field_145924_q += 0.02F;
this.field_145930_m -= 0.1F;
}
while (this.field_145928_o >= (float)Math.PI)
{
this.field_145928_o -= ((float)Math.PI * 2F);
}
while (this.field_145928_o < -(float)Math.PI)
{
this.field_145928_o += ((float)Math.PI * 2F);
}
while (this.field_145924_q >= (float)Math.PI)
{
this.field_145924_q -= ((float)Math.PI * 2F);
}
while (this.field_145924_q < -(float)Math.PI)
{
this.field_145924_q += ((float)Math.PI * 2F);
}
float f2;
for (f2 = this.field_145924_q - this.field_145928_o; f2 >= (float)Math.PI; f2 -= ((float)Math.PI * 2F)) {}
while (f2 < -(float)Math.PI)
{
f2 += ((float)Math.PI * 2F);
}
this.field_145928_o += f2 * 0.4F;
if (this.field_145930_m < 0.0F)
{
this.field_145930_m = 0.0F;
}
if (this.field_145930_m > 1.0F)
{
this.field_145930_m = 1.0F;
}
++this.field_145926_a;
this.field_145931_j = this.field_145933_i;
float f = (this.field_145932_k - this.field_145933_i) * 0.4F;
float f3 = 0.2F;
if (f < -f3)
{
f = -f3;
}
if (f > f3)
{
f = f3;
}
this.field_145929_l += (f - this.field_145929_l) * 0.9F;
this.field_145933_i += this.field_145929_l;
}
}
}
@@ -1,6 +1,5 @@
package makeo.gadomancy.common.entities;
import makeo.gadomancy.common.blocks.tiles.TileAuraPylon;
import makeo.gadomancy.common.data.config.ModConfig;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.item.ItemStack;
@@ -72,8 +71,13 @@ public class EntityPermNoClipItem extends EntityPermanentItem {
ChunkCoordinates cc = (ChunkCoordinates) getDataWatcher().getWatchedObject(ModConfig.entityNoClipItemDatawatcherMasterId).getObject();
if(cc == null) return;
TileEntity te = worldObj.getTileEntity(cc.posX, cc.posY, cc.posZ);
if(te != null && te instanceof TileAuraPylon) {
((TileAuraPylon) te).timeSinceLastItemInfo = 0;
if(te != null && te instanceof IItemMasterTile) {
((IItemMasterTile) te).informMaster();
ItemChangeTask task = ((IItemMasterTile) te).getAndRemoveScheduledChangeTask();
if(task != null) {
task.changeItem(this);
}
((IItemMasterTile) te).broadcastItemStack(getEntityItem());
}
}
@@ -83,10 +87,12 @@ public class EntityPermNoClipItem extends EntityPermanentItem {
float fZ = Float.intBitsToFloat(fixC.posZ);
setPositionAndRotation(fX, fY, fZ, 0, 0);
if ((ticksExisted & 7) == 0 && !worldObj.isRemote) {
ChunkCoordinates masterCoords = (ChunkCoordinates) getDataWatcher().getWatchedObject(ModConfig.entityNoClipItemDatawatcherMasterId).getObject();
TileEntity te = worldObj.getTileEntity(masterCoords.posX, masterCoords.posY, masterCoords.posZ);
if (te == null || !(te instanceof TileAuraPylon) || !((TileAuraPylon) te).isMasterTile()) {
if (te == null || !(te instanceof IItemMasterTile) || !((IItemMasterTile) te).canStillHoldItem()) {
EntityItem item = new EntityItem(worldObj, posX, posY, posZ, getEntityItem());
worldObj.spawnEntityInWorld(item);
setDead();
@@ -135,4 +141,25 @@ public class EntityPermNoClipItem extends EntityPermanentItem {
com.setInteger("mY", masterY);
com.setInteger("mZ", masterZ);
}
public static interface IItemMasterTile {
public boolean canStillHoldItem();
public void informMaster();
public void informItemRemoval();
public ItemChangeTask getAndRemoveScheduledChangeTask();
public void broadcastItemStack(ItemStack itemStack);
}
public static abstract class ItemChangeTask {
public abstract void changeItem(EntityPermNoClipItem item);
}
}
@@ -94,8 +94,8 @@ public class EventHandlerEntity {
EntityPermNoClipItem item = (EntityPermNoClipItem) event.item;
ChunkCoordinates master = (ChunkCoordinates) item.getDataWatcher().getWatchedObject(ModConfig.entityNoClipItemDatawatcherMasterId).getObject();
TileEntity te = event.entityPlayer.worldObj.getTileEntity(master.posX, master.posY, master.posZ);
if (te == null || !(te instanceof TileAuraPylon)) return;
((TileAuraPylon) te).informItemPickup();
if (te == null || !(te instanceof EntityPermNoClipItem.IItemMasterTile)) return;
((EntityPermNoClipItem.IItemMasterTile) te).informItemRemoval();
}
}
}
@@ -1,6 +1,7 @@
package makeo.gadomancy.common.integration;
import makeo.gadomancy.common.CommonProxy;
import makeo.gadomancy.common.blocks.tiles.TileKnowledgeBook;
import makeo.gadomancy.common.data.config.ModConfig;
import makeo.gadomancy.common.registration.RegisteredBlocks;
import makeo.gadomancy.common.registration.RegisteredItems;
@@ -46,6 +47,13 @@ public class IntegrationAutomagy extends IntegrationMod {
if(ModConfig.enableAdditionalNodeTypes) {
CommonProxy.unregisterWandHandler("Automagy", ConfigBlocks.blockWarded, -1);
}
//Better bookshelves -> MOAR knowledge
Block betterBookshelf = Block.getBlockFromName("Automagy:blockBookshelfEnchanted");
if(betterBookshelf != null) {
TileKnowledgeBook.knowledgeIncreaseMap.put(new TileKnowledgeBook.BlockSnapshot(betterBookshelf, 0), 2);
TileKnowledgeBook.knowledgeIncreaseMap.put(new TileKnowledgeBook.BlockSnapshot(betterBookshelf, 1), 4);
}
}
public boolean handleNodeJarVisCost(ItemStack wandStack, EntityPlayer player) {
@@ -120,7 +120,7 @@ public class ItemAuraCore extends Item {
FIRE(Aspect.FIRE),
WATER(Aspect.WATER, true),
EARTH(Aspect.EARTH, true),
ORDER(Aspect.ORDER, true),
ORDER(Aspect.ORDER),
ENTROPY(Aspect.ENTROPY, true);
private final Aspect aspect;
@@ -0,0 +1,43 @@
package makeo.gadomancy.common.items;
import makeo.gadomancy.common.registration.RegisteredItems;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import thaumcraft.common.config.ConfigBlocks;
/**
* HellFirePvP@Admin
* Date: 19.04.2016 / 14:51
* on Gadomancy
* ItemBlockKnowledgeBook
*/
public class ItemBlockKnowledgeBook extends ItemBlock {
public ItemBlockKnowledgeBook(Block block) {
super(block);
setMaxDamage(0);
setCreativeTab(RegisteredItems.creativeTab);
}
@Override
public EnumRarity getRarity(ItemStack p_77613_1_) {
return RegisteredItems.raritySacred;
}
@Override
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) {
ForgeDirection placedAgainstDir = ForgeDirection.getOrientation(side);
Block placedAgainst = world.getBlock(x, y, z);
int againstMeta = world.getBlockMetadata(x, y, z);
if(placedAgainstDir.equals(ForgeDirection.UP) && placedAgainst.equals(ConfigBlocks.blockStoneDevice) && againstMeta == 1) {
return super.onItemUse(stack, player, world, x, y, z, side, hitX, hitY, hitZ);
} else {
return false;
}
}
}
@@ -7,6 +7,7 @@ import makeo.gadomancy.common.blocks.BlockArcaneDropper;
import makeo.gadomancy.common.blocks.BlockAuraPylon;
import makeo.gadomancy.common.blocks.BlockExtendedNodeJar;
import makeo.gadomancy.common.blocks.BlockInfusionClaw;
import makeo.gadomancy.common.blocks.BlockKnowledgeBook;
import makeo.gadomancy.common.blocks.BlockNode;
import makeo.gadomancy.common.blocks.BlockNodeManipulator;
import makeo.gadomancy.common.blocks.BlockRemoteJar;
@@ -16,6 +17,7 @@ import makeo.gadomancy.common.blocks.tiles.*;
import makeo.gadomancy.common.data.config.ModConfig;
import makeo.gadomancy.common.items.ItemBlockAdditionalEldritchPortal;
import makeo.gadomancy.common.items.ItemBlockAuraPylon;
import makeo.gadomancy.common.items.ItemBlockKnowledgeBook;
import makeo.gadomancy.common.items.ItemBlockRemoteJar;
import makeo.gadomancy.common.items.ItemBlockStoneMachine;
import makeo.gadomancy.common.items.ItemNodeManipulator;
@@ -56,6 +58,7 @@ public class RegisteredBlocks {
public static BlockStoneMachine blockStoneMachine;
public static BlockAdditionalEldritchPortal blockAdditionalEldrichPortal;
public static BlockAuraPylon blockAuraPylon;
public static BlockKnowledgeBook blockKnowledgeBook;
public static void init() {
registerBlocks();
@@ -78,6 +81,7 @@ public class RegisteredBlocks {
blockStoneMachine = registerBlock(new BlockStoneMachine(), ItemBlockStoneMachine.class);
blockAdditionalEldrichPortal = registerBlock(new BlockAdditionalEldritchPortal(), ItemBlockAdditionalEldritchPortal.class);
blockAuraPylon = registerBlock(new BlockAuraPylon(), ItemBlockAuraPylon.class);
blockKnowledgeBook = registerBlock(new BlockKnowledgeBook(), ItemBlockKnowledgeBook.class);
}
private static <T extends Block> T registerBlock(String name, T block) {
@@ -118,6 +122,7 @@ public class RegisteredBlocks {
registerTile(TileAuraPylon.class);
registerTile(TileAuraPylonTop.class);
registerTile(TileArcanePackager.class);
registerTile(TileKnowledgeBook.class);
}
private static void registerTile(Class<? extends TileEntity> tile, String name) {
@@ -82,6 +82,7 @@ public class RegisteredRecipes {
public static IArcaneRecipe recipeAuraPylon;
public static IArcaneRecipe recipeAuraPylonPeak;
public static IArcaneRecipe recipeArcanePackager;
public static IArcaneRecipe recipeKnowledgeBook;
public static InfusionEnchantmentRecipe recipeRevealer;
@@ -227,8 +228,20 @@ public class RegisteredRecipes {
RegisteredItems.itemAuraCore.setCoreType(aerCore, ItemAuraCore.AuraCoreType.AIR);
recipeArcanePackager = ThaumcraftApi.addArcaneCraftingRecipe(Gadomancy.MODID.toUpperCase() + ".ARCANE_PACKAGER", new ItemStack(RegisteredBlocks.blockStoneMachine, 1, 4),
new AspectList().add(Aspect.AIR, 100).add(Aspect.ORDER, 60).add(Aspect.ENTROPY, 50),
"PSP", "GCG", "JTJ", 'P', new ItemStack(ConfigBlocks.blockWoodenDevice, 1, 6), 'S', new ItemStack(Blocks.piston), 'G', (Config.wardedStone ? new ItemStack(ConfigBlocks.blockCosmeticOpaque, 1, 2) : new ItemStack(Blocks.glass) ),
'C', aerCore, 'J', new ItemStack(ConfigBlocks.blockJar), 'T', new ItemStack(ConfigBlocks.blockTable, 1, 15));
"PSP", "GCG", "JTJ",
'P', new ItemStack(ConfigBlocks.blockWoodenDevice, 1, 6), 'S', new ItemStack(Blocks.piston),
'G', (Config.wardedStone ? new ItemStack(ConfigBlocks.blockCosmeticOpaque, 1, 2) : new ItemStack(Blocks.glass)), 'C', aerCore,
'J', new ItemStack(ConfigBlocks.blockJar), 'T', new ItemStack(ConfigBlocks.blockTable, 1, 15));
ItemStack ordoCore = new ItemStack(RegisteredItems.itemAuraCore);
RegisteredItems.itemAuraCore.setCoreType(ordoCore, ItemAuraCore.AuraCoreType.ORDER);
recipeKnowledgeBook = ThaumcraftApi.addArcaneCraftingRecipe(Gadomancy.MODID.toUpperCase() + ".KNOWLEDGE_BOOK", new ItemStack(RegisteredBlocks.blockKnowledgeBook),
new AspectList().add(Aspect.ORDER, 70).add(Aspect.ENTROPY, 20).add(Aspect.AIR, 20).add(Aspect.FIRE, 30),
"STS", "BOB", "MGM",
'S', new ItemStack(ConfigItems.itemInkwell), 'T', new ItemStack(ConfigItems.itemThaumonomicon),
'B', new ItemStack(Items.book), 'O', ordoCore,
'M', new ItemStack(ConfigBlocks.blockMetalDevice, 1, 12), 'G', new ItemStack(ConfigItems.itemGoggles));
auraCoreRecipes = createAuraCoreRecipes();
@@ -62,6 +62,7 @@ public class RegisteredResearches {
public static ResearchItem researchArcanePackager;
public static ResearchItem researchAuraPylon;
public static ResearchItem researchAuraEffects;
public static ResearchItem researchKnowledgeBook;
//Skyblock Helper
public static ResearchItem researchAncientStones;
@@ -95,7 +96,7 @@ public class RegisteredResearches {
.setPages(new ResearchPage("gadomancy.research_page.GOLEMSILVERWOOD.1"), new ResearchPage(RegisteredRecipes.recipeGolemSilverwood)).registerResearchItem();
researchGolemRunicShield = new SimpleResearchItem("GOLEMRUNICSHIELD", 0, 0, 4, new ItemStack(RegisteredItems.itemFakeGolemShield, 1, 32767),
new AspectList().add(Aspect.AURA, 16))
new AspectList().add(Aspect.AURA, 16).add(Aspect.ARMOR, 6).add(Aspect.MAGIC, 4).add(Aspect.MOTION, 8))
.setParents(researchGolemSilverwood.key).setConcealed()
.setPages(new ResearchPage("gadomancy.research_page.GOLEMRUNICSHIELD.1"), new ResearchPage(RegisteredRecipes.recipesGolemRunicShield)).registerResearchItem();
@@ -307,6 +308,14 @@ public class RegisteredResearches {
.setParents(researchAuraPylon.key)
.setPages(new ResearchPage("gadomancy.research_page.AURA_EFFECTS.1")).registerResearchItem();
researchKnowledgeBook = new SimpleResearchItem("KNOWLEDGE_BOOK",
-2, 8, 2, new ItemStack(RegisteredBlocks.blockKnowledgeBook),
new AspectList().add(Aspect.MIND, 12).add(Aspect.MAGIC, 8).add(Aspect.MOTION, 6).add(Aspect.ORDER, 10).add(Aspect.MECHANISM, 8).add(Aspect.CRAFT, 8))
.setHidden()
.setParents(researchAuraCore.key)
.setItemTriggers(new ItemStack(RegisteredItems.itemAuraCore, 1, ItemAuraCore.AuraCoreType.ORDER.ordinal()))
.setPages(new ResearchPage("gadomancy.research_page.KNOWLEDGE_BOOK.1"), new ResearchPage(RegisteredRecipes.recipeKnowledgeBook)).registerResearchItem();
String[] packagerParents = Config.wardedStone ? new String[] { researchAuraCore.key, "WARDEDARCANA" } : new String[] { researchAuraCore.key };
researchArcanePackager = new SimpleResearchItem("ARCANE_PACKAGER",
2, 7, 2, new ItemStack(RegisteredBlocks.blockStoneMachine, 1, 4),
@@ -5,6 +5,8 @@ import net.minecraft.entity.Entity;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTTagCompound;
import thaumcraft.api.aspects.Aspect;
import thaumcraft.api.aspects.AspectList;
import java.util.UUID;
@@ -80,6 +82,33 @@ public class NBTHelper {
compound.setTag(tag, stackCompound);
}
public static void setAspectList(NBTTagCompound compound, String tag, AspectList list) {
NBTTagCompound listTag = new NBTTagCompound();
for (Aspect a : list.aspects.keySet()) {
int amt = list.aspects.get(a);
listTag.setInteger(a.getTag(), amt);
}
compound.setTag(tag, listTag);
}
public static AspectList getAspectList(NBTTagCompound compound, String tag) {
return getAspectList(compound, tag, null);
}
public static AspectList getAspectList(NBTTagCompound compound, String tag, AspectList defaultValue) {
if(!compound.hasKey(tag)) return defaultValue;
NBTTagCompound cmp = compound.getCompoundTag(tag);
AspectList out = new AspectList();
for (Object key : cmp.func_150296_c()) {
String strKey = (String) key;
Aspect a = Aspect.getAspect(strKey);
if(a != null) {
out.add(a, cmp.getInteger(strKey));
}
}
return out;
}
public static void setUUID(NBTTagCompound compound, String tag, UUID uuid) {
NBTTagCompound uuidComp = new NBTTagCompound();
uuidComp.setLong("mostSigBits", uuid.getMostSignificantBits());