-Dropped support for golem type api

-Added crafting/uncrafting for disguised armor
This commit is contained in:
makeo committed 2015-12-26 16:28:17 +01:00
1 parent 4bd8d0ce5a
commit aeecdbe33b
12 files changed
+306 -32

No files matched your search

@@ -7,31 +7,27 @@ import makeo.gadomancy.client.util.ExtendedTypeDisplayManager;
import makeo.gadomancy.client.util.FamiliarHandlerClient;
import makeo.gadomancy.client.util.MultiTickEffectDispatcher;
import makeo.gadomancy.common.Gadomancy;
import makeo.gadomancy.common.aura.ResearchPageAuraAspects;
import makeo.gadomancy.common.blocks.tiles.TileExtendedNode;
import makeo.gadomancy.common.blocks.tiles.TileExtendedNodeJar;
import makeo.gadomancy.common.data.DataAchromatic;
import makeo.gadomancy.common.data.SyncDataHolder;
import makeo.gadomancy.common.registration.RegisteredBlocks;
import makeo.gadomancy.common.utils.Injector;
import makeo.gadomancy.common.utils.NBTHelper;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.client.settings.GameSettings;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.event.*;
import net.minecraftforge.common.util.ForgeDirection;
import org.lwjgl.opengl.GL11;
import thaumcraft.api.BlockCoordinates;
import thaumcraft.api.IArchitect;
import thaumcraft.api.aspects.AspectList;
import thaumcraft.api.research.ResearchItem;
import thaumcraft.api.research.ResearchPage;
import thaumcraft.api.wands.ItemFocusBasic;
import thaumcraft.client.gui.GuiResearchRecipe;
import thaumcraft.client.lib.REHWandHandler;
@@ -39,7 +35,6 @@ import thaumcraft.common.items.relics.ItemThaumometer;
import thaumcraft.common.items.wands.ItemWandCasting;
import java.util.ArrayList;
import java.util.List;
/**
* This class is part of the Gadomancy Mod
@@ -118,17 +113,55 @@ public class RenderEventHandler {
}
private EntityPlayer current = null;
private ItemStack[] armor = null;
@SubscribeEvent(priority = EventPriority.LOWEST)
public void renderEntityPre(RenderLivingEvent.Pre event) {
if(event.entity instanceof EntityPlayer
&& ((DataAchromatic)SyncDataHolder.getDataClient("AchromaticData")).isAchromatic((EntityPlayer) event.entity)) {
current = (EntityPlayer) event.entity;
GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.15F);
GL11.glDepthMask(false);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glAlphaFunc(GL11.GL_GREATER, 0.003921569F);
if(event.entity instanceof EntityPlayer) {
EntityPlayer p = (EntityPlayer) event.entity;
if(((DataAchromatic)SyncDataHolder.getDataClient("AchromaticData")).isAchromatic((EntityPlayer) event.entity)) {
current = p;
GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.15F);
GL11.glDepthMask(false);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glAlphaFunc(GL11.GL_GREATER, 0.003921569F);
}
armor = p.inventory.armorInventory;
p.inventory.armorInventory = new ItemStack[armor.length];
System.arraycopy(armor, 0, p.inventory.armorInventory, 0, armor.length);
boolean changed = false;
for(int i = 0; i < armor.length; i++) {
if(armor[i] != null && NBTHelper.hasPersistentData(armor[i])) {
NBTTagCompound compound = NBTHelper.getPersistentData(armor[i]);
if(compound.hasKey("disguise")) {
NBTBase base = compound.getTag("disguise");
if(base instanceof NBTTagCompound) {
p.inventory.armorInventory[i] = ItemStack.loadItemStackFromNBT((NBTTagCompound) base);
} else {
p.inventory.armorInventory[i] = null;
}
changed = true;
}
}
}
if(!changed) {
p.inventory.armorInventory = armor;
armor = null;
}
}
}
@SubscribeEvent(priority = EventPriority.LOWEST, receiveCanceled = true)
public void renderPost(RenderLivingEvent.Post event) {
if(event.entity instanceof EntityPlayer) {
EntityPlayer p = (EntityPlayer) event.entity;
if(armor != null) {
p.inventory.armorInventory = armor;
}
}
}
@@ -141,9 +174,6 @@ public class RenderEventHandler {
}
}
@SubscribeEvent(priority = EventPriority.HIGHEST, receiveCanceled = true)
public void renderEntityPost(RenderLivingEvent.Specials.Pre event) {}
@SubscribeEvent
public void playerRenderEvent(RenderPlayerEvent.Post renderEvent) {
FamiliarHandlerClient.playerRenderEvent(renderEvent.entityPlayer, renderEvent.partialRenderTick);