mirror of
https://github.com/GTNewHorizons/Gadomancy.git
synced 2026-11-18 03:15:22 +00:00
- AuraPylon finish
- AuraResearchPage finish
This commit is contained in:
1 parent
09e436fefe
commit
28dee0fff0
23 files changed
+834
-22
No files matched your search
@@ -10,10 +10,14 @@ import net.minecraft.entity.Entity;
|
||||
*
|
||||
* Created by HellFirePvP @ 17.11.2015 14:36
|
||||
*/
|
||||
public abstract interface AuraEffect {
|
||||
public abstract class AuraEffect {
|
||||
|
||||
public abstract boolean isEntityApplicable(Entity e);
|
||||
|
||||
public abstract void applyEffect(Entity e);
|
||||
|
||||
public int getTickInterval() {
|
||||
return 8;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -15,6 +15,7 @@ import makeo.gadomancy.client.renderers.block.BlockExtendedNodeJarRenderer;
|
||||
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.RenderEntityItem;
|
||||
import makeo.gadomancy.client.renderers.item.ItemCreativeNodeRenderer;
|
||||
import makeo.gadomancy.client.renderers.item.ItemExNodeRenderer;
|
||||
import makeo.gadomancy.client.renderers.item.ItemJarExtendedNodeRenderer;
|
||||
@@ -26,11 +27,13 @@ import makeo.gadomancy.client.renderers.item.ItemRenderTileEntityMulti;
|
||||
import makeo.gadomancy.client.renderers.tile.*;
|
||||
import makeo.gadomancy.common.CommonProxy;
|
||||
import makeo.gadomancy.common.blocks.tiles.*;
|
||||
import makeo.gadomancy.common.entities.EntityAuraCore;
|
||||
import makeo.gadomancy.common.entities.EntityPermNoClipItem;
|
||||
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;
|
||||
@@ -145,6 +148,7 @@ public class ClientProxy extends CommonProxy {
|
||||
MinecraftForgeClient.registerItemRenderer(RegisteredItems.itemCreativeNode, new ItemCreativeNodeRenderer());
|
||||
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityPermNoClipItem.class, new RenderSpecialItem());
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityAuraCore.class, new RenderEntityItem());
|
||||
|
||||
//Blocks
|
||||
RegisteredBlocks.rendererTransparentBlock = registerBlockRenderer(new RenderBlockTransparent());
|
||||
|
||||
@@ -5,6 +5,7 @@ import cpw.mods.fml.common.gameevent.TickEvent;
|
||||
import cpw.mods.fml.common.network.FMLNetworkEvent;
|
||||
import makeo.gadomancy.client.effect.EffectHandler;
|
||||
import makeo.gadomancy.client.util.FamiliarHandlerClient;
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
||||
/**
|
||||
* This class is part of the Gadomancy Mod
|
||||
@@ -20,7 +21,7 @@ public class ClientHandler {
|
||||
|
||||
@SubscribeEvent
|
||||
public void onClientTick(TickEvent.ClientTickEvent event) {
|
||||
if(event.phase.equals(TickEvent.Phase.END)) {
|
||||
if(event.phase.equals(TickEvent.Phase.END) && !Minecraft.getMinecraft().isGamePaused()) {
|
||||
FamiliarHandlerClient.playerTickEvent();
|
||||
ticks++;
|
||||
|
||||
|
||||
@@ -1,30 +1,44 @@
|
||||
package makeo.gadomancy.client.events;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import makeo.gadomancy.client.gui.GuiResearchRecipeAuraEffects;
|
||||
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.registration.RegisteredBlocks;
|
||||
import makeo.gadomancy.common.utils.Injector;
|
||||
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.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.event.DrawBlockHighlightEvent;
|
||||
import net.minecraftforge.client.event.GuiOpenEvent;
|
||||
import net.minecraftforge.client.event.RenderPlayerEvent;
|
||||
import net.minecraftforge.client.event.RenderWorldLastEvent;
|
||||
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;
|
||||
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
|
||||
@@ -85,6 +99,17 @@ public class RenderEventHandler {
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void guiOpen(GuiOpenEvent event) {
|
||||
if(event.gui != null && event.gui instanceof GuiResearchRecipe) {
|
||||
GuiResearchRecipe gui = (GuiResearchRecipe) event.gui;
|
||||
ResearchItem research = new Injector(gui).getField("research");
|
||||
if(research.key.equals(Gadomancy.MODID.toUpperCase() + ".AURA_EFFECTS") && !(gui instanceof GuiResearchRecipeAuraEffects)) {
|
||||
event.gui = GuiResearchRecipeAuraEffects.create(gui);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void worldRenderEvent(RenderWorldLastEvent event) {
|
||||
ExtendedTypeDisplayManager.notifyRenderTick();
|
||||
|
||||
@@ -0,0 +1,261 @@
|
||||
package makeo.gadomancy.client.gui;
|
||||
|
||||
import makeo.gadomancy.common.Gadomancy;
|
||||
import makeo.gadomancy.common.aura.AuraResearchManager;
|
||||
import makeo.gadomancy.common.aura.ResearchPageAuraAspects;
|
||||
import makeo.gadomancy.common.utils.Injector;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
import thaumcraft.api.research.ResearchItem;
|
||||
import thaumcraft.api.research.ResearchPage;
|
||||
import thaumcraft.client.gui.GuiResearchRecipe;
|
||||
import thaumcraft.client.lib.TCFontRenderer;
|
||||
import thaumcraft.client.lib.UtilsFX;
|
||||
import thaumcraft.common.Thaumcraft;
|
||||
import thaumcraft.common.lib.crafting.ThaumcraftCraftingManager;
|
||||
import thaumcraft.common.lib.utils.InventoryUtils;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
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
|
||||
*
|
||||
* Created by HellFirePvP @ 30.11.2015 12:24
|
||||
*/
|
||||
public class GuiResearchRecipeAuraEffects extends GuiResearchRecipe {
|
||||
|
||||
private HashMap<String, ArrayList<ItemStack>> itemMap = new HashMap<String, ArrayList<ItemStack>>();
|
||||
|
||||
public GuiResearchRecipeAuraEffects(ResearchItem research, int page, double x, double y) {
|
||||
super(research, page, x, y);
|
||||
|
||||
Injector inj = new Injector(this, GuiResearchRecipe.class);
|
||||
|
||||
ResearchPage[] additionalPages = ResearchPageAuraAspects.createAllAuraPagesFor(Minecraft.getMinecraft().thePlayer);
|
||||
ResearchPage[] pages = inj.getField("pages");
|
||||
ResearchPage[] newPages = new ResearchPage[pages.length + additionalPages.length];
|
||||
System.arraycopy(pages, 0, newPages, 0, pages.length);
|
||||
System.arraycopy(additionalPages, 0, newPages, pages.length, additionalPages.length);
|
||||
inj.setField("pages", newPages);
|
||||
inj.setField("maxPages", newPages.length);
|
||||
|
||||
List<String> list = Thaumcraft.proxy.getScannedObjects().get(Minecraft.getMinecraft().thePlayer.getCommandSenderName());
|
||||
if ((list != null) && (list.size() > 0)) {
|
||||
for (String s : list) {
|
||||
try {
|
||||
String s2 = s.substring(1);
|
||||
ItemStack is = getFromCache(Integer.parseInt(s2));
|
||||
if (is != null) {
|
||||
AspectList tags = ThaumcraftCraftingManager.getObjectTags(is);
|
||||
tags = ThaumcraftCraftingManager.getBonusTags(is, tags);
|
||||
if ((tags != null) && (tags.size() > 0)) {
|
||||
for (Aspect a : tags.getAspects()) {
|
||||
ArrayList<ItemStack> items = itemMap.get(a.getTag());
|
||||
if (items == null) {
|
||||
items = new ArrayList<ItemStack>();
|
||||
}
|
||||
ItemStack is2 = is.copy();
|
||||
is2.stackSize = tags.getAmount(a);
|
||||
items.add(is2);
|
||||
itemMap.put(a.getTag(), items);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (NumberFormatException e) {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static GuiResearchRecipeAuraEffects create(GuiResearchRecipe oldGui) {
|
||||
Injector inj = new Injector(oldGui);
|
||||
ResearchItem ri = inj.getField("research");
|
||||
double guiX = inj.getField("guiMapX");
|
||||
double guiY = inj.getField("guiMapY");
|
||||
int page = inj.getField("page");
|
||||
return new GuiResearchRecipeAuraEffects(ri, page, guiX, guiY);
|
||||
}
|
||||
|
||||
String tex1 = "textures/gui/gui_researchbook.png";
|
||||
|
||||
@Override
|
||||
protected void genResearchBackground(int par1, int par2, float par3) {
|
||||
int sw = (this.width - this.paneWidth) / 2;
|
||||
int sh = (this.height - this.paneHeight) / 2;
|
||||
|
||||
float var10 = (this.width - this.paneWidth * 1.3F) / 2.0F;
|
||||
float var11 = (this.height - this.paneHeight * 1.3F) / 2.0F;
|
||||
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
UtilsFX.bindTexture(this.tex1);
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(var10, var11, 0.0F);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glScalef(1.3F, 1.3F, 1.0F);
|
||||
drawTexturedModalRect(0, 0, 0, 0, this.paneWidth, this.paneHeight);
|
||||
GL11.glPopMatrix();
|
||||
|
||||
Injector inj = new Injector(this, GuiResearchRecipe.class);
|
||||
|
||||
ArrayList<List> reference = inj.getField("reference");
|
||||
inj.setField("tooltip", null);
|
||||
ResearchPage[] pages = inj.getField("pages");
|
||||
int page = inj.getField("page");
|
||||
int maxPages = inj.getField("maxPages");
|
||||
|
||||
reference.clear();
|
||||
int current = 0;
|
||||
for (int a = 0; a < pages.length; a++) {
|
||||
if (((current == page) || (current == page + 1)) && (current < maxPages)) {
|
||||
ResearchPage rPage = pages[a];
|
||||
if (rPage instanceof ResearchPageAuraAspects) {
|
||||
drawAuraAspectPagePre(rPage, current % 2, sw, sh, par1, par2, page);
|
||||
} else if(rPage != null) {
|
||||
try {
|
||||
Method m = Injector.getMethod("drawPage", GuiResearchRecipe.class, ResearchPage.class, int.class, int.class, int.class, int.class, int.class);
|
||||
m.setAccessible(true);
|
||||
m.invoke(this, pages[a], current % 2, sw, sh, par1, par2);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
current++;
|
||||
if (current > page + 1) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
UtilsFX.bindTexture(this.tex1);
|
||||
float bob = MathHelper.sin(this.mc.thePlayer.ticksExisted / 3.0F) * 0.2F + 0.1F;
|
||||
if (!history.isEmpty()) {
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
drawTexturedModalRectScaled(sw + 118, sh + 189, 38, 202, 20, 12, bob);
|
||||
}
|
||||
if (page > 0) {
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
drawTexturedModalRectScaled(sw - 16, sh + 190, 0, 184, 12, 8, bob);
|
||||
}
|
||||
if (page < maxPages - 2) {
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
drawTexturedModalRectScaled(sw + 262, sh + 190, 12, 184, 12, 8, bob);
|
||||
}
|
||||
|
||||
inj.setField("reference", reference);
|
||||
}
|
||||
|
||||
private void drawAuraAspectPagePre(ResearchPage page, int side, int x, int y, int mx, int my, int thisPage) {
|
||||
GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
|
||||
String researchName = Gadomancy.MODID.toUpperCase() + ".AURA_EFFECTS"; //We know the name of that research.
|
||||
researchName = StatCollector.translateToLocal(researchName);
|
||||
if ((thisPage == 0) && (side == 0)) {
|
||||
drawTexturedModalRect(x + 4, y - 13, 24, 184, 96, 4);
|
||||
drawTexturedModalRect(x + 4, y + 4, 24, 184, 96, 4);
|
||||
int offset = this.fontRendererObj.getStringWidth(researchName);
|
||||
if (offset <= 130) {
|
||||
this.fontRendererObj.drawString(researchName, x + 52 - offset / 2, y - 6, 3158064);
|
||||
} else {
|
||||
float vv = 130.0F / offset;
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(x + 52 - offset / 2 * vv, y - 6.0F * vv, 0.0F);
|
||||
GL11.glScalef(vv, vv, vv);
|
||||
this.fontRendererObj.drawString(researchName, 0, 0, 3158064);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
y += 25;
|
||||
}
|
||||
GL11.glAlphaFunc(GL11.GL_GREATER, 0.003921569F);
|
||||
drawAuraPage(side, x - 8, y - 8, mx, my, page.aspects);
|
||||
GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
|
||||
GL11.glPopAttrib();
|
||||
}
|
||||
|
||||
private void drawAuraPage(int side, int x, int y, int mx, int my, AspectList aspects) {
|
||||
if ((aspects != null) && (aspects.size() > 0)) {
|
||||
TCFontRenderer fr = new Injector(this, GuiResearchRecipe.class).getField("fr");
|
||||
GL11.glPushMatrix();
|
||||
int start = side * 152;
|
||||
int count = 0;
|
||||
for (Aspect aspect : aspects.getAspectsSorted()) {
|
||||
if (aspect.getImage() != null) {
|
||||
GL11.glPushMatrix();
|
||||
int tx = x + start;
|
||||
int ty = y + count * 50;
|
||||
if ((mx >= tx) && (my >= ty) && (mx < tx + 40) && (my < ty + 40)) {
|
||||
UtilsFX.bindTexture("textures/aspects/_back.png");
|
||||
GL11.glPushMatrix();
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GL11.glTranslated(x + start - 5, y + count * 50 - 5, 0.0D);
|
||||
GL11.glScaled(2.5D, 2.5D, 0.0D);
|
||||
UtilsFX.drawTexturedQuadFull(0, 0, this.zLevel);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
GL11.glScalef(2.0F, 2.0F, 2.0F);
|
||||
UtilsFX.drawTag((x + start) / 2, (y + count * 50) / 2, aspect, aspects.getAmount(aspect), 0, this.zLevel);
|
||||
GL11.glPopMatrix();
|
||||
String text = aspect.getName();
|
||||
int offset = fr.getStringWidth(text) / 2;
|
||||
fr.drawString(text, x + start + 16 - offset, y + 33 + count * 50, 5263440);
|
||||
|
||||
List<String> lines = AuraResearchManager.getLines(aspect.getTag());
|
||||
|
||||
int drawX = x + start + 48 + 36;
|
||||
int drawY = y + 12 + count * 50;
|
||||
int lineSpace = 8;
|
||||
int yOffset = drawY - (((lines.size() - 1) * lineSpace) / 2);
|
||||
for (int i = 0; i < lines.size(); i++) {
|
||||
String txt = lines.get(i);
|
||||
int width = fr.getStringWidth(txt);
|
||||
int actDrawX = drawX - (width / 2);
|
||||
int actDrawY = yOffset + (i * lineSpace);
|
||||
fr.drawString(txt, actDrawX, actDrawY, 0x444444);
|
||||
}
|
||||
}
|
||||
count++;
|
||||
}
|
||||
count = 0;
|
||||
for (Aspect aspect : aspects.getAspectsSorted()) {
|
||||
int tx = x + start;
|
||||
int ty = y + count * 50;
|
||||
if ((mx >= tx) && (my >= ty) && (mx < tx + 40) && (my < ty + 40)) {
|
||||
ArrayList<ItemStack> items = itemMap.get(aspect.getTag());
|
||||
if ((items != null) && (items.size() > 0)) {
|
||||
int xcount = 0;
|
||||
int ycount = 0;
|
||||
for (ItemStack item : items) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
itemRenderer.renderItemAndEffectIntoGUI(this.mc.fontRenderer, this.mc.renderEngine, InventoryUtils.cycleItemStack(item), mx + 8 + xcount * 17, 17 * ycount + (my - (4 + items.size() / 8 * 8)));
|
||||
itemRenderer.renderItemOverlayIntoGUI(this.mc.fontRenderer, this.mc.renderEngine, InventoryUtils.cycleItemStack(item), mx + 8 + xcount * 17, 17 * ycount + (my - (4 + items.size() / 8 * 8)));
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
GL11.glPopMatrix();
|
||||
xcount++;
|
||||
if (xcount >= 8) {
|
||||
xcount = 0;
|
||||
ycount++;
|
||||
}
|
||||
}
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
}
|
||||
}
|
||||
count++;
|
||||
}
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package makeo.gadomancy.client.renderers.entity;
|
||||
|
||||
import makeo.gadomancy.common.entities.EntityAuraCore;
|
||||
import net.minecraft.client.entity.AbstractClientPlayer;
|
||||
import net.minecraft.client.renderer.entity.Render;
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
/**
|
||||
* 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 @ 29.11.2015 19:13
|
||||
*/
|
||||
public class RenderEntityItem extends Render {
|
||||
|
||||
private RenderItem ri;
|
||||
|
||||
public RenderEntityItem() {
|
||||
ri = new RenderItem();
|
||||
ri.setRenderManager(RenderManager.instance);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doRender(Entity entity, double x, double y, double z, float parf1, float parf2) {
|
||||
if(!(entity instanceof EntityAuraCore)) return;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture(Entity p_110775_1_) {
|
||||
return AbstractClientPlayer.locationStevePng;
|
||||
}
|
||||
}
|
||||
@@ -100,7 +100,7 @@ public class RenderTileAuraPylon extends TileEntitySpecialRenderer {
|
||||
Aspect a = ((TileAuraPylonTop) tile).getAspect();
|
||||
if(a != null) {
|
||||
int col = a.getColor();
|
||||
col |= (0x44 << 24);
|
||||
col |= (0x55 << 24);
|
||||
Color c = new Color(col, true);
|
||||
Random rand = tile.getWorldObj().rand;
|
||||
addNewOrbitalPoint(((TileAuraPylonTop) tile).orbital, rand, c);
|
||||
|
||||
@@ -11,6 +11,8 @@ import makeo.gadomancy.api.GadomancyApi;
|
||||
import makeo.gadomancy.common.api.DefaultApiHandler;
|
||||
import makeo.gadomancy.common.data.ModConfig;
|
||||
import makeo.gadomancy.common.data.ModData;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import thaumcraft.common.Thaumcraft;
|
||||
|
||||
/**
|
||||
@@ -37,6 +39,7 @@ public class Gadomancy {
|
||||
@SidedProxy(clientSide = PROXY_CLIENT, serverSide = PROXY_SERVER)
|
||||
public static CommonProxy proxy;
|
||||
|
||||
public static Logger log = LogManager.getLogger("Gadomancy");
|
||||
private static ModData modData = null;
|
||||
|
||||
public static ModData getModData() {
|
||||
|
||||
@@ -11,7 +11,7 @@ import makeo.gadomancy.common.data.ModConfig;
|
||||
import makeo.gadomancy.common.entities.golems.ItemAdditionalGolemPlacer;
|
||||
import makeo.gadomancy.common.entities.golems.nbt.ExtendedGolemProperties;
|
||||
import makeo.gadomancy.common.registration.RegisteredBlocks;
|
||||
import makeo.gadomancy.common.utils.AuraEffectHandler;
|
||||
import makeo.gadomancy.common.aura.AuraEffectHandler;
|
||||
import makeo.gadomancy.common.utils.GolemEnumHelper;
|
||||
import makeo.gadomancy.common.utils.NBTHelper;
|
||||
import makeo.gadomancy.common.utils.StringHelper;
|
||||
|
||||
+16
-4
@@ -1,7 +1,8 @@
|
||||
package makeo.gadomancy.common.utils;
|
||||
package makeo.gadomancy.common.aura;
|
||||
|
||||
import makeo.gadomancy.api.AuraEffect;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
@@ -23,10 +24,12 @@ public class AuraEffectHandler {
|
||||
|
||||
public static Map<Aspect, AuraEffect> registeredEffects = new HashMap<Aspect, AuraEffect>();
|
||||
|
||||
//Called once every 32 ticks!
|
||||
public static void distributeEffects(Aspect aspect, World worldObj, double x, double y, double z, double range) {
|
||||
if(!registeredEffects.containsKey(aspect)) return;
|
||||
//Called once every 8 ticks!
|
||||
public static void distributeEffects(Aspect aspect, World worldObj, double x, double y, double z, double range, int tick) {
|
||||
if(!registeredEffects.containsKey(aspect) || worldObj.isRemote) return;
|
||||
AuraEffect effect = registeredEffects.get(aspect);
|
||||
if(tick % effect.getTickInterval() != 0) return;
|
||||
|
||||
List entitiesInRange = worldObj.getEntitiesWithinAABB(Entity.class, AxisAlignedBB.getBoundingBox(x - 0.5, y - 0.5, z - 0.5, x + 0.5, y + 0.5, z + 0.5).expand(range, range, range));
|
||||
Iterator it = entitiesInRange.iterator();
|
||||
while(it.hasNext()) {
|
||||
@@ -36,7 +39,16 @@ public class AuraEffectHandler {
|
||||
}
|
||||
for(Object e : entitiesInRange) {
|
||||
effect.applyEffect((Entity) e);
|
||||
if(e instanceof EntityPlayer) {
|
||||
AuraResearchManager.tryUnlockAuraEffect((EntityPlayer) e, aspect);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static {
|
||||
|
||||
registeredEffects.put(Aspect.HEAL, AuraEffects.DUMMY_SANO);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package makeo.gadomancy.common.aura;
|
||||
|
||||
import makeo.gadomancy.api.AuraEffect;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
|
||||
/**
|
||||
* 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 @ 29.11.2015 19:09
|
||||
*/
|
||||
public class AuraEffects {
|
||||
|
||||
//TODO create and register in AuraEffectHandler
|
||||
|
||||
public static final AuraEffect DUMMY_SANO = new AuraEffect() {
|
||||
@Override
|
||||
public boolean isEntityApplicable(Entity e) {
|
||||
return e instanceof EntityLivingBase;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyEffect(Entity e) {
|
||||
e.motionY = 0.6;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTickInterval() {
|
||||
return 2;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
package makeo.gadomancy.common.aura;
|
||||
|
||||
import makeo.gadomancy.common.Gadomancy;
|
||||
import makeo.gadomancy.common.network.PacketHandler;
|
||||
import makeo.gadomancy.common.network.packets.PacketSyncAuraKnowledge;
|
||||
import makeo.gadomancy.common.network.packets.PacketTCNotificationText;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.nbt.CompressedStreamTools;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.nbt.NBTTagString;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
|
||||
import java.awt.*;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* 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 @ 29.11.2015 18:14
|
||||
*/
|
||||
public class AuraResearchManager {
|
||||
|
||||
private static Map<UUID, List<String>> auraMap = new HashMap<UUID, List<String>>();
|
||||
|
||||
public static void tryUnlockAuraEffect(EntityPlayer player, Aspect aspect) {
|
||||
UUID playerUUID = player.getUniqueID();
|
||||
if(!AuraEffectHandler.registeredEffects.containsKey(aspect)) return;
|
||||
if(!auraMap.containsKey(playerUUID)) {
|
||||
auraMap.put(playerUUID, new ArrayList<String>());
|
||||
}
|
||||
if(auraMap.get(playerUUID).contains(aspect.getTag())) return;
|
||||
auraMap.get(playerUUID).add(aspect.getTag());
|
||||
|
||||
PacketTCNotificationText text = new PacketTCNotificationText("gadomancy.aura.research.unlock", aspect.getTag());
|
||||
PacketHandler.INSTANCE.sendTo(text, (EntityPlayerMP) player);
|
||||
|
||||
PacketSyncAuraKnowledge sync = new PacketSyncAuraKnowledge(auraMap.get(playerUUID));
|
||||
PacketHandler.INSTANCE.sendTo(sync, (EntityPlayerMP) player);
|
||||
}
|
||||
|
||||
//Side: CLIENT!!!
|
||||
public static void recieveServerData(List<String> aspectTags) {
|
||||
UUID ourPlayer = Minecraft.getMinecraft().thePlayer.getUniqueID();
|
||||
auraMap.put(ourPlayer, aspectTags);
|
||||
}
|
||||
|
||||
public static List<String> getLines(String aspectTag) {
|
||||
List<String> lines = new ArrayList<String>();
|
||||
String base = "gadomancy.aura.effect." + aspectTag;
|
||||
if(StatCollector.canTranslate(base)) {
|
||||
lines.add(StatCollector.translateToLocal(base));
|
||||
return lines;
|
||||
}
|
||||
int count = 0;
|
||||
while(StatCollector.canTranslate(base + "_" + count)) {
|
||||
lines.add(StatCollector.translateToLocal(base + "_" + count));
|
||||
count++;
|
||||
}
|
||||
return lines;
|
||||
}
|
||||
|
||||
public static List<String> getKnowledge(EntityPlayer player) {
|
||||
return getKnowledge(player.getUniqueID());
|
||||
}
|
||||
|
||||
public static List<String> getKnowledge(UUID playerUUID) {
|
||||
return auraMap.get(playerUUID);
|
||||
}
|
||||
|
||||
public static void loadDataFromFile(String playerName, UUID uniqueID, File auraData) {
|
||||
if(!auraData.exists()) {
|
||||
auraMap.put(uniqueID, new ArrayList<String>());
|
||||
return;
|
||||
}
|
||||
NBTTagCompound compound;
|
||||
try {
|
||||
compound = CompressedStreamTools.read(auraData);
|
||||
} catch (IOException e) {
|
||||
Gadomancy.log.warn("Unable to load aura data for " + uniqueID + "/" + playerName);
|
||||
auraMap.put(uniqueID, new ArrayList<String>());
|
||||
return;
|
||||
}
|
||||
|
||||
List<String> tags = new ArrayList<String>();
|
||||
NBTTagList aspects = compound.getTagList("aspects", new NBTTagString().getId());
|
||||
for (int i = 0; i < aspects.tagCount(); i++) {
|
||||
String aspect = aspects.getStringTagAt(i);
|
||||
if(Aspect.getAspect(aspect) != null) {
|
||||
tags.add(aspect);
|
||||
}
|
||||
}
|
||||
auraMap.put(uniqueID, tags);
|
||||
}
|
||||
|
||||
public static void saveDataToFile(String commandSenderName, UUID uniqueID, File auraData) {
|
||||
if(!auraMap.containsKey(uniqueID)) return;
|
||||
if(!auraData.exists()) {
|
||||
try {
|
||||
auraData.createNewFile();
|
||||
} catch (IOException e) {
|
||||
Gadomancy.log.error("Could not create aura data for " + uniqueID + "/" + commandSenderName);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
List<String> tags = auraMap.get(uniqueID);
|
||||
NBTTagList list = new NBTTagList();
|
||||
for(String s : tags) {
|
||||
list.appendTag(new NBTTagString(s));
|
||||
}
|
||||
NBTTagCompound cmp = new NBTTagCompound();
|
||||
cmp.setTag("aspects", list);
|
||||
try {
|
||||
CompressedStreamTools.write(cmp, auraData);
|
||||
} catch (IOException e) {
|
||||
Gadomancy.log.error("Could not write aura data for " + uniqueID + "/" + commandSenderName);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
package makeo.gadomancy.common.aura;
|
||||
|
||||
import makeo.gadomancy.common.utils.SimpleResourceLocation;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
import thaumcraft.api.research.ResearchPage;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
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
|
||||
*
|
||||
* Created by HellFirePvP @ 29.11.2015 23:57
|
||||
*/
|
||||
public class ResearchPageAuraAspects extends ResearchPage {
|
||||
|
||||
private static final ResourceLocation transparent = new SimpleResourceLocation("items/transparent.png");
|
||||
|
||||
private ResearchPageAuraAspects(AspectList as) {
|
||||
super(as);
|
||||
}
|
||||
|
||||
public static ResearchPage[] createAllAuraPagesFor(EntityPlayer player) {
|
||||
List<ResearchPage> pages = new ArrayList<ResearchPage>();
|
||||
int additionalPages = ResearchPageAuraAspects.getAdditionalPagesFor(player);
|
||||
for (int i = 0; i < additionalPages; i++) {
|
||||
List<String> tags = ResearchPageAuraAspects.getAspectTagsForPageIndex(player, i);
|
||||
AspectList list = ResearchPageAuraAspects.createPageAspectList(tags);
|
||||
pages.add(new ResearchPageAuraAspects(list));
|
||||
}
|
||||
ResearchPage[] t = new ResearchPage[1];
|
||||
return pages.toArray(t);
|
||||
}
|
||||
|
||||
public static int getAdditionalPagesFor(EntityPlayer player) {
|
||||
List<String> knowledge = AuraResearchManager.getKnowledge(player);
|
||||
if(knowledge.size() == 0) return 0;
|
||||
return ((knowledge.size() & 3) == 0) ? (knowledge.size() >> 2) : ((knowledge.size() >> 2) + 1);
|
||||
}
|
||||
|
||||
public static List<String> getAspectTagsForPageIndex(EntityPlayer player, int pageIndex) {
|
||||
List<String> knowledge = AuraResearchManager.getKnowledge(player);
|
||||
if(knowledge.size() <= 0) return new ArrayList<String>();
|
||||
Collections.sort(knowledge);
|
||||
int startIndex = pageIndex << 2;
|
||||
if(knowledge.size() <= startIndex) return new ArrayList<String>(); //Should not happen, because getAdditionalPages should only return indexes within range
|
||||
return knowledge.subList(startIndex, (startIndex + 3 > knowledge.size()) ? knowledge.size() : startIndex + 3);
|
||||
}
|
||||
|
||||
public static AspectList createPageAspectList(List<String> tagList) {
|
||||
AspectList list = new AspectList();
|
||||
for(String tag : tagList) {
|
||||
Aspect a = createAuraFakeAspect(tag);
|
||||
if(a != null) list.add(a, 0);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
private static Aspect createAuraFakeAspect(String tag) {
|
||||
Aspect original = Aspect.getAspect(tag);
|
||||
if(original == null) return null;
|
||||
String fakeTemp = "GADOMANCY_TEMP_" + tag;
|
||||
|
||||
Aspect fake = new FakeAspect(fakeTemp, original.getColor(), null, original.getImage(), original.getBlend(), true);
|
||||
fake.setTag(original.getTag());
|
||||
return fake;
|
||||
}
|
||||
|
||||
private static class FakeAspect extends Aspect {
|
||||
|
||||
private boolean headAspect;
|
||||
|
||||
public FakeAspect(String tag, int color, Aspect[] components, ResourceLocation image, int blend, boolean isHead) {
|
||||
super(tag, color, components, image, blend);
|
||||
Aspect.aspects.remove(tag);
|
||||
this.headAspect = isHead;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
if(headAspect) return super.getName();
|
||||
String tag = super.getTag();
|
||||
if(tag == null || tag.isEmpty() || tag.equals("")) return "";
|
||||
return StatCollector.translateToLocal(tag);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
package makeo.gadomancy.common.blocks.tiles;
|
||||
|
||||
import makeo.gadomancy.common.entities.EntityPermNoClipItem;
|
||||
import makeo.gadomancy.common.utils.AuraEffectHandler;
|
||||
import makeo.gadomancy.common.aura.AuraEffectHandler;
|
||||
import makeo.gadomancy.common.utils.NBTHelper;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.command.IEntitySelector;
|
||||
@@ -80,9 +80,9 @@ public class TileAuraPylon extends SynchronizedTileEntity implements IAspectCont
|
||||
TileAuraPylon io = getInputTile();
|
||||
if(io != null && io.amount > 0) {
|
||||
if ((ticksExisted & 31) == 0) {
|
||||
doAuraEffects(holdingAspect);
|
||||
drainEssentia(io);
|
||||
}
|
||||
doAuraEffects(holdingAspect);
|
||||
}
|
||||
if(holdingAspect != null && timeSinceLastItemInfo > 8) {
|
||||
informItemPickup();
|
||||
@@ -106,7 +106,7 @@ public class TileAuraPylon extends SynchronizedTileEntity implements IAspectCont
|
||||
if(aspect == null) return;
|
||||
if(!isMasterTile()) return;
|
||||
if(worldObj.isRemote) return;
|
||||
AuraEffectHandler.distributeEffects(aspect, worldObj, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, 8);
|
||||
AuraEffectHandler.distributeEffects(aspect, worldObj, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, 8, ticksExisted);
|
||||
}
|
||||
|
||||
private void drainEssentia(TileAuraPylon io) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package makeo.gadomancy.common.events;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.EventPriority;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import makeo.gadomancy.common.aura.AuraResearchManager;
|
||||
import makeo.gadomancy.common.blocks.tiles.TileAuraPylon;
|
||||
import makeo.gadomancy.common.blocks.tiles.TileBlockProtector;
|
||||
import makeo.gadomancy.common.data.ModConfig;
|
||||
@@ -15,14 +15,16 @@ import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraftforge.event.entity.EntityEvent;
|
||||
import net.minecraftforge.event.entity.living.EnderTeleportEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingDeathEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingSetAttackTargetEvent;
|
||||
import net.minecraftforge.event.entity.player.EntityItemPickupEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerEvent;
|
||||
import thaumcraft.common.items.armor.Hover;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* This class is part of the Gadomancy Mod
|
||||
* Gadomancy is Open Source and distributed under the
|
||||
@@ -93,4 +95,16 @@ public class EventHandlerEntity {
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onLoad(PlayerEvent.LoadFromFile loadEvent) {
|
||||
File auraData = loadEvent.getPlayerFile("auraDat");
|
||||
AuraResearchManager.loadDataFromFile(loadEvent.entityPlayer.getCommandSenderName(), loadEvent.entityPlayer.getUniqueID(), auraData);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onSave(PlayerEvent.SaveToFile saveEvent) {
|
||||
File auraData = saveEvent.getPlayerFile("auraDat");
|
||||
AuraResearchManager.saveDataToFile(saveEvent.entityPlayer.getCommandSenderName(), saveEvent.entityPlayer.getUniqueID(), auraData);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,8 +3,10 @@ package makeo.gadomancy.common.events;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.PlayerEvent;
|
||||
import makeo.gadomancy.common.Gadomancy;
|
||||
import makeo.gadomancy.common.aura.AuraResearchManager;
|
||||
import makeo.gadomancy.common.network.PacketHandler;
|
||||
import makeo.gadomancy.common.network.packets.PacketFamiliar;
|
||||
import makeo.gadomancy.common.network.packets.PacketSyncAuraKnowledge;
|
||||
import makeo.gadomancy.common.network.packets.PacketSyncConfigs;
|
||||
import makeo.gadomancy.common.network.packets.PacketUpdateGolemTypeOrder;
|
||||
import makeo.gadomancy.common.utils.GolemEnumHelper;
|
||||
@@ -29,6 +31,7 @@ public class EventHandlerNetwork {
|
||||
Gadomancy.proxy.familiarHandler.checkPlayerEquipment(p);
|
||||
PacketHandler.INSTANCE.sendTo(new PacketFamiliar.PacketFamiliarSyncCompletely(Gadomancy.proxy.familiarHandler.getCurrentActiveFamiliars()), p);
|
||||
PacketHandler.INSTANCE.sendTo(new PacketSyncConfigs(), p);
|
||||
PacketHandler.INSTANCE.sendTo(new PacketSyncAuraKnowledge(AuraResearchManager.getKnowledge(p)), p);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -68,9 +68,7 @@ public class ItemAuraCore extends Item {
|
||||
WATER("Aqua", "aqua"),
|
||||
EARTH("Terra", "terra"),
|
||||
ORDER("Ordo", "ordo"),
|
||||
ENTROPY("Perditio", "perditio"),
|
||||
|
||||
BALANCE("Balanced", "balanced");
|
||||
ENTROPY("Perditio", "perditio");
|
||||
|
||||
public final String unlocName, fallback;
|
||||
|
||||
|
||||
@@ -20,16 +20,23 @@ public class PacketHandler {
|
||||
public static void init() {
|
||||
int id = 0;
|
||||
|
||||
//Random stuff
|
||||
INSTANCE.registerMessage(PacketUpdateGolemTypeOrder.class, PacketUpdateGolemTypeOrder.class, id++, Side.CLIENT);
|
||||
INSTANCE.registerMessage(PacketStartAnimation.class, PacketStartAnimation.class, id++, Side.CLIENT);
|
||||
INSTANCE.registerMessage(PacketAnimationAbsorb.class, PacketAnimationAbsorb.class, id++, Side.CLIENT);
|
||||
|
||||
//Using TC Clientside content
|
||||
INSTANCE.registerMessage(PacketTCNodeBolt.class, PacketTCNodeBolt.class, id++, Side.CLIENT);
|
||||
INSTANCE.registerMessage(PacketTCWispyLine.class, PacketTCWispyLine.class, id++, Side.CLIENT);
|
||||
INSTANCE.registerMessage(PacketTCNotificationText.class, PacketTCNotificationText.class, id++, Side.CLIENT);
|
||||
|
||||
//Familiar
|
||||
INSTANCE.registerMessage(PacketFamiliar.PacketFamiliarBolt.class, PacketFamiliar.PacketFamiliarBolt.class, id++, Side.CLIENT);
|
||||
INSTANCE.registerMessage(PacketFamiliar.PacketFamiliarSyncCompletely.class, PacketFamiliar.PacketFamiliarSyncCompletely.class, id++, Side.CLIENT);
|
||||
INSTANCE.registerMessage(PacketFamiliar.PacketFamiliarSyncSingle.class, PacketFamiliar.PacketFamiliarSyncSingle.class, id++, Side.CLIENT);
|
||||
|
||||
//Sync data
|
||||
INSTANCE.registerMessage(PacketSyncConfigs.class, PacketSyncConfigs.class, id++, Side.CLIENT);
|
||||
INSTANCE.registerMessage(PacketSyncAuraKnowledge.class, PacketSyncAuraKnowledge.class, id++, Side.CLIENT);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package makeo.gadomancy.common.network.packets;
|
||||
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import makeo.gadomancy.common.aura.AuraResearchManager;
|
||||
|
||||
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 @ 30.11.2015 00:00
|
||||
*/
|
||||
public class PacketSyncAuraKnowledge implements IMessage, IMessageHandler<PacketSyncAuraKnowledge, IMessage> {
|
||||
|
||||
private List<String> aspectTags = new ArrayList<String>();
|
||||
|
||||
public PacketSyncAuraKnowledge() {}
|
||||
|
||||
public PacketSyncAuraKnowledge(List<String> aspectTags) {
|
||||
this.aspectTags = aspectTags;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fromBytes(ByteBuf buf) {
|
||||
int it = buf.readInt();
|
||||
|
||||
for (int i = 0; i < it; i++) {
|
||||
int length = buf.readInt();
|
||||
byte[] strBytes = new byte[length];
|
||||
buf.readBytes(strBytes, 0, length);
|
||||
aspectTags.add(new String(strBytes));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toBytes(ByteBuf buf) {
|
||||
buf.writeInt(aspectTags.size());
|
||||
|
||||
for(String tag : aspectTags) {
|
||||
byte[] str = tag.getBytes();
|
||||
buf.writeInt(str.length);
|
||||
buf.writeBytes(str);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMessage onMessage(PacketSyncAuraKnowledge message, MessageContext ctx) {
|
||||
AuraResearchManager.recieveServerData(message.aspectTags);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
package makeo.gadomancy.common.network.packets;
|
||||
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.client.lib.PlayerNotifications;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
/**
|
||||
* 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.11.2015 18:40
|
||||
*/
|
||||
public class PacketTCNotificationText implements IMessage, IMessageHandler<PacketTCNotificationText, IMessage> {
|
||||
|
||||
private String text, additionalInfo;
|
||||
private int color;
|
||||
|
||||
public PacketTCNotificationText() {}
|
||||
|
||||
//Color is not chat color! the color is supposedly the image color..
|
||||
public PacketTCNotificationText(String text, Color color, String additionalInfo) {
|
||||
this(text, color.getRGB(), additionalInfo);
|
||||
}
|
||||
|
||||
public PacketTCNotificationText(String text, int color, String additionalInfo) {
|
||||
this.text = text;
|
||||
this.additionalInfo = additionalInfo;
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
public PacketTCNotificationText(String text, String additionalInfo) {
|
||||
this(text, 0, additionalInfo);
|
||||
}
|
||||
|
||||
public PacketTCNotificationText(String text) {
|
||||
this(text, "");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fromBytes(ByteBuf buf) {
|
||||
color = buf.readInt();
|
||||
|
||||
int length = buf.readInt();
|
||||
byte[] strBytes = new byte[length];
|
||||
buf.readBytes(strBytes, 0, length);
|
||||
text = new String(strBytes);
|
||||
|
||||
length = buf.readInt();
|
||||
strBytes = new byte[length];
|
||||
buf.readBytes(strBytes, 0, length);
|
||||
additionalInfo = new String(strBytes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toBytes(ByteBuf buf) {
|
||||
buf.writeInt(color);
|
||||
|
||||
byte[] str = text.getBytes();
|
||||
buf.writeInt(str.length);
|
||||
buf.writeBytes(str);
|
||||
|
||||
if(additionalInfo == null) additionalInfo = "";
|
||||
|
||||
str = additionalInfo.getBytes();
|
||||
buf.writeInt(str.length);
|
||||
buf.writeBytes(str);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMessage onMessage(PacketTCNotificationText message, MessageContext ctx) {
|
||||
if(message.text == null) return null;
|
||||
String translated = StatCollector.translateToLocal(message.text);
|
||||
ResourceLocation image = null;
|
||||
int color = message.color;
|
||||
Aspect a = Aspect.getAspect(message.additionalInfo);
|
||||
if(a != null) {
|
||||
image = a.getImage();
|
||||
color = a.getColor();
|
||||
}
|
||||
if(message.text.equals("gadomancy.aura.research.unlock")) {
|
||||
if(a != null) {
|
||||
translated = EnumChatFormatting.GREEN + String.format(translated, a.getName());
|
||||
} else {
|
||||
translated = EnumChatFormatting.GREEN + String.format(translated, message.additionalInfo);
|
||||
}
|
||||
}
|
||||
color &= 0xFFFFFF;
|
||||
PlayerNotifications.addNotification(translated, image, color);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -188,7 +188,9 @@ public class GrowingNodeBehavior {
|
||||
EntityAspectOrb aspectOrb = new EntityAspectOrb(world, fx + 0.5D, fy + 0.5D, fz + 0.5D, a, 1);
|
||||
Vec3 dir = Vec3.createVectorHelper(fx + 0.5D, fy + 0.5D, fz + 0.5D).subtract(Vec3.createVectorHelper(ox + 0.5D, oy + 0.5D, oz + 0.5D)).normalize();
|
||||
dir.addVector(randOffset(), randOffset(), randOffset()).normalize();
|
||||
aspectOrb.setVelocity(dir.xCoord, dir.yCoord, dir.zCoord);
|
||||
aspectOrb.motionX = dir.xCoord;
|
||||
aspectOrb.motionY = dir.yCoord;
|
||||
aspectOrb.motionZ = dir.zCoord;
|
||||
fixedNode.getWorldObj().spawnEntityInWorld(aspectOrb);
|
||||
|
||||
NetworkRegistry.TargetPoint point = new NetworkRegistry.TargetPoint(world.provider.dimensionId, ox + 0.5F, oy + 0.5F, oz + 0.5F, 32);
|
||||
|
||||
@@ -43,6 +43,8 @@ public class RegisteredResearches {
|
||||
public static ResearchItem researchEldritchPortalCreator;
|
||||
public static ResearchItem researchBlockProtector;
|
||||
|
||||
public static ResearchItem researchAuraEffects;
|
||||
|
||||
//Skyblock Helper
|
||||
public static ResearchItem researchAncientStones;
|
||||
|
||||
@@ -224,6 +226,12 @@ public class RegisteredResearches {
|
||||
.setParents(Gadomancy.MODID.toUpperCase() + ".FAM_RANGE_1", Gadomancy.MODID.toUpperCase() + ".FAM_ATTACK_3", researchBathSalts.key, researchPrimalFocus2.key)
|
||||
.setPages(new ResearchPage("gadomancy.research_page.FAM_COOLDOWN_1.1"), new ResearchPage(RegisteredRecipes.recipesFamiliarAugmentation[4])).registerResearchItem();
|
||||
|
||||
researchAuraEffects = new ResearchItem(Gadomancy.MODID.toUpperCase() + ".AURA_EFFECTS", Gadomancy.MODID,
|
||||
new AspectList(),
|
||||
10, 10, 0, new ItemStack(RegisteredItems.itemFakeModIcon, 1, 0))
|
||||
.setAutoUnlock()
|
||||
.setPages(new ResearchPage("gadomancy.research_page.AURA_EFFECTS_1.1")).registerResearchItem();
|
||||
|
||||
if(ModConfig.ancientStoneRecipes)
|
||||
researchAncientStones = new AlternatingResearchItem("ANCIENT_STONES",
|
||||
-12, 1, 3,
|
||||
|
||||
@@ -151,12 +151,17 @@ gadomancy.nodes.STARVING=Starving
|
||||
|
||||
gadomancy.auracore.blank=Blank
|
||||
gadomancy.auracore.aer=Aer
|
||||
gadomancy.auracore.ignis=Ignis
|
||||
gadomancy.auracore.aqua=Aqua
|
||||
gadomancy.auracore.terra=Terra
|
||||
gadomancy.auracore.ignis=Ignis (Unused at the moment)
|
||||
gadomancy.auracore.aqua=Aqua (Unused at the moment)
|
||||
gadomancy.auracore.terra=Terra (Unused at the moment)
|
||||
gadomancy.auracore.ordo=Ordo
|
||||
gadomancy.auracore.perditio=Perditio
|
||||
gadomancy.auracore.balanced=Balanced
|
||||
gadomancy.auracore.perditio=Perditio (Unused at the moment)
|
||||
|
||||
gadomancy.aura.research.unlock=You've researched the aura of %s
|
||||
|
||||
gadomancy.aura.effect.sano=Provides a healing aura
|
||||
gadomancy.aura.effect.dummy_0=This is a multi-
|
||||
gadomancy.aura.effect.dummy_1=line description
|
||||
|
||||
gadomancy.info.InfusionClaw.owner=You are now the owner.
|
||||
gadomancy.info.InfusionClaw.waila=§7Owner:
|
||||
|
||||
Reference in new issue
Block a user