summaryrefslogtreecommitdiff
path: root/java
diff options
context:
space:
mode:
Diffstat (limited to 'java')
-rw-r--r--java/darkknight/jewelrycraft/CommonProxy.java8
-rw-r--r--java/darkknight/jewelrycraft/JewelrycraftMod.java22
-rw-r--r--java/darkknight/jewelrycraft/block/BlockJCOre.java9
-rw-r--r--java/darkknight/jewelrycraft/client/AbstractTab.java3
-rw-r--r--java/darkknight/jewelrycraft/client/ClientProxy.java20
-rw-r--r--java/darkknight/jewelrycraft/client/GuiGuide.java29
-rw-r--r--java/darkknight/jewelrycraft/commands/JewelrycraftCommands.java32
-rw-r--r--java/darkknight/jewelrycraft/container/GuiTabBlocks.java22
-rw-r--r--java/darkknight/jewelrycraft/container/GuiTabGemsAndIngots.java4
-rw-r--r--java/darkknight/jewelrycraft/container/GuiTabIntroduction.java52
-rw-r--r--java/darkknight/jewelrycraft/container/GuiTabItems.java26
-rw-r--r--java/darkknight/jewelrycraft/container/GuiTabModifiers.java19
-rw-r--r--java/darkknight/jewelrycraft/container/GuiTabRitual.java125
-rw-r--r--java/darkknight/jewelrycraft/container/Page.java52
-rw-r--r--java/darkknight/jewelrycraft/curses/Curse.java31
-rw-r--r--java/darkknight/jewelrycraft/curses/CurseFlamingSoul.java2
-rw-r--r--java/darkknight/jewelrycraft/curses/CurseInfamy.java41
-rw-r--r--java/darkknight/jewelrycraft/curses/CurseList.java3
-rw-r--r--java/darkknight/jewelrycraft/damage/DamageSourceList.java3
-rw-r--r--java/darkknight/jewelrycraft/effects/EffectBlazePowder.java53
-rw-r--r--java/darkknight/jewelrycraft/effects/EffectEnderEye.java76
-rw-r--r--java/darkknight/jewelrycraft/effects/EffectFeather.java77
-rw-r--r--java/darkknight/jewelrycraft/effects/ModifierEffects.java33
-rw-r--r--java/darkknight/jewelrycraft/events/EntityEventHandler.java150
-rw-r--r--java/darkknight/jewelrycraft/events/PlayerRenderHandler.java63
-rw-r--r--java/darkknight/jewelrycraft/events/ScreenHandler.java7
-rw-r--r--java/darkknight/jewelrycraft/item/ItemBaseJewelry.java15
-rw-r--r--java/darkknight/jewelrycraft/network/PacketSendCurseStats.java71
-rw-r--r--java/darkknight/jewelrycraft/util/JewelrycraftUtil.java10
-rw-r--r--java/darkknight/jewelrycraft/util/PlayerUtils.java3
-rw-r--r--java/darkknight/jewelrycraft/worldGen/village/ComponentJewelry.java4
31 files changed, 780 insertions, 285 deletions
diff --git a/java/darkknight/jewelrycraft/CommonProxy.java b/java/darkknight/jewelrycraft/CommonProxy.java
index 03f7c90..c6fa39f 100644
--- a/java/darkknight/jewelrycraft/CommonProxy.java
+++ b/java/darkknight/jewelrycraft/CommonProxy.java
@@ -5,9 +5,9 @@ package darkknight.jewelrycraft;
*/
public class CommonProxy
{
- /**
- * Register renderers.
- */
- public void registerRenderers()
+ public void preInit()
+ {}
+
+ public void postInit()
{}
} \ No newline at end of file
diff --git a/java/darkknight/jewelrycraft/JewelrycraftMod.java b/java/darkknight/jewelrycraft/JewelrycraftMod.java
index d984685..fd7058f 100644
--- a/java/darkknight/jewelrycraft/JewelrycraftMod.java
+++ b/java/darkknight/jewelrycraft/JewelrycraftMod.java
@@ -10,13 +10,11 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Logger;
-import net.minecraft.client.Minecraft;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.util.ResourceLocation;
import net.minecraft.world.gen.structure.MapGenStructureIO;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.oredict.OreDictionary;
@@ -37,9 +35,6 @@ import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.VillagerRegistry;
import cpw.mods.fml.relauncher.Side;
import darkknight.jewelrycraft.block.BlockList;
-import darkknight.jewelrycraft.client.InventoryTabVanilla;
-import darkknight.jewelrycraft.client.TabJewelry;
-import darkknight.jewelrycraft.client.TabRegistry;
import darkknight.jewelrycraft.commands.JewelrycraftCommands;
import darkknight.jewelrycraft.config.ConfigHandler;
import darkknight.jewelrycraft.container.GuiHandler;
@@ -51,14 +46,13 @@ import darkknight.jewelrycraft.entities.EntityHeart;
import darkknight.jewelrycraft.events.BucketHandler;
import darkknight.jewelrycraft.events.EntityEventHandler;
import darkknight.jewelrycraft.events.KeyBindings;
-import darkknight.jewelrycraft.events.PlayerRenderHandler;
-import darkknight.jewelrycraft.events.ScreenHandler;
import darkknight.jewelrycraft.item.ItemList;
import darkknight.jewelrycraft.lib.Reference;
import darkknight.jewelrycraft.network.PacketClearColorCache;
import darkknight.jewelrycraft.network.PacketKeyPressEvent;
import darkknight.jewelrycraft.network.PacketRequestLiquidData;
import darkknight.jewelrycraft.network.PacketRequestPlayerInfo;
+import darkknight.jewelrycraft.network.PacketSendCurseStats;
import darkknight.jewelrycraft.network.PacketSendLiquidData;
import darkknight.jewelrycraft.network.PacketSendPlayerInfo;
import darkknight.jewelrycraft.recipes.CraftingRecipes;
@@ -90,6 +84,7 @@ public class JewelrycraftMod
public static File liquidsConf;
public static SimpleNetworkWrapper netWrapper;
public static boolean fancyRender;
+ public static final int MAX_CURSES = 10;
/**
* Pre initialization of mod stuff.
@@ -116,15 +111,7 @@ public class JewelrycraftMod
catch(Throwable e2){
logger.severe("Error registering Jewelrycraft Structures with Vanilla Minecraft: this is expected in versions earlier than 1.7.10");
}
- TabRegistry.registerTab(new InventoryTabVanilla());
- TabRegistry.registerTab(new TabJewelry());
MinecraftForge.EVENT_BUS.register(new EntityEventHandler());
- if (FMLCommonHandler.instance().getSide() == Side.CLIENT){
- MinecraftForge.EVENT_BUS.register(new PlayerRenderHandler());
- ResourceLocation jeweleryTexture = new ResourceLocation("jewelrycraft", "textures/gui/curses.png");
- MinecraftForge.EVENT_BUS.register(new ScreenHandler(Minecraft.getMinecraft(), jeweleryTexture));
- MinecraftForge.EVENT_BUS.register(new TabRegistry());
- }
MinecraftForge.EVENT_BUS.register(BucketHandler.INSTANCE);
BucketHandler.INSTANCE.buckets.put(BlockList.moltenMetal, ItemList.bucket);
@@ -136,7 +123,7 @@ public class JewelrycraftMod
authorList.add("domi1819");
dir = e.getModConfigurationDirectory();
- proxy.registerRenderers();
+ proxy.preInit();
netWrapper = NetworkRegistry.INSTANCE.newSimpleChannel(Reference.MODID);
netWrapper.registerMessage(PacketRequestLiquidData.class, PacketRequestLiquidData.class, 0, Side.SERVER);
netWrapper.registerMessage(PacketSendLiquidData.class, PacketSendLiquidData.class, 1, Side.CLIENT);
@@ -144,6 +131,7 @@ public class JewelrycraftMod
netWrapper.registerMessage(PacketKeyPressEvent.class, PacketKeyPressEvent.class, 3, Side.SERVER);
netWrapper.registerMessage(PacketRequestPlayerInfo.class, PacketRequestPlayerInfo.class, 4, Side.SERVER);
netWrapper.registerMessage(PacketSendPlayerInfo.class, PacketSendPlayerInfo.class, 5, Side.CLIENT);
+ netWrapper.registerMessage(PacketSendCurseStats.class, PacketSendCurseStats.class, 6, Side.CLIENT);
metadata.autogenerated = false;
metadata.authorList = authorList;
metadata.url = "https://github.com/sor1n/Jewelrycraft";
@@ -184,10 +172,10 @@ public class JewelrycraftMod
public void postInit(FMLPostInitializationEvent e)
{
JewelrycraftUtil.addMetals();
- JewelrycraftUtil.addStuff();
JewelrycraftUtil.jamcrafters();
EffectsList.postInit(e);
DamageSourceList.postInit(e);
+ proxy.postInit();
}
@Mod.EventHandler
diff --git a/java/darkknight/jewelrycraft/block/BlockJCOre.java b/java/darkknight/jewelrycraft/block/BlockJCOre.java
index 6fafe66..4e5ca6d 100644
--- a/java/darkknight/jewelrycraft/block/BlockJCOre.java
+++ b/java/darkknight/jewelrycraft/block/BlockJCOre.java
@@ -1,17 +1,14 @@
package darkknight.jewelrycraft.block;
import net.minecraft.block.Block;
+import net.minecraft.block.BlockOre;
import net.minecraft.block.material.Material;
-public class BlockJCOre extends Block
+public class BlockJCOre extends BlockOre
{
-
- /**
- *
- */
protected BlockJCOre()
{
- super(Material.rock);
+ super();
setHarvestLevel("pickaxe", 3);
}
}
diff --git a/java/darkknight/jewelrycraft/client/AbstractTab.java b/java/darkknight/jewelrycraft/client/AbstractTab.java
index d0124fa..6728181 100644
--- a/java/darkknight/jewelrycraft/client/AbstractTab.java
+++ b/java/darkknight/jewelrycraft/client/AbstractTab.java
@@ -7,10 +7,13 @@ import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.*;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
/**
* @author TinkersCOnstruct
*/
+@SideOnly(Side.CLIENT)
public abstract class AbstractTab extends GuiButton
{
ResourceLocation texture = new ResourceLocation("textures/gui/container/creative_inventory/tabs.png");
diff --git a/java/darkknight/jewelrycraft/client/ClientProxy.java b/java/darkknight/jewelrycraft/client/ClientProxy.java
index 8f95d9e..9baadcb 100644
--- a/java/darkknight/jewelrycraft/client/ClientProxy.java
+++ b/java/darkknight/jewelrycraft/client/ClientProxy.java
@@ -1,8 +1,10 @@
package darkknight.jewelrycraft.client;
+import net.minecraft.client.Minecraft;
import net.minecraft.item.Item;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.MinecraftForgeClient;
+import net.minecraftforge.common.MinecraftForge;
import cpw.mods.fml.client.registry.ClientRegistry;
import cpw.mods.fml.client.registry.RenderingRegistry;
import cpw.mods.fml.common.registry.VillagerRegistry;
@@ -11,6 +13,8 @@ import darkknight.jewelrycraft.block.BlockList;
import darkknight.jewelrycraft.entities.EntityHalfHeart;
import darkknight.jewelrycraft.entities.EntityHeart;
import darkknight.jewelrycraft.entities.renders.HeartRender;
+import darkknight.jewelrycraft.events.PlayerRenderHandler;
+import darkknight.jewelrycraft.events.ScreenHandler;
import darkknight.jewelrycraft.model.ModelDisplayer;
import darkknight.jewelrycraft.model.ModelHalfHeart;
import darkknight.jewelrycraft.model.ModelHandPedestal;
@@ -35,11 +39,12 @@ import darkknight.jewelrycraft.tileentity.renders.TileEntityMolderRender;
import darkknight.jewelrycraft.tileentity.renders.TileEntityShadowEyeRender;
import darkknight.jewelrycraft.tileentity.renders.TileEntityShadowHandRender;
import darkknight.jewelrycraft.tileentity.renders.TileEntitySmelterRender;
+import darkknight.jewelrycraft.util.JewelrycraftUtil;
public class ClientProxy extends CommonProxy
{
@Override
- public void registerRenderers()
+ public void preInit()
{
ResourceLocation pedestalResourceLocation = new ResourceLocation("jewelrycraft", "textures/tileentities/BricksPedestal.png");
TileEntityHandPedestalRender pedestalRender = new TileEntityHandPedestalRender(new ModelHandPedestal(pedestalResourceLocation), pedestalResourceLocation);
@@ -65,5 +70,18 @@ public class ClientProxy extends CommonProxy
RenderingRegistry.registerEntityRenderingHandler(EntityHeart.class, new HeartRender(new ModelHeart(), 0.25F));
RenderingRegistry.registerEntityRenderingHandler(EntityHalfHeart.class, new HeartRender(new ModelHalfHeart(), 0.25F));
+
+ TabRegistry.registerTab(new InventoryTabVanilla());
+ TabRegistry.registerTab(new TabJewelry());
+ MinecraftForge.EVENT_BUS.register(new TabRegistry());
+ MinecraftForge.EVENT_BUS.register(new PlayerRenderHandler());
+ ResourceLocation jeweleryTexture = new ResourceLocation("jewelrycraft", "textures/gui/curses.png");
+ MinecraftForge.EVENT_BUS.register(new ScreenHandler(Minecraft.getMinecraft(), jeweleryTexture));
+ }
+
+ @Override
+ public void postInit()
+ {
+ JewelrycraftUtil.addStuff();
}
}
diff --git a/java/darkknight/jewelrycraft/client/GuiGuide.java b/java/darkknight/jewelrycraft/client/GuiGuide.java
index 503e681..09fc6a3 100644
--- a/java/darkknight/jewelrycraft/client/GuiGuide.java
+++ b/java/darkknight/jewelrycraft/client/GuiGuide.java
@@ -2,9 +2,12 @@ package darkknight.jewelrycraft.client;
import java.util.ArrayList;
import java.util.List;
+import net.minecraft.block.Block;
+import net.minecraft.block.BlockAir;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.inventory.GuiContainer;
+import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.inventory.Container;
@@ -13,12 +16,15 @@ import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import org.lwjgl.opengl.GL11;
import darkknight.jewelrycraft.block.BlockList;
+import darkknight.jewelrycraft.block.BlockShadowEye;
import darkknight.jewelrycraft.container.GuiRectangle;
import darkknight.jewelrycraft.container.GuiTab;
import darkknight.jewelrycraft.container.GuiTabBlocks;
import darkknight.jewelrycraft.container.GuiTabGemsAndIngots;
+import darkknight.jewelrycraft.container.GuiTabIntroduction;
import darkknight.jewelrycraft.container.GuiTabItems;
import darkknight.jewelrycraft.container.GuiTabModifiers;
+import darkknight.jewelrycraft.container.GuiTabRitual;
public class GuiGuide extends GuiContainer
{
@@ -42,7 +48,7 @@ public class GuiGuide extends GuiContainer
rot = 0;
del = 0;
this.world = world;
- tabs = new GuiTab[]{new GuiTabBlocks(0), new GuiTabItems(1), new GuiTabGemsAndIngots(2), new GuiTabModifiers(3)};
+ tabs = new GuiTab[]{new GuiTabIntroduction(0), new GuiTabBlocks(1), new GuiTabItems(2), new GuiTabGemsAndIngots(3), new GuiTabModifiers(4), new GuiTabRitual(5)};
activeTab = tabs[0];
pageTexture = pageTex;
flippedPageTexture = flipPageTex;
@@ -146,7 +152,12 @@ public class GuiGuide extends GuiContainer
if (item.isItemEqual(new ItemStack(BlockList.jewelAltar))){
GL11.glRotatef(160.0F, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
+ }else if (item.isItemEqual(new ItemStack(BlockList.handPedestal))){
+ GL11.glScalef(1.2F, 1.2F, 1.2F);
+ GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F);
+ GL11.glTranslatef(0F, 0.05F, 0F);
}else GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F);
+ if (!(Block.getBlockFromItem(entityitem.getEntityItem().getItem()) instanceof BlockAir)) RenderHelper.enableStandardItemLighting();
if (RenderManager.instance.options.fancyGraphics) RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
else{
GL11.glRotatef(180F, 0F, 1F, 0F);
@@ -154,6 +165,7 @@ public class GuiGuide extends GuiContainer
RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
RenderManager.instance.options.fancyGraphics = false;
}
+ if (!(Block.getBlockFromItem(entityitem.getEntityItem().getItem()) instanceof BlockAir)) RenderHelper.disableStandardItemLighting();
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glPopMatrix();
}
@@ -164,7 +176,7 @@ public class GuiGuide extends GuiContainer
* @param y
* @param scale
*/
- public void renderItem(ItemStack item, float x, float y, float scale)
+ public void renderItem(ItemStack item, float x, float y, float scale, boolean rotate, float xRot, float yRot, float zRot)
{
GL11.glPushMatrix();
EntityItem entityitem = new EntityItem(world, 0.0D, 0.0D, 0.0D, item);
@@ -172,14 +184,23 @@ public class GuiGuide extends GuiContainer
GL11.glTranslatef(x, y, 100);
GL11.glScalef(-scale, scale, scale);
GL11.glRotatef(160.0F, 1.0F, 0.0F, 0.0F);
- GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
- GL11.glRotatef(rot, 0.0F, 1.0F, 0.0F);
+ if (rotate) GL11.glRotatef(rot, 0.0F, 1.0F, 0.0F);
+ else{
+ // GL11.glRotatef(entityitem.getEntityItem().getItemDamage() % 8 / 8F * 360, 0, 1, 0);
+ GL11.glRotatef(xRot, 1, 0, 0);
+ GL11.glRotatef(yRot, 0, 1, 0);
+ GL11.glRotatef(zRot, 0, 0, 1);
+ if (xRot >= 90F || zRot >= 90F) GL11.glTranslatef(0F, -0.2F, 0F);
+ if (Block.getBlockFromItem(entityitem.getEntityItem().getItem()) instanceof BlockShadowEye) GL11.glTranslatef(0F, 0F, 0.025F);
+ }
+ if (!(Block.getBlockFromItem(entityitem.getEntityItem().getItem()) instanceof BlockAir)) RenderHelper.enableStandardItemLighting();
if (RenderManager.instance.options.fancyGraphics) RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
else{
RenderManager.instance.options.fancyGraphics = true;
RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
RenderManager.instance.options.fancyGraphics = false;
}
+ if (!(Block.getBlockFromItem(entityitem.getEntityItem().getItem()) instanceof BlockAir)) RenderHelper.disableStandardItemLighting();
GL11.glPopMatrix();
}
diff --git a/java/darkknight/jewelrycraft/commands/JewelrycraftCommands.java b/java/darkknight/jewelrycraft/commands/JewelrycraftCommands.java
index 582b99c..e8f639d 100644
--- a/java/darkknight/jewelrycraft/commands/JewelrycraftCommands.java
+++ b/java/darkknight/jewelrycraft/commands/JewelrycraftCommands.java
@@ -20,6 +20,7 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.ChatComponentTranslation;
+import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.IChatComponent;
import darkknight.jewelrycraft.JewelrycraftMod;
import darkknight.jewelrycraft.curses.Curse;
@@ -54,7 +55,7 @@ public class JewelrycraftCommands extends CommandBase
{
String use = "/jewelrycraft <addCursePoints:getCursePoints:setCursePoints> <user> [points] | ";
use += "/jewelrycraft <addModifier> <modifier> |";
- use += "/jewelrycraft <addCurse> <curse> ";
+ use += "/jewelrycraft <addCurse> <user> <curseID> <curseGrade>";
return use;
}
@@ -86,19 +87,18 @@ public class JewelrycraftCommands extends CommandBase
modifier.add(item);
JewelryNBT.addModifiers(entityplayermp.getCurrentEquippedItem(), modifier);
}else if (astring[0].equals("addCurse")){
- int curse = Integer.valueOf(astring[1]);
- EntityPlayerMP entityplayermp = getPlayer(commandSender, commandSender.getCommandSenderName());
+ EntityPlayerMP entityplayermp = getPlayer(commandSender, astring[1]);
+ int curse = Integer.valueOf(astring[2]);
+ int grade = Integer.valueOf(astring[3]);
NBTTagCompound playerInfo = PlayerUtils.getModPlayerPersistTag(entityplayermp, "Jewelrycraft");
- if (curse < Curse.availableCurses.size()){
- try{
- for(int i = 0; i <= 5; i++)
- EntityEventHandler.addCurse(entityplayermp, playerInfo, ("curse" + i).toString(), curse);
- JewelrycraftMod.netWrapper.sendToServer(new PacketRequestPlayerInfo());
- }
- catch(Exception e){
- entityplayermp.addChatMessage(new ChatComponentText(curse + " " + Curse.availableCurses.size()));
- }
+ if(curse < Curse.getCurseList().size() && grade <= 2)
+ {
+ EntityEventHandler.addCurse(entityplayermp, playerInfo, curse, grade);
+ JewelrycraftMod.netWrapper.sendToServer(new PacketRequestPlayerInfo());
}
+ else if(curse >= Curse.getCurseList().size()) entityplayermp.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Curse ID exceedes the maximum value of " + (Curse.getCurseList().size() - 1)));
+ else entityplayermp.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Curse grade exceedes the maximum value of 2"));
+
}
}
@@ -111,13 +111,13 @@ public class JewelrycraftCommands extends CommandBase
if ("addCursePoints".toLowerCase().startsWith(ARG_LC)) MATCHES.add("addCursePoints");
if ("getCursePoints".toLowerCase().startsWith(ARG_LC)) MATCHES.add("getCursePoints");
if ("setCursePoints".toLowerCase().startsWith(ARG_LC)) MATCHES.add("setCursePoints");
- if ("setCursePoints".toLowerCase().startsWith(ARG_LC)) MATCHES.add("addModifier");
- if ("setCursePoints".toLowerCase().startsWith(ARG_LC)) MATCHES.add("addCurse");
+ if ("addModifier".toLowerCase().startsWith(ARG_LC)) MATCHES.add("addModifier");
+ if ("addCurse".toLowerCase().startsWith(ARG_LC)) MATCHES.add("addCurse");
}else if (astring.length == 2){
- if (!astring[0].equals("addModifier") && !astring[0].equals("addCurse")){
+ if (!astring[0].equals("addModifier")){
for(String un: MinecraftServer.getServer().getAllUsernames())
if (un.toLowerCase().startsWith(ARG_LC)) MATCHES.add(un);
- }else return getListOfStringsFromIterableMatchingLastWord(astring, Item.itemRegistry.getKeys());
+ }else if (!astring[0].equals("addCurse")) return getListOfStringsFromIterableMatchingLastWord(astring, Item.itemRegistry.getKeys());
}
return MATCHES.isEmpty() ? null : MATCHES;
}
diff --git a/java/darkknight/jewelrycraft/container/GuiTabBlocks.java b/java/darkknight/jewelrycraft/container/GuiTabBlocks.java
index c48aaa8..de50533 100644
--- a/java/darkknight/jewelrycraft/container/GuiTabBlocks.java
+++ b/java/darkknight/jewelrycraft/container/GuiTabBlocks.java
@@ -45,11 +45,11 @@ public class GuiTabBlocks extends GuiTab
{
case 1:
text = "This ore is extremely rare and can be found only between Y-level 5 and 8. It can only be mined using a diamond pickaxe.";
- Page.addImageTextPage(gui, gui.getLeft() + xPos, gui.getTop(), new ItemStack(BlockList.shadowOre), text, 90f);
+ Page.addImageTextPage(gui, gui.getLeft() + xPos, gui.getTop(), new ItemStack(BlockList.shadowOre), text, 90f, true);
break;
case 2:
text = "The Shadow Block is crafted using 9 shadow ingots. Magicians believed it held the ability to merge with the shadows. It becomes more transparent as it";
- Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, x, y, new ItemStack(BlockList.shadowBlock), new ItemStack(ItemList.shadowIngot), new ItemStack(ItemList.shadowIngot), new ItemStack(ItemList.shadowIngot), new ItemStack(ItemList.shadowIngot), new ItemStack(ItemList.shadowIngot), new ItemStack(ItemList.shadowIngot), new ItemStack(ItemList.shadowIngot), new ItemStack(ItemList.shadowIngot), new ItemStack(ItemList.shadowIngot));
+ Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, x, y, true, new ItemStack(BlockList.shadowBlock), new ItemStack(ItemList.shadowIngot), new ItemStack(ItemList.shadowIngot), new ItemStack(ItemList.shadowIngot), new ItemStack(ItemList.shadowIngot), new ItemStack(ItemList.shadowIngot), new ItemStack(ItemList.shadowIngot), new ItemStack(ItemList.shadowIngot), new ItemStack(ItemList.shadowIngot), new ItemStack(ItemList.shadowIngot));
break;
case 3:
text = "gets darker. If a comparator is attached to it, the output strength will be equal to the value of darkness it is in.";
@@ -57,7 +57,7 @@ public class GuiTabBlocks extends GuiTab
break;
case 4:
text = "The smelter is one of the first blocks needed to get started with Jewelrycraft. Requiring just some cobble and a couple buckets. It is required in order to";
- Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, x, y, new ItemStack(BlockList.smelter), new ItemStack(Blocks.cobblestone), new ItemStack(Items.bucket), new ItemStack(Blocks.cobblestone), new ItemStack(Blocks.cobblestone), null, new ItemStack(Blocks.cobblestone), new ItemStack(Blocks.cobblestone), new ItemStack(Items.lava_bucket), new ItemStack(Blocks.cobblestone));
+ Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, x, y, true, new ItemStack(BlockList.smelter), new ItemStack(Blocks.cobblestone), new ItemStack(Items.bucket), new ItemStack(Blocks.cobblestone), new ItemStack(Blocks.cobblestone), null, new ItemStack(Blocks.cobblestone), new ItemStack(Blocks.cobblestone), new ItemStack(Items.lava_bucket), new ItemStack(Blocks.cobblestone));
break;
case 5:
text = "melt ingots or even ores which can be made into rings, necklaces, bracelets or earrings. To use the block all you need to do is right click on it with any ore or ingot. It can melt multimple ingots/ores at a time. Crouch (default: Shift) + Right Click will remove all items";
@@ -69,7 +69,7 @@ public class GuiTabBlocks extends GuiTab
break;
case 7:
text = "The molder is a key piece in creating jewellery. You need to pour the molten metal out of the smelter somewhere. That somewhere is the";
- Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, x, y, new ItemStack(BlockList.molder), new ItemStack(Blocks.cobblestone), null, new ItemStack(Blocks.cobblestone), new ItemStack(Blocks.cobblestone), new ItemStack(Blocks.cobblestone), new ItemStack(Blocks.cobblestone));
+ Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, x, y, true, new ItemStack(BlockList.molder), new ItemStack(Blocks.cobblestone), null, new ItemStack(Blocks.cobblestone), new ItemStack(Blocks.cobblestone), new ItemStack(Blocks.cobblestone), new ItemStack(Blocks.cobblestone));
break;
case 8:
text = "molder. But before pouring the molten metal in it, you must first add a mold. You can do that by simply right clicking the block with the mold of your choice. If you want to get the mold out, simply crouch and Right Click it with an empty hand. Once you";
@@ -85,7 +85,7 @@ public class GuiTabBlocks extends GuiTab
del++;
if (del >= 300) del = 0;
if (values >= 4) values = 0;
- Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, x, y, new ItemStack(BlockList.jewelCraftingTable), new ItemStack(Blocks.planks, 1, values), new ItemStack(Blocks.planks, 1, values), new ItemStack(Blocks.planks, 1, values), new ItemStack(Blocks.cobblestone), null, new ItemStack(Blocks.cobblestone), new ItemStack(Blocks.cobblestone), null, new ItemStack(Blocks.cobblestone));
+ Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, x, y, true, new ItemStack(BlockList.jewelCraftingTable), new ItemStack(Blocks.planks, 1, values), new ItemStack(Blocks.planks, 1, values), new ItemStack(Blocks.planks, 1, values), new ItemStack(Blocks.cobblestone), null, new ItemStack(Blocks.cobblestone), new ItemStack(Blocks.cobblestone), null, new ItemStack(Blocks.cobblestone));
break;
case 11:
text = "can find a list with all possible gems in this guide). Crouch + Right Click to retreive placed items. Left Click the block to see the progress the crafting has made. Once the crafting is done, Left Click the block to get the item. You are able to recraft a";
@@ -97,7 +97,7 @@ public class GuiTabBlocks extends GuiTab
break;
case 13:
text = "This block can store any jewellery in it and activate their effects as it were a player. To do that simply right click the block with a jewellery. Crouch +";
- Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, x, y, new ItemStack(BlockList.jewelAltar), new ItemStack(Blocks.end_stone), new ItemStack(Blocks.wool, 1, 5), new ItemStack(Blocks.end_stone), new ItemStack(Blocks.nether_brick), new ItemStack(Blocks.wool, 1, 5), new ItemStack(Blocks.nether_brick), new ItemStack(Blocks.nether_brick), new ItemStack(Blocks.nether_brick), new ItemStack(Blocks.nether_brick));
+ Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, x, y, true, new ItemStack(BlockList.jewelAltar), new ItemStack(Blocks.end_stone), new ItemStack(Blocks.wool, 1, 5), new ItemStack(Blocks.end_stone), new ItemStack(Blocks.nether_brick), new ItemStack(Blocks.wool, 1, 5), new ItemStack(Blocks.nether_brick), new ItemStack(Blocks.nether_brick), new ItemStack(Blocks.nether_brick), new ItemStack(Blocks.nether_brick));
break;
case 14:
text = "Right Click to retreive the jewellery.";
@@ -105,7 +105,7 @@ public class GuiTabBlocks extends GuiTab
break;
case 15:
text = "The Storage Displayer, as the name suggests, can store a large amount (Up to: " + Integer.MAX_VALUE + ") of a single item/block placed in it. It will";
- Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, x, y, new ItemStack(BlockList.displayer), null, new ItemStack(Items.iron_ingot), null, new ItemStack(Items.iron_ingot), new ItemStack(Items.iron_ingot), new ItemStack(Items.iron_ingot), new ItemStack(Blocks.emerald_block), new ItemStack(Blocks.emerald_block), new ItemStack(Blocks.emerald_block));
+ Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, x, y, true, new ItemStack(BlockList.displayer), null, new ItemStack(Items.iron_ingot), null, new ItemStack(Items.iron_ingot), new ItemStack(Items.iron_ingot), new ItemStack(Items.iron_ingot), new ItemStack(Blocks.emerald_block), new ItemStack(Blocks.emerald_block), new ItemStack(Blocks.emerald_block));
break;
case 16:
text = "display all possible infromation about the object in it, such as the name, durability, enchantments etc. To store something in it simply right click with that object on it and the whole amount of items or blocks you are holding will be immediately stored inside.";
@@ -121,7 +121,7 @@ public class GuiTabBlocks extends GuiTab
break;
case 19:
text = "This mysterious shaped block is used in the ritual. The acient ones claimed it had the power to travel through worlds. They would use these to offer";
- Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, x, y, new ItemStack(BlockList.handPedestal), new ItemStack(Blocks.cobblestone_wall), new ItemStack(Blocks.cobblestone_wall), new ItemStack(Blocks.cobblestone_wall), null, new ItemStack(Blocks.stonebrick), null, new ItemStack(Blocks.stone_slab, 1, 5), new ItemStack(Blocks.stonebrick), new ItemStack(Blocks.stone_slab, 1, 5));
+ Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, x, y, true, new ItemStack(BlockList.handPedestal), new ItemStack(Blocks.cobblestone_wall), new ItemStack(Blocks.cobblestone_wall), new ItemStack(Blocks.cobblestone_wall), null, new ItemStack(Blocks.stonebrick), null, new ItemStack(Blocks.stone_slab, 1, 5), new ItemStack(Blocks.stonebrick), new ItemStack(Blocks.stone_slab, 1, 5));
break;
case 20:
text = "sacrifices to 'The Dark One' in exchange for unimaginable powers.";
@@ -129,12 +129,10 @@ public class GuiTabBlocks extends GuiTab
break;
case 21:
text = "The Cursed Eye is an ancient artifact also known as 'The Dark One's Eye'. It is part of the sacrifice ritual the ancient ones talk about. Be careful";
- Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, x, y, new ItemStack(BlockList.shadowEye), new ItemStack(Blocks.stonebrick), new ItemStack(Blocks.stained_hardened_clay, 1, 15), new ItemStack(Blocks.stonebrick), new ItemStack(Blocks.stained_hardened_clay, 1, 15), new ItemStack(Items.ender_eye), new ItemStack(Blocks.stained_hardened_clay, 1, 15), new ItemStack(Blocks.stonebrick), new ItemStack(Blocks.stained_hardened_clay, 1, 15), new ItemStack(Blocks.stonebrick));
+ Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, x, y, true, new ItemStack(BlockList.shadowEye), new ItemStack(Blocks.stonebrick), new ItemStack(Blocks.stained_hardened_clay, 1, 15), new ItemStack(Blocks.stonebrick), new ItemStack(Blocks.stained_hardened_clay, 1, 15), new ItemStack(Items.ender_eye), new ItemStack(Blocks.stained_hardened_clay, 1, 15), new ItemStack(Blocks.stonebrick), new ItemStack(Blocks.stained_hardened_clay, 1, 15), new ItemStack(Blocks.stonebrick));
break;
case 22:
- String link = "HERE";
- if (x >= gui.getLeft() + 130 && x <= gui.getLeft() + 160 && y >= gui.getTop() + 40 && y <= gui.getTop() + 50) link = EnumChatFormatting.DARK_BLUE + "HERE" + EnumChatFormatting.BLACK;
- text = "though, for He sees everything. To see how to create the ritual click " + link + " for a link with the pictures (will be part of the book later).";
+ text = "though, for He sees everything. To see how to create the ritual look in the Ritual tab.";
Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text);
break;
default:
diff --git a/java/darkknight/jewelrycraft/container/GuiTabGemsAndIngots.java b/java/darkknight/jewelrycraft/container/GuiTabGemsAndIngots.java
index aa41611..5f2bde0 100644
--- a/java/darkknight/jewelrycraft/container/GuiTabGemsAndIngots.java
+++ b/java/darkknight/jewelrycraft/container/GuiTabGemsAndIngots.java
@@ -42,7 +42,7 @@ public class GuiTabGemsAndIngots extends GuiTab
for(int i = (page - 1) * 9; i < page * 9; i++)
if (i < JewelrycraftUtil.gem.size()){
gui.getFont().drawString(EnumChatFormatting.DARK_BLUE + "\u00a7n" + "Gems", gui.getLeft() + xPos + 40, gui.getTop(), 0);
- gui.renderItem(JewelrycraftUtil.gem.get(i), gui.getLeft() + xPos + 10, gui.getTop() + 22 + 16 * (i - 9 * (page - 1)), 30f);
+ gui.renderItem(JewelrycraftUtil.gem.get(i), gui.getLeft() + xPos + 10, gui.getTop() + 22 + 16 * (i - 9 * (page - 1)), 30f, true, 0, 0, 0);
gui.getFont().drawString(String.format("%-1.18s", JewelrycraftUtil.gem.get(i).getDisplayName()), gui.getLeft() + xPos + 20, gui.getTop() + 12 + 16 * (i - 9 * (page - 1)), 0);
GL11.glDisable(GL11.GL_LIGHTING);
}
@@ -50,7 +50,7 @@ public class GuiTabGemsAndIngots extends GuiTab
for(int i = (page - 1) * 9; i < page * 9; i++)
if (i < JewelrycraftUtil.metal.size() && page > 0){
gui.getFont().drawString(EnumChatFormatting.DARK_BLUE + "\u00a7n" + "Ingots", gui.getLeft() + xPos + 40, gui.getTop(), 0);
- gui.renderItem(JewelrycraftUtil.metal.get(i).copy(), gui.getLeft() + xPos + 10, gui.getTop() + 22 + 16 * (i - 9 * (page - 1)), 30f);
+ gui.renderItem(JewelrycraftUtil.metal.get(i).copy(), gui.getLeft() + xPos + 10, gui.getTop() + 22 + 16 * (i - 9 * (page - 1)), 30f, true, 0, 0, 0);
gui.getFont().drawString(String.format("%-1.18s", JewelrycraftUtil.metal.get(i).copy().getDisplayName()), gui.getLeft() + xPos + 20, gui.getTop() + 12 + 16 * (i - 9 * (page - 1)), 0);
GL11.glDisable(GL11.GL_LIGHTING);
}
diff --git a/java/darkknight/jewelrycraft/container/GuiTabIntroduction.java b/java/darkknight/jewelrycraft/container/GuiTabIntroduction.java
new file mode 100644
index 0000000..f14c81e
--- /dev/null
+++ b/java/darkknight/jewelrycraft/container/GuiTabIntroduction.java
@@ -0,0 +1,52 @@
+package darkknight.jewelrycraft.container;
+
+import net.minecraft.init.Items;
+import net.minecraft.item.ItemStack;
+import darkknight.jewelrycraft.client.GuiGuide;
+import darkknight.jewelrycraft.item.ItemList;
+
+public class GuiTabIntroduction extends GuiTab
+{
+ public GuiTabIntroduction(int id)
+ {
+ super("Introduction", id);
+ }
+
+ @Override
+ public ItemStack getIcon()
+ {
+ return new ItemStack(ItemList.ring);
+ }
+
+ @Override
+ public void drawBackground(GuiGuide gui, int x, int y, int page)
+ {
+ String text = "";
+ int xPos = page % 2 == 0 ? 107 : -35;
+ switch(page)
+ {
+ case 1:
+ text = "Welcome to Jewelrycraft 2! This mod is about making jewelry that you can modify to your own will. To find out how to create a jewelry, please consult the book and look at the Smelter block. To add modifiers to it you need to perform a ritual. To see how to do that, look at the Cursed Eye";
+ Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text);
+ break;
+ case 2:
+ text = "block in this giude. Please be aware that even if you can add anything as a modifier and can have multiple modifiers on one jewelry, this mod is still in alpha and does not have that many modifiers implemtnted and currently don't have any different effects depending on";
+ Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text);
+ break;
+ case 3:
+ text = "the gem used. To see what modifiers are currently implemented, just look in the Modifiers tab located in this guide (it is the one with the blaze powder as an icon).";
+ Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text);
+ break;
+ }
+ }
+
+ @Override
+ public int getMaxPages()
+ {
+ return 4;
+ }
+
+ @Override
+ public void drawForeground(GuiGuide gui, int x, int y, int page)
+ {}
+}
diff --git a/java/darkknight/jewelrycraft/container/GuiTabItems.java b/java/darkknight/jewelrycraft/container/GuiTabItems.java
index 03069b9..85c7211 100644
--- a/java/darkknight/jewelrycraft/container/GuiTabItems.java
+++ b/java/darkknight/jewelrycraft/container/GuiTabItems.java
@@ -47,11 +47,11 @@ public class GuiTabItems extends GuiTab
{
case 1:
text = "Shadow ingots are obtained by smelting shadow ore. They are used in a few recipes and an important key for making some jewelry work.";
- Page.addSmeltingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text, x, y, new ItemStack(BlockList.shadowOre), new ItemStack(ItemList.shadowIngot));
+ Page.addSmeltingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text, x, y, true, new ItemStack(BlockList.shadowOre), new ItemStack(ItemList.shadowIngot));
break;
case 2:
text = "These gloves give you the chance to steal the trades those pesky Testificates have to offer. To use these simply open their gui at least once, then Crouch and";
- Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, x, y, new ItemStack(ItemList.thiefGloves), new ItemStack(ItemList.shadowIngot), null, new ItemStack(ItemList.shadowIngot), new ItemStack(Blocks.wool, 1, 15), new ItemStack(ItemList.shadowIngot), new ItemStack(Blocks.wool, 1, 15), new ItemStack(Blocks.wool, 1, 15), new ItemStack(ItemList.shadowIngot), new ItemStack(Blocks.wool, 1, 15));
+ Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, x, y, true, new ItemStack(ItemList.thiefGloves), new ItemStack(ItemList.shadowIngot), null, new ItemStack(ItemList.shadowIngot), new ItemStack(Blocks.wool, 1, 15), new ItemStack(ItemList.shadowIngot), new ItemStack(Blocks.wool, 1, 15), new ItemStack(Blocks.wool, 1, 15), new ItemStack(ItemList.shadowIngot), new ItemStack(Blocks.wool, 1, 15));
break;
case 3:
text = "right click on the them to hopefully steal the trades. If you traded with him before, then you have a chance of getting the traded emeralds back as well. This has a maximum of 10 uses before it breaks.";
@@ -59,23 +59,23 @@ public class GuiTabItems extends GuiTab
break;
case 4:
text = "In order to get the ingot back from the smelter you need a mold for it. However, this mold can't be used. It is too soft. It needs to be hardened in order for it to be used.";
- Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), true, text, x, y, new ItemStack(ItemList.clayMolds, 1, 0), new ItemStack(Items.clay_ball), new ItemStack(Items.clay_ball), new ItemStack(Items.clay_ball), new ItemStack(Items.clay_ball));
+ Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), true, text, x, y, true, new ItemStack(ItemList.clayMolds, 1, 0), new ItemStack(Items.clay_ball), new ItemStack(Items.clay_ball), new ItemStack(Items.clay_ball), new ItemStack(Items.clay_ball));
break;
case 5:
text = "To create a ring you need a mold for it. However, this one is too soft to be used. It needs to be hardened in order for it to be used.";
- Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, x, y, new ItemStack(ItemList.clayMolds, 1, 1), null, new ItemStack(Items.clay_ball), null, new ItemStack(Items.clay_ball), null, new ItemStack(Items.clay_ball), null, new ItemStack(Items.clay_ball), null);
+ Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, x, y, true, new ItemStack(ItemList.clayMolds, 1, 1), null, new ItemStack(Items.clay_ball), null, new ItemStack(Items.clay_ball), null, new ItemStack(Items.clay_ball), null, new ItemStack(Items.clay_ball), null);
break;
case 6:
text = "To create a necklace you need a mold for it. However, this one can't be used. It is too soft. It needs to be hardened in order for it to be used.";
- Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, x, y, new ItemStack(ItemList.clayMolds, 1, 2), new ItemStack(Items.clay_ball), null, new ItemStack(Items.clay_ball), new ItemStack(Items.clay_ball), null, new ItemStack(Items.clay_ball), null, new ItemStack(Items.clay_ball), null);
+ Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, x, y, true, new ItemStack(ItemList.clayMolds, 1, 2), new ItemStack(Items.clay_ball), null, new ItemStack(Items.clay_ball), new ItemStack(Items.clay_ball), null, new ItemStack(Items.clay_ball), null, new ItemStack(Items.clay_ball), null);
break;
case 7:
text = "To create a bracelet you need a mold for it. However, this one can't be used. It is too soft. It needs to be hardened in order for it to be used.";
- Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, x, y, new ItemStack(ItemList.clayMolds, 1, 3), new ItemStack(Items.clay_ball), new ItemStack(Items.clay_ball), new ItemStack(Items.clay_ball), new ItemStack(Items.clay_ball), null, new ItemStack(Items.clay_ball), new ItemStack(Items.clay_ball), new ItemStack(Items.clay_ball), new ItemStack(Items.clay_ball));
+ Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, x, y, true, new ItemStack(ItemList.clayMolds, 1, 3), new ItemStack(Items.clay_ball), new ItemStack(Items.clay_ball), new ItemStack(Items.clay_ball), new ItemStack(Items.clay_ball), null, new ItemStack(Items.clay_ball), new ItemStack(Items.clay_ball), new ItemStack(Items.clay_ball), new ItemStack(Items.clay_ball));
break;
case 8:
text = "To create a necklace you need a mold for it. However, this one can't be used. It is too soft. It needs to be hardened in order for it to be used.";
- Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, x, y, new ItemStack(ItemList.clayMolds, 1, 4), null, null, null, new ItemStack(Items.clay_ball), null, new ItemStack(Items.clay_ball), null, null, null);
+ Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, x, y, true, new ItemStack(ItemList.clayMolds, 1, 4), null, null, null, new ItemStack(Items.clay_ball), null, new ItemStack(Items.clay_ball), null, null, null);
break;
case 9:
if (del == 0) values++;
@@ -83,19 +83,19 @@ public class GuiTabItems extends GuiTab
if (del >= 300) del = 0;
if (values > 4) values = 0;
text = "By smelting a clay mold you get a harder version which can be used to create jewelry. Simply right click with this on a molder to attach it and you're ready to go.";
- Page.addSmeltingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text, x, y, new ItemStack(ItemList.clayMolds, 1, values), new ItemStack(ItemList.molds, 1, values));
+ Page.addSmeltingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text, x, y, true, new ItemStack(ItemList.clayMolds, 1, values), new ItemStack(ItemList.molds, 1, values));
break;
case 10:
text = "Crystals don't do much as of yet. They can be dyed in any color and used as gems to create a nice jewelry.";
- Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, x, y, new ItemStack(ItemList.crystal, 1, 15), null, new ItemStack(Blocks.glass), null, new ItemStack(Blocks.glass), null, new ItemStack(Blocks.glass), null, new ItemStack(Blocks.glass), null);
+ Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, x, y, true, new ItemStack(ItemList.crystal, 1, 15), null, new ItemStack(Blocks.glass), null, new ItemStack(Blocks.glass), null, new ItemStack(Blocks.glass), null, new ItemStack(Blocks.glass), null);
break;
case 11:
if (del == 0) values++;
del++;
if (del >= 300) del = 0;
if (values >= 15) values = 0;
- Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), true, text, x, y, new ItemStack(ItemList.crystal, 1, values), new ItemStack(Items.dye, 1, values), new ItemStack(ItemList.crystal, 1, 15));
- Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop() + 60, true, text, x, y, new ItemStack(ItemList.crystal, 1, 15), new ItemStack(Items.dye, 1, 15), new ItemStack(ItemList.crystal, 1, values));
+ Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), true, text, x, y, true, new ItemStack(ItemList.crystal, 1, values), new ItemStack(Items.dye, 1, values), new ItemStack(ItemList.crystal, 1, 15));
+ Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop() + 60, true, text, x, y, true, new ItemStack(ItemList.crystal, 1, 15), new ItemStack(Items.dye, 1, 15), new ItemStack(ItemList.crystal, 1, values));
break;
case 12:
if (del == 0) values++;
@@ -103,7 +103,7 @@ public class GuiTabItems extends GuiTab
if (del >= 300) del = 0;
if (values > 4) values = 0;
text = "It's this exact guide. I don't even know why you're reading this. I added this recipe in case you lose the original. Even if this is more helpful than NEI, I do suggest";
- Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), true, text, x, y, new ItemStack(ItemList.guide), new ItemStack(ItemList.molds, 1, values), new ItemStack(Items.book));
+ Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), true, text, x, y, true, new ItemStack(ItemList.guide), new ItemStack(ItemList.molds, 1, values), new ItemStack(Items.book));
break;
case 13:
String link = "HERE";
@@ -123,7 +123,7 @@ public class GuiTabItems extends GuiTab
if (values > JewelrycraftUtil.metal.size() - 1) values = 0;
JewelryNBT.addMetal(item, JewelrycraftUtil.metal.get(values).copy());
text = "These buckets contain molten metal. To obtain one simply Right Click a full Smelter to get a bucket. You can pour the metal, other than that it has no use. You can place the molten metal back in a Smelter by Right Clicking one with it.";
- Page.addImageTextPage(gui, gui.getLeft() + xPos, gui.getTop() - 5, item, text, 40f, 0, 0, true, 45, 10);
+ Page.addImageTextPage(gui, gui.getLeft() + xPos, gui.getTop() - 5, item, text, 40f, 0, 0, true, 45, 10, true);
break;
default:
;
diff --git a/java/darkknight/jewelrycraft/container/GuiTabModifiers.java b/java/darkknight/jewelrycraft/container/GuiTabModifiers.java
index b7d4d1b..89db85b 100644
--- a/java/darkknight/jewelrycraft/container/GuiTabModifiers.java
+++ b/java/darkknight/jewelrycraft/container/GuiTabModifiers.java
@@ -6,10 +6,7 @@ import darkknight.jewelrycraft.client.GuiGuide;
public class GuiTabModifiers extends GuiTab
{
-
- /**
- * @param id
- */
+ int maxPages;
public GuiTabModifiers(int id)
{
super("Modifiers", id);
@@ -43,10 +40,16 @@ public class GuiTabModifiers extends GuiTab
break;
case 2:
text = "The ancient ones talked about a rising fire in your heart. Fret do not, for flames do not burn, but water might sting a turn. Watch your step, do not be cocky, for its protection is a bit sloppy.";
- Page.addImageTextPage(gui, gui.getLeft() + xPos, gui.getTop(), new ItemStack(Items.blaze_powder), text, 40f);
+ Page.addImageTextPage(gui, gui.getLeft() + xPos, gui.getTop() - 7, new ItemStack(Items.blaze_powder), text, 40f, true);
+ break;
+ case 3:
+ text = "Light and swift as a feather can be good all together. Enemies miss and get confused, this power can be abused. Against an arrow you can't compare, so move around, don't just stare. Fire is your enemy and weakness is the penalty.";
+ Page.addImageTextPage(gui, gui.getLeft() + xPos, gui.getTop() - 7, new ItemStack(Items.feather), text, 40f, true);
+ break;
+ case 4:
+ text = "Endermen may tolerate you, end portals are near too, you may find ore that is true. But be careful, for the power may make you dizzy, blind you if you're a sissy, worsen your vision if you're unaware and shift positions everywhere.";
+ Page.addImageTextPage(gui, gui.getLeft() + xPos, gui.getTop() - 7, new ItemStack(Items.ender_eye), text, 40f, true);
break;
- default:
- ;
}
}
@@ -56,7 +59,7 @@ public class GuiTabModifiers extends GuiTab
@Override
public int getMaxPages()
{
- return 1;
+ return 4;
}
/**
diff --git a/java/darkknight/jewelrycraft/container/GuiTabRitual.java b/java/darkknight/jewelrycraft/container/GuiTabRitual.java
new file mode 100644
index 0000000..eed8072
--- /dev/null
+++ b/java/darkknight/jewelrycraft/container/GuiTabRitual.java
@@ -0,0 +1,125 @@
+package darkknight.jewelrycraft.container;
+
+import org.lwjgl.opengl.GL11;
+import net.minecraft.init.Blocks;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.EnumChatFormatting;
+import darkknight.jewelrycraft.block.BlockList;
+import darkknight.jewelrycraft.client.GuiGuide;
+
+public class GuiTabRitual extends GuiTab
+{
+ public GuiTabRitual(int id)
+ {
+ super("Ritual", id);
+ }
+
+ @Override
+ public ItemStack getIcon()
+ {
+ return new ItemStack(BlockList.handPedestal);
+ }
+
+ @Override
+ public void drawBackground(GuiGuide gui, int x, int y, int page)
+ {
+ int xPos = page % 2 == 0 ? 107 : -35;
+ switch(page)
+ {
+ case 1:
+ Page.drawText(gui, EnumChatFormatting.DARK_BLUE + "\u00a7n" + "Layer 1", gui.getLeft() + xPos + 35, gui.getTop() - 30);
+ for(int i = -1; i < 10; i++)
+ for(int j = 0; j < 11; j++)
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11*i, gui.getTop() + 11*j, x, y, new ItemStack(Blocks.air), 0, 0, 0);
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11*8, gui.getTop() + 11*1, x, y, new ItemStack(Blocks.stonebrick), 0, 0, 0);
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11*0, gui.getTop() + 11*1, x, y, new ItemStack(Blocks.stonebrick), 0, 0, 0);
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11*8, gui.getTop() + 11*9, x, y, new ItemStack(Blocks.stonebrick), 0, 0, 0);
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11*0, gui.getTop() + 11*9, x, y, new ItemStack(Blocks.stonebrick), 0, 0, 0);
+
+ //Top
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11*2, gui.getTop() + 11*1, x, y, new ItemStack(BlockList.handPedestal), 0, 45, 0);
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11*4, gui.getTop() + 11*0, x, y, new ItemStack(BlockList.handPedestal), 0, 0, 0);
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11*6, gui.getTop() + 11*1, x, y, new ItemStack(BlockList.handPedestal), 0, -45, 0);
+
+ //Left
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11*0, gui.getTop() + 11*3, x, y, new ItemStack(BlockList.handPedestal), 0, 45, 0);
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11*-1, gui.getTop() + 11*5, x, y, new ItemStack(BlockList.handPedestal), 0, 90, 0);
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11*0, gui.getTop() + 11*7, x, y, new ItemStack(BlockList.handPedestal), 0, 135, 0);
+
+ //Bottom
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11*2, gui.getTop() + 11*9, x, y, new ItemStack(BlockList.handPedestal), 0, 135, 0);
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11*4, gui.getTop() + 11*10, x, y, new ItemStack(BlockList.handPedestal), 0, 180, 0);
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11*6, gui.getTop() + 11*9, x, y, new ItemStack(BlockList.handPedestal), 0, 225, 0);
+
+ //Right
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11*8, gui.getTop() + 11*3, x, y, new ItemStack(BlockList.handPedestal), 0, -35, 0);
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11*9, gui.getTop() + 11*5, x, y, new ItemStack(BlockList.handPedestal), 0, 270, 0);
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11*8, gui.getTop() + 11*7, x, y, new ItemStack(BlockList.handPedestal), 0, 225, 0);
+
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11*2, gui.getTop() + 11*5, x, y, new ItemStack(Blocks.stonebrick), 0, 0, 0);
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11*4, gui.getTop() + 11*5, x, y, new ItemStack(BlockList.handPedestal), 0, 0, 0);
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11*6, gui.getTop() + 11*5, x, y, new ItemStack(Blocks.stonebrick), 0, 0, 0);
+ break;
+
+ case 2:
+ Page.drawText(gui, EnumChatFormatting.DARK_BLUE + "\u00a7n" + "Layer 2", gui.getLeft() + xPos + 35, gui.getTop() - 30);
+ for(int i = -1; i < 10; i++)
+ for(int j = 0; j < 11; j++)
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11*i, gui.getTop() + 11*j, x, y, new ItemStack(Blocks.air), 0, 0, 0);
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11*8, gui.getTop() + 11*1, x, y, new ItemStack(Blocks.stonebrick), 0, 0, 0);
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11*0, gui.getTop() + 11*1, x, y, new ItemStack(Blocks.stonebrick), 0, 0, 0);
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11*8, gui.getTop() + 11*9, x, y, new ItemStack(Blocks.stonebrick), 0, 0, 0);
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11*0, gui.getTop() + 11*9, x, y, new ItemStack(Blocks.stonebrick), 0, 0, 0);
+
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11*2, gui.getTop() + 11*5, x, y, new ItemStack(Blocks.stonebrick), 0, 0, 0);
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11*6, gui.getTop() + 11*5, x, y, new ItemStack(Blocks.stonebrick), 0, 0, 0);
+ break;
+
+ case 3:
+ Page.drawText(gui, EnumChatFormatting.DARK_BLUE + "\u00a7n" + "Layer 3", gui.getLeft() + xPos + 35, gui.getTop() - 30);
+ for(int i = -1; i < 10; i++)
+ for(int j = 0; j < 11; j++)
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11*i, gui.getTop() + 11*j, x, y, new ItemStack(Blocks.air), 0, 0, 0);
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11*8, gui.getTop() + 11*1, x, y, new ItemStack(BlockList.shadowBlock), 0, 0, 0);
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11*0, gui.getTop() + 11*1, x, y, new ItemStack(BlockList.shadowBlock), 0, 0, 0);
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11*8, gui.getTop() + 11*9, x, y, new ItemStack(BlockList.shadowBlock), 0, 0, 0);
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11*0, gui.getTop() + 11*9, x, y, new ItemStack(BlockList.shadowBlock), 0, 0, 0);
+
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11*2, gui.getTop() + 11*5, x, y, new ItemStack(Blocks.stonebrick), 0, 0, 0);
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11*6, gui.getTop() + 11*5, x, y, new ItemStack(Blocks.stonebrick), 0, 0, 0);
+ break;
+
+ case 4:
+ Page.drawText(gui, EnumChatFormatting.DARK_BLUE + "\u00a7n" + "Layer 4", gui.getLeft() + xPos + 35, gui.getTop() - 30);
+ for(int i = -1; i < 10; i++)
+ for(int j = 0; j < 11; j++)
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11*i, gui.getTop() + 11*j, x, y, new ItemStack(Blocks.air), 0, 0, 0);
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11*2, gui.getTop() + 11*5, x, y, new ItemStack(Blocks.stone_brick_stairs), 0, 90, 0);
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11*3, gui.getTop() + 11*5, x, y, new ItemStack(Blocks.stone_brick_stairs), 0, -90, 180);
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11*4, gui.getTop() + 11*5, x, y, new ItemStack(BlockList.shadowEye), 0, 90, 0);
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11*5, gui.getTop() + 11*5, x, y, new ItemStack(Blocks.stone_brick_stairs), 0, 90, 180);
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11*6, gui.getTop() + 11*5, x, y, new ItemStack(Blocks.stone_brick_stairs), 0, -90, 0);
+ break;
+
+ case 5:
+ Page.drawText(gui, EnumChatFormatting.DARK_BLUE + "\u00a7n" + "Layer 5", gui.getLeft() + xPos + 35, gui.getTop() - 30);
+ for(int i = -1; i < 10; i++)
+ for(int j = 0; j < 11; j++)
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11*i, gui.getTop() + 11*j, x, y, new ItemStack(Blocks.air), 0, 0, 0);
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11*3, gui.getTop() + 11*5, x, y, new ItemStack(Blocks.stone_slab, 1, 5), 0, 0, 0);
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11*4, gui.getTop() + 11*5, x, y, new ItemStack(Blocks.stone_slab, 1, 5), 0, 0, 0);
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11*5, gui.getTop() + 11*5, x, y, new ItemStack(Blocks.stone_slab, 1, 5), 0, 0, 0);
+ break;
+ }
+ }
+
+ @Override
+ public int getMaxPages()
+ {
+ return 5;
+ }
+
+ @Override
+ public void drawForeground(GuiGuide gui, int x, int y, int page)
+ {}
+}
diff --git a/java/darkknight/jewelrycraft/container/Page.java b/java/darkknight/jewelrycraft/container/Page.java
index bca21a8..beaa0bc 100644
--- a/java/darkknight/jewelrycraft/container/Page.java
+++ b/java/darkknight/jewelrycraft/container/Page.java
@@ -2,10 +2,12 @@ package darkknight.jewelrycraft.container;
import java.util.ArrayList;
import net.minecraft.client.Minecraft;
+import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
+import org.lwjgl.opengl.GL12;
import darkknight.jewelrycraft.client.GuiGuide;
public class Page
@@ -22,7 +24,7 @@ public class Page
* @param mouseY
* @param items
*/
- public static void addCraftingRecipeTextPage(GuiGuide gui, int x, int y, boolean isSmall, String text, int mouseX, int mouseY, ItemStack ... items)
+ public static void addCraftingRecipeTextPage(GuiGuide gui, int x, int y, boolean isSmall, String text, int mouseX, int mouseY, boolean rotate, ItemStack ... items)
{
y += 5;
GL11.glEnable(GL11.GL_BLEND);
@@ -33,12 +35,12 @@ public class Page
ArrayList<String> name = new ArrayList<String>();
if (isSmall){
gui.drawTexturedModalRect(x, y + 10, 145, 54, 111, 46);
- gui.renderItem(items[0], x + 89, y + 22 + 10, 30f);
+ gui.renderItem(items[0], x + 89, y + 22 + 10, 30f, rotate, 0, 0, 0);
for(int i = 1; i <= 4; i++)
if (items.length > i && items[i] != null){
int posX = x + 8 + (i - 1) % 2 * 22;
int posY = y + 26 + (i - 1) / 2 * 22;
- gui.renderItem(items[i], posX, posY, 30f);
+ gui.renderItem(items[i], posX, posY, 30f, rotate, 0, 0, 0);
name.add(items[i].getDisplayName());
if (mouseX >= posX - 8 && mouseX <= posX + 8 && mouseY >= posY - 16 && mouseY <= posY) gui.drawHoverString(name, posX - 20, posY - 14);
name.removeAll(name);
@@ -47,12 +49,12 @@ public class Page
drawText(gui, text, x, y + 25);
}else{
gui.drawTexturedModalRect(x, y + 12, 145, 0, 111, 54);
- gui.renderItem(items[0], x + 91, y + 28 + 10, 30f);
+ gui.renderItem(items[0], x + 91, y + 28 + 10, 30f, rotate, 0, 0, 0);
for(int i = 1; i <= 9; i++)
if (items.length > i && items[i] != null){
int posX = x + 8 + (i - 1) % 3 * 19;
int posY = y + 22 + (i - 1) / 3 * 17;
- gui.renderItem(items[i], posX, posY, 30f);
+ gui.renderItem(items[i], posX, posY, 30f, rotate, 0, 0, 0);
name.add(items[i].getDisplayName());
if (mouseX >= posX - 8 && mouseX <= posX + 8 && mouseY >= posY - 10 && mouseY <= posY) gui.drawHoverString(name, posX - 20, posY - 12);
name.removeAll(name);
@@ -73,7 +75,7 @@ public class Page
* @param mouseY
* @param items
*/
- public static void addSmeltingRecipeTextPage(GuiGuide gui, int x, int y, String text, int mouseX, int mouseY, ItemStack ... items)
+ public static void addSmeltingRecipeTextPage(GuiGuide gui, int x, int y, String text, int mouseX, int mouseY, boolean rotate, ItemStack ... items)
{
ArrayList<String> name = new ArrayList<String>();
gui.getFont().drawString(EnumChatFormatting.DARK_BLUE + "\u00a7n" + items[1].getDisplayName(), x + 30 - items[0].getDisplayName().length() / 2, y + 2, 0);
@@ -81,13 +83,13 @@ public class Page
Minecraft.getMinecraft().getTextureManager().bindTexture(pageFlipped);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
- gui.drawTexturedModalRect(x, y + 10, 145, 100, 111, 56);
- gui.renderItem(items[0], x + 13, y + 20 + 10, 35f);
+ gui.drawTexturedModalRect(x, y + 10, 145, 100, 111, 52);
+ gui.renderItem(items[0], x + 13, y + 20 + 10, 35f, rotate, 0, 0, 0);
name.add(items[0].getDisplayName());
if (mouseX >= x && mouseX <= x + 20 && mouseY >= y + 20 && mouseY <= y + 20 + 16) gui.drawHoverString(name, x, y + 20);
name.removeAll(name);
GL11.glDisable(GL11.GL_LIGHTING);
- gui.renderItem(items[1], x + 77, y + 28 + 10, 35f);
+ gui.renderItem(items[1], x + 77, y + 28 + 10, 35f, rotate, 0, 0, 0);
drawText(gui, text, x, y + 30);
GL11.glColor4f(1, 1, 1, 1);
GL11.glDisable(GL11.GL_BLEND);
@@ -101,15 +103,34 @@ public class Page
* @param text
* @param size
*/
- public static void addImageTextPage(GuiGuide gui, int x, int y, ItemStack item, String text, float size)
+ public static void addImageTextPage(GuiGuide gui, int x, int y, ItemStack item, String text, float size, boolean rotate)
{
y += 5;
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
- gui.getFont().drawString(EnumChatFormatting.DARK_BLUE + "\u00a7n" + item.getDisplayName(), x + Math.abs(70 - gui.getFont().getStringWidth(item.getDisplayName()) / 2) - 10, y + 2, 0);
+ gui.getFont().drawString(EnumChatFormatting.DARK_BLUE + "\u00a7n" + item.getDisplayName(), x + Math.abs(70 - gui.getFont().getStringWidth(item.getDisplayName()) / 2) - 10, y + (int)size/5, 0);
GL11.glColor4f(1, 1, 1, 1);
- gui.renderItem(item, x + 13, y + 18, size);
- drawText(gui, text, x, y - (int)(200 / size));
+ gui.renderItem(item, x + 13, y + 18, size, rotate, 0, 0, 0);
+ drawText(gui, text, x - 2, y - (int)(250 / size));
+ GL11.glDisable(GL11.GL_BLEND);
+ }
+
+ public static void addSlotItem(GuiGuide gui, int x, int y, int mouseX, int mouseY, ItemStack item, float xRot, float yRot, float zRot)
+ {
+ ArrayList<String> name = new ArrayList<String>();
+ GL11.glColor4f(1, 1, 1, 1);
+ Minecraft.getMinecraft().getTextureManager().bindTexture(pageFlipped);
+ GL11.glEnable(GL11.GL_BLEND);
+ GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
+ gui.drawTexturedModalRect(x + 9, y + 19, 148, 153, 12, 12);
+ if(item.getItem() != null){
+ name.add(item.getDisplayName());
+ if (mouseX >= x + 10 && mouseX <= x + 20 && mouseY >= y + 20 && mouseY <= y + 30) gui.drawHoverString(name, x, y + 10);
+ name.removeAll(name);
+ }
+ GL11.glDisable(GL11.GL_LIGHTING);
+ GL11.glColor4f(1, 1, 1, 1);
+ if(item.getItem() != null) gui.renderItem(item, x + 15, y + 25, 40f, false, xRot, yRot, zRot);
GL11.glDisable(GL11.GL_BLEND);
}
@@ -126,14 +147,15 @@ public class Page
* @param imgX
* @param imgY
*/
- public static void addImageTextPage(GuiGuide gui, int x, int y, ItemStack item, String text, float size, int txtX, int txtY, boolean showName, int imgX, int imgY)
+ public static void addImageTextPage(GuiGuide gui, int x, int y, ItemStack item, String text, float size, int txtX, int txtY, boolean showName, int imgX, int imgY, boolean rotate)
{
y += 5;
GL11.glEnable(GL11.GL_BLEND);
+ GL11.glEnable(GL12.GL_RESCALE_NORMAL);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
if (showName) gui.getFont().drawString(EnumChatFormatting.DARK_BLUE + "\u00a7n" + item.getDisplayName(), x + Math.abs(70 - gui.getFont().getStringWidth(item.getDisplayName()) / 2) - 10, y + 2, 0);
GL11.glColor4f(1, 1, 1, 1);
- gui.renderItem(item, x + 13 + imgX, y + 18 + imgY, size);
+ gui.renderItem(item, x + 13 + imgX, y + 18 + imgY, size, rotate, 0, 0, 0);
drawText(gui, text, x + txtX, y + txtY);
GL11.glDisable(GL11.GL_BLEND);
}
diff --git a/java/darkknight/jewelrycraft/curses/Curse.java b/java/darkknight/jewelrycraft/curses/Curse.java
index 08421ef..f833542 100644
--- a/java/darkknight/jewelrycraft/curses/Curse.java
+++ b/java/darkknight/jewelrycraft/curses/Curse.java
@@ -1,6 +1,8 @@
package darkknight.jewelrycraft.curses;
import java.util.ArrayList;
+import java.util.Random;
+import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
@@ -8,6 +10,7 @@ public class Curse
{
protected int id, texturepack;
protected String name, description;
+ protected Random rand = new Random();
private static ArrayList<Curse> curses = new ArrayList<Curse>();
public static ArrayList<Curse> availableCurses = new ArrayList<Curse>();
@@ -69,6 +72,34 @@ public class Curse
*/
public void action(World world, EntityPlayer player)
{}
+
+ /**
+ * @param world
+ * @param player
+ */
+ public void deathAction(World world, EntityPlayer player)
+ {}
+
+ /**
+ * @param world
+ * @param player
+ */
+ public void respawnAction(World world, EntityPlayer player)
+ {}
+
+ /**
+ * @param world
+ * @param player
+ */
+ public void attackedAction(World world, EntityPlayer player)
+ {}
+
+ /**
+ * @param world
+ * @param player
+ */
+ public void attackedByPlayerAction(World world, EntityPlayer player, Entity target)
+ {}
public boolean itemToss()
{
diff --git a/java/darkknight/jewelrycraft/curses/CurseFlamingSoul.java b/java/darkknight/jewelrycraft/curses/CurseFlamingSoul.java
index 7c1104c..8718524 100644
--- a/java/darkknight/jewelrycraft/curses/CurseFlamingSoul.java
+++ b/java/darkknight/jewelrycraft/curses/CurseFlamingSoul.java
@@ -13,7 +13,7 @@ public class CurseFlamingSoul extends Curse
@Override
public void action(World world, EntityPlayer player)
{
- if (!player.isBurning()) player.setFire(60);
+ if (!player.isBurning() && rand.nextInt(20) == 0) player.setFire(5);
}
public String getDescription()
diff --git a/java/darkknight/jewelrycraft/curses/CurseInfamy.java b/java/darkknight/jewelrycraft/curses/CurseInfamy.java
new file mode 100644
index 0000000..aa815f7
--- /dev/null
+++ b/java/darkknight/jewelrycraft/curses/CurseInfamy.java
@@ -0,0 +1,41 @@
+package darkknight.jewelrycraft.curses;
+
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.EntityLiving;
+import net.minecraft.entity.SharedMonsterAttributes;
+import net.minecraft.entity.monster.EntityMob;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.world.World;
+import darkknight.jewelrycraft.damage.DamageSourceList;
+import darkknight.jewelrycraft.entities.EntityHalfHeart;
+import darkknight.jewelrycraft.entities.EntityHeart;
+import darkknight.jewelrycraft.util.JewelrycraftUtil;
+import darkknight.jewelrycraft.util.PlayerUtils;
+
+public class CurseInfamy extends Curse
+{
+ public CurseInfamy(int id, String name, int text)
+ {
+ super(id, name, text);
+ }
+
+ @Override
+ public void attackedByPlayerAction(World world, EntityPlayer player, Entity target)
+ {
+ if (rand.nextInt(5) == 0 && !world.isRemote && !(target instanceof EntityMob) && target instanceof EntityLiving && !(target instanceof EntityHeart) && !(target instanceof EntityHalfHeart) && target.canAttackWithItem()){
+ NBTTagCompound playerInfo = PlayerUtils.getModPlayerPersistTag(player, "Jewelrycraft");
+ if (playerInfo.getFloat("BlackHeart") < 20F) playerInfo.setFloat("BlackHeart", playerInfo.getFloat("BlackHeart") + 1.0F);
+ if (player.getMaxHealth() >= 3F){
+ player.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(player.getMaxHealth() - 1.0F);
+ player.setHealth(player.getHealth() - 1.0F);
+ }
+ JewelrycraftUtil.addCursePoints(player, 10);
+ }
+ }
+
+ public String getDescription()
+ {
+ return "What have you done?!";
+ }
+}
diff --git a/java/darkknight/jewelrycraft/curses/CurseList.java b/java/darkknight/jewelrycraft/curses/CurseList.java
index 4a46232..4e796ff 100644
--- a/java/darkknight/jewelrycraft/curses/CurseList.java
+++ b/java/darkknight/jewelrycraft/curses/CurseList.java
@@ -5,7 +5,7 @@ import darkknight.jewelrycraft.lib.Reference;
public class CurseList
{
- private static Curse rotten, flaming, blind, greed;
+ private static Curse rotten, flaming, blind, greed, infamy;
private static boolean isInitialized = false;
/**
@@ -18,6 +18,7 @@ public class CurseList
flaming = new CurseFlamingSoul(1, Reference.MODNAME + ":" + "Flaming Soul", 0);
greed = new CurseGreed(2, Reference.MODNAME + ":" + "Greed", 0);
blind = new CurseBlind(3, Reference.MODNAME + ":" + "Blind", 0);
+ infamy = new CurseInfamy(4, Reference.MODNAME + ":" + "Infamy", 0);
isInitialized = true;
}
}
diff --git a/java/darkknight/jewelrycraft/damage/DamageSourceList.java b/java/darkknight/jewelrycraft/damage/DamageSourceList.java
index 915ec9e..019b036 100644
--- a/java/darkknight/jewelrycraft/damage/DamageSourceList.java
+++ b/java/darkknight/jewelrycraft/damage/DamageSourceList.java
@@ -8,7 +8,7 @@ import cpw.mods.fml.common.event.FMLPostInitializationEvent;
*/
public class DamageSourceList
{
- public static DamageSource shadows, weak, blackHeart, basic;
+ public static DamageSource shadows, weak, blackHeart;
private static boolean isInitialized = false;
/**
@@ -20,7 +20,6 @@ public class DamageSourceList
shadows = new DamageSource("shadows").setDamageBypassesArmor().setDamageIsAbsolute();
blackHeart = new DamageSource("blackHeart").setDamageBypassesArmor().setDamageIsAbsolute();
weak = new DamageSource("weak");
- basic = new DamageSource("basic").setDifficultyScaled();
isInitialized = true;
}
}
diff --git a/java/darkknight/jewelrycraft/effects/EffectBlazePowder.java b/java/darkknight/jewelrycraft/effects/EffectBlazePowder.java
index efec29b..949d0d8 100644
--- a/java/darkknight/jewelrycraft/effects/EffectBlazePowder.java
+++ b/java/darkknight/jewelrycraft/effects/EffectBlazePowder.java
@@ -6,6 +6,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.DamageSource;
import darkknight.jewelrycraft.item.ItemBracelet;
@@ -13,6 +14,7 @@ import darkknight.jewelrycraft.item.ItemEarrings;
import darkknight.jewelrycraft.item.ItemNecklace;
import darkknight.jewelrycraft.item.ItemRing;
import darkknight.jewelrycraft.util.JewelryNBT;
+import darkknight.jewelrycraft.util.PlayerUtils;
public class EffectBlazePowder extends ModifierEffects
{
@@ -33,15 +35,19 @@ public class EffectBlazePowder extends ModifierEffects
if (player.isInWater()) player.attackEntityFrom(DamageSource.drown, 1f);
}
//Negative for bracelet
- if (jewelry instanceof ItemBracelet && pos != -1) if(player.isInWater()) player.fallDistance *= 0.8F;
+ if (jewelry instanceof ItemBracelet && pos != -1 && player.isInWater()){
+ player.motionX *= 0.6D;
+ player.motionY *= 0.6D;
+ player.motionZ *= 0.6D;
+ player.motionY -= 0.02D;
+ if (player.isCollidedHorizontally) player.motionY = 0.30000001192092896D;
+ }
//Negative for earrings
if (jewelry instanceof ItemEarrings && pos != -1){
if (player.getAir() >= 300) player.setAir(player.getAir() / 2);
- else player.setAir(player.getAir() - 1);
-
- }
-
+ else player.setAir(player.getAir() - 1);
+ }
}
@Override
@@ -56,31 +62,34 @@ public class EffectBlazePowder extends ModifierEffects
@Override
public boolean onPlayerAttackedCacellable(ItemStack item, EntityPlayer player, DamageSource source, Item jewelry, float amount)
{
- int pos = JewelryNBT.doesModifierExist(item, modifier);
- if (jewelry instanceof ItemEarrings && pos != -1 && player.worldObj.rand.nextInt(4) == 0) if (source == DamageSource.lava || source == DamageSource.inFire || source == DamageSource.onFire){
- //Positive for earrings
- int stackSize = JewelryNBT.modifier(item).get(pos).stackSize;
- player.heal((float)(0.05 * stackSize));
- return true;
- }
- //Positive for bracelet
- if (jewelry instanceof ItemBracelet && pos != -1) if (source == DamageSource.inFire || source == DamageSource.onFire || source == DamageSource.lava && player.worldObj.isMaterialInBB(AxisAlignedBB.getBoundingBox(player.boundingBox.minX, player.boundingBox.minY, player.boundingBox.minZ, player.boundingBox.maxX, player.boundingBox.maxY - 0.7, player.boundingBox.maxZ), Material.lava) && !player.worldObj.isMaterialInBB(AxisAlignedBB.getBoundingBox(player.boundingBox.minX, player.boundingBox.minY + 0.9, player.boundingBox.minZ, player.boundingBox.maxX, player.boundingBox.maxY, player.boundingBox.maxZ), Material.lava)) return true;
+// int pos = JewelryNBT.doesModifierExist(item, modifier);
+// if (jewelry instanceof ItemEarrings && pos != -1 && rand.nextInt(4) == 0) if (source == DamageSource.lava || source == DamageSource.inFire || source == DamageSource.onFire){
+// //Positive for earrings
+// int stackSize = JewelryNBT.modifier(item).get(pos).stackSize;
+// player.heal((float)(0.05 * stackSize));
+// return true;
+// }
+// //Positive for bracelet
+// if (jewelry instanceof ItemBracelet && pos != -1) if (source == DamageSource.inFire || source == DamageSource.onFire || source == DamageSource.lava && player.worldObj.isMaterialInBB(AxisAlignedBB.getBoundingBox(player.boundingBox.minX, player.boundingBox.minY, player.boundingBox.minZ, player.boundingBox.maxX, player.boundingBox.maxY - 0.7, player.boundingBox.maxZ), Material.lava) && !player.worldObj.isMaterialInBB(AxisAlignedBB.getBoundingBox(player.boundingBox.minX, player.boundingBox.minY + 0.9, player.boundingBox.minZ, player.boundingBox.maxX, player.boundingBox.maxY, player.boundingBox.maxZ), Material.lava)) return true;
return false;
}
- @Override
public void onEntityAttacked(ItemStack item, EntityPlayer player, Entity target, Item jewelry, float amount)
{
+
}
- @Override
public void onPlayerAttacked(ItemStack item, EntityPlayer player, DamageSource source, Item jewelry, float amount)
{
- }
-
- @Override
- public boolean onPlayerFall(ItemStack item, EntityPlayer player, Item jewelry)
- {
- return false;
+ int pos = JewelryNBT.doesModifierExist(item, modifier);
+ NBTTagCompound playerInfo = PlayerUtils.getModPlayerPersistTag(player, "Jewelrycraft");
+ if (jewelry instanceof ItemEarrings && pos != -1 && rand.nextInt(4) == 0) if (source == DamageSource.lava || source == DamageSource.inFire || source == DamageSource.onFire){
+ //Positive for earrings
+ int stackSize = JewelryNBT.modifier(item).get(pos).stackSize;
+ player.heal((float)(0.05 * stackSize));
+ playerInfo.setBoolean("negateDamage", true);
+ }
+ //Positive for bracelet
+ if (jewelry instanceof ItemBracelet && pos != -1) if (source == DamageSource.inFire || source == DamageSource.onFire || source == DamageSource.lava && player.worldObj.isMaterialInBB(AxisAlignedBB.getBoundingBox(player.boundingBox.minX, player.boundingBox.minY, player.boundingBox.minZ, player.boundingBox.maxX, player.boundingBox.maxY - 0.7, player.boundingBox.maxZ), Material.lava) && !player.worldObj.isMaterialInBB(AxisAlignedBB.getBoundingBox(player.boundingBox.minX, player.boundingBox.minY + 0.9, player.boundingBox.minZ, player.boundingBox.maxX, player.boundingBox.maxY, player.boundingBox.maxZ), Material.lava)) playerInfo.setBoolean("negateDamage", true);
}
}
diff --git a/java/darkknight/jewelrycraft/effects/EffectEnderEye.java b/java/darkknight/jewelrycraft/effects/EffectEnderEye.java
index 886b18d..eb7bef7 100644
--- a/java/darkknight/jewelrycraft/effects/EffectEnderEye.java
+++ b/java/darkknight/jewelrycraft/effects/EffectEnderEye.java
@@ -1,16 +1,32 @@
package darkknight.jewelrycraft.effects;
-import net.minecraft.entity.Entity;
+import net.minecraft.block.BlockOre;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.settings.GameSettings.Options;
+import net.minecraft.entity.monster.EntityEnderman;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
+import net.minecraft.potion.Potion;
+import net.minecraft.potion.PotionEffect;
+import net.minecraft.util.ChatComponentText;
import net.minecraft.util.DamageSource;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.util.Vec3;
+import net.minecraft.world.ChunkPosition;
+import net.minecraft.world.biome.BiomeGenBase;
+import cpw.mods.fml.relauncher.ReflectionHelper;
+import darkknight.jewelrycraft.item.ItemBracelet;
+import darkknight.jewelrycraft.item.ItemEarrings;
import darkknight.jewelrycraft.item.ItemNecklace;
+import darkknight.jewelrycraft.item.ItemRing;
import darkknight.jewelrycraft.util.JewelryNBT;
public class EffectEnderEye extends ModifierEffects
{
+ private boolean originalVD = false;
+ private float originalViewDistance;
public EffectEnderEye()
{
super(new ItemStack(Items.ender_eye));
@@ -20,34 +36,44 @@ public class EffectEnderEye extends ModifierEffects
public void action(ItemStack item, EntityPlayer player, Item jewelry)
{
int pos = JewelryNBT.doesModifierExist(item, modifier);
- if (jewelry instanceof ItemNecklace && pos != -1) ;
- }
-
- @Override
- public boolean onEntityAttackedCacellable(ItemStack item, EntityPlayer player, Entity target, Item jewelry, float amount)
- {
- return false;
- }
-
- @Override
- public boolean onPlayerAttackedCacellable(ItemStack item, EntityPlayer player, DamageSource source, Item jewelry, float amount)
- {
- return false;
- }
-
- @Override
- public void onEntityAttacked(ItemStack item, EntityPlayer player, Entity target, Item jewelry, float amount)
- {
+ if (jewelry instanceof ItemEarrings && pos != -1 && !player.worldObj.isRemote){
+ for(Object e: player.worldObj.getEntitiesWithinAABB(EntityEnderman.class, player.boundingBox.expand(100D, 0D, 100D))){
+ EntityEnderman enderman = (EntityEnderman)e;
+ ReflectionHelper.setPrivateValue(EntityEnderman.class, enderman, -1, "stareTimer", "field_70826_g");
+ Vec3 vec3 = player.getLook(1.0F).normalize();
+ Vec3 vec31 = Vec3.createVectorHelper(enderman.posX - player.posX, enderman.boundingBox.minY + (double)(enderman.height / 2.0F) - (player.posY + (double)player.getEyeHeight()), enderman.posZ - player.posZ);
+ double d0 = vec31.lengthVector();
+ vec31 = vec31.normalize();
+ double d1 = vec3.dotProduct(vec31);
+ if (d1 > 1.0D - 0.025D / d0 && player.canEntityBeSeen(enderman)){
+ enderman.setTarget(null);
+ if (!player.isPotionActive(Potion.confusion) || player.getActivePotionEffect(Potion.confusion).getDuration() <= 80) player.addPotionEffect(new PotionEffect(Potion.confusion.id, 300, 2));
+ }
+ }
+ }
+ if (jewelry instanceof ItemNecklace && pos != -1 && !player.worldObj.isRemote){
+ ChunkPosition chunkposition = player.worldObj.findClosestStructure("Stronghold", (int)player.posX, (int)player.posY, (int)player.posZ);
+ if (chunkposition != null){
+ Minecraft.getMinecraft().thePlayer.motionX += 0.01D * Math.signum((double)chunkposition.chunkPosX - player.posX);
+ Minecraft.getMinecraft().thePlayer.motionZ += 0.01D * Math.signum((double)chunkposition.chunkPosZ - player.posZ);
+ }
+ }
+ if (jewelry instanceof ItemBracelet && pos != -1 && !player.worldObj.isRemote && player.worldObj.getBiomeGenForCoords((int)player.posX, (int)player.posZ) == BiomeGenBase.sky && (!player.isPotionActive(Potion.moveSpeed) || player.getActivePotionEffect(Potion.moveSpeed).getDuration() < 30)) player.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 140, 1));
+ if (jewelry instanceof ItemBracelet && pos != -1 && !player.worldObj.isRemote && rand.nextInt(500) == 15) player.setPositionAndUpdate(player.posX + rand.nextInt(30)*(rand.nextBoolean()?-1:1), player.posY, player.posZ + rand.nextInt(30)*(rand.nextBoolean()?-1:1));
+ if (jewelry instanceof ItemRing && pos != -1 && rand.nextInt(200) == 12){
+ Minecraft.getMinecraft().gameSettings.setOptionFloatValue(Options.RENDER_DISTANCE, 1.0F);
+ for(int i = (int)player.posX - 2; i <= (int)player.posX + 2; i++)
+ for(int j = (int)player.posY - 2; j <= (int)player.posY + 2; j++)
+ for(int k = (int)player.posZ - 2; k <= (int)player.posZ + 2; k++)
+ if(player.worldObj.getBlock(i, j, k) instanceof BlockOre)
+ player.addChatComponentMessage(new ChatComponentText(EnumChatFormatting.GRAY + "You sense some " + player.worldObj.getBlock(i, j, k).getLocalizedName() + " around you."));
+ }
}
@Override
public void onPlayerAttacked(ItemStack item, EntityPlayer player, DamageSource source, Item jewelry, float amount)
{
- }
-
- @Override
- public boolean onPlayerFall(ItemStack item, EntityPlayer player, Item jewelry)
- {
- return false;
+ int pos = JewelryNBT.doesModifierExist(item, modifier);
+ if (jewelry instanceof ItemNecklace && pos != -1 && !player.worldObj.isRemote) player.addPotionEffect(new PotionEffect(Potion.blindness.id, 100, 1));
}
}
diff --git a/java/darkknight/jewelrycraft/effects/EffectFeather.java b/java/darkknight/jewelrycraft/effects/EffectFeather.java
index b331044..2acaf76 100644
--- a/java/darkknight/jewelrycraft/effects/EffectFeather.java
+++ b/java/darkknight/jewelrycraft/effects/EffectFeather.java
@@ -1,16 +1,25 @@
package darkknight.jewelrycraft.effects;
+import java.util.Iterator;
+import java.util.List;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.projectile.EntityArrow;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.util.AxisAlignedBB;
+import net.minecraft.util.ChatComponentText;
import net.minecraft.util.DamageSource;
+import net.minecraft.util.EnumChatFormatting;
import darkknight.jewelrycraft.damage.DamageSourceList;
import darkknight.jewelrycraft.item.ItemBracelet;
import darkknight.jewelrycraft.item.ItemEarrings;
import darkknight.jewelrycraft.item.ItemNecklace;
+import darkknight.jewelrycraft.item.ItemRing;
import darkknight.jewelrycraft.util.JewelryNBT;
+import darkknight.jewelrycraft.util.PlayerUtils;
public class EffectFeather extends ModifierEffects
{
@@ -23,47 +32,57 @@ public class EffectFeather extends ModifierEffects
public void action(ItemStack item, EntityPlayer player, Item jewelry)
{
int pos = JewelryNBT.doesModifierExist(item, modifier);
- // Positive necklace
- if (jewelry instanceof ItemNecklace && pos != -1 && !player.onGround){
- player.motionY = -10D;
- System.out.println(player.motionY);
+ NBTTagCompound playerInfo = PlayerUtils.getModPlayerPersistTag(player, "Jewelrycraft");
+ // Positive earrings
+ if (jewelry instanceof ItemEarrings && pos != -1){
+ AxisAlignedBB axisalignedbb = player.boundingBox.expand(1.0D, 1.0D, 1.0D);
+ List list = player.worldObj.getEntitiesWithinAABB(EntityArrow.class, axisalignedbb);
+ if (!player.worldObj.isRemote && list != null && !list.isEmpty()){
+ Iterator iterator = list.iterator();
+ while (iterator.hasNext()){
+ EntityArrow arrow = (EntityArrow)iterator.next();
+ if (rand.nextInt(3) == 0 && (arrow.shootingEntity == null || !(arrow.shootingEntity.equals(player)) || arrow.canBePickedUp == 0)) arrow.setDead();
+ }
+ }
}
- }
-
- @Override
- public boolean onEntityAttackedCacellable(ItemStack item, EntityPlayer player, Entity target, Item jewelry, float amount)
- {
- int pos = JewelryNBT.doesModifierExist(item, modifier);
- // if (jewelry instanceof ItemNecklace && pos != -1) player.fallDistance *= 0.5F;
- if (jewelry instanceof ItemBracelet && pos != -1) return true;
- return false;
- }
-
- @Override
- public boolean onPlayerAttackedCacellable(ItemStack item, EntityPlayer player, DamageSource source, Item jewelry, float amount)
- {
- int pos = JewelryNBT.doesModifierExist(item, modifier);
// Positive bracelet
- if (jewelry instanceof ItemBracelet && pos != -1) return true;
- return true;
+ if (jewelry instanceof ItemBracelet && pos != -1){
+ if (player.motionY < 0) player.motionY *= 0.6D;
+ player.setAIMoveSpeed(player.getAIMoveSpeed() / 2);
+ player.fallDistance = 0F;
+ }
}
@Override
public void onEntityAttacked(ItemStack item, EntityPlayer player, Entity target, Item jewelry, float amount)
- {}
-
- @Override
- public void onPlayerAttacked(ItemStack item, EntityPlayer player, DamageSource source, Item jewelry, float amount)
{
int pos = JewelryNBT.doesModifierExist(item, modifier);
- // Negative necklace
- if (jewelry instanceof ItemNecklace && pos != -1 && source != DamageSourceList.weak) player.attackEntityFrom(DamageSourceList.weak, amount * 2F);
+ NBTTagCompound playerInfo = PlayerUtils.getModPlayerPersistTag(player, "Jewelrycraft");
+ NBTTagCompound enemyData = target.getEntityData();
+ if (jewelry instanceof ItemRing && pos != -1 && enemyData.getInteger("reAttacked") == 0){
+ enemyData.setInteger("reAttacked", enemyData.getInteger("reAttacked") + 1);
+ target.attackEntityFrom(DamageSource.causePlayerDamage(player), amount / 2F);
+ if (rand.nextInt(2) == 0){
+ enemyData.setInteger("stunTime", 50);
+ enemyData.setBoolean("stunned", true);
+ }
+ playerInfo.setBoolean("weakDamage", true);
+ }
+ if (enemyData.getInteger("reAttacked") == 1) enemyData.setInteger("reAttacked", 0);
}
@Override
- public boolean onPlayerFall(ItemStack item, EntityPlayer player, Item jewelry)
+ public void onPlayerAttacked(ItemStack item, EntityPlayer player, DamageSource source, Item jewelry, float amount)
{
int pos = JewelryNBT.doesModifierExist(item, modifier);
- return false;
+ NBTTagCompound playerInfo = PlayerUtils.getModPlayerPersistTag(player, "Jewelrycraft");
+ if (jewelry instanceof ItemNecklace && pos != -1 && rand.nextInt(4) == 0 && source != DamageSourceList.weak && source != DamageSource.inFire && source != DamageSource.onFire && source != DamageSource.lava){
+ player.addChatComponentMessage(new ChatComponentText(EnumChatFormatting.GRAY + "The necklace protected you from taking damage!"));
+ playerInfo.setBoolean("negateDamage", true);
+ }
+ // Negative necklace
+ if (jewelry instanceof ItemNecklace && pos != -1 && (source == DamageSource.inFire || source == DamageSource.onFire || source == DamageSource.lava) && source != DamageSourceList.weak) player.attackEntityFrom(DamageSourceList.weak, amount * 3F);
+ // Negative earrings
+ if (jewelry instanceof ItemEarrings && pos != -1 && source.damageType.equals("arrow") && source != DamageSourceList.weak) player.attackEntityFrom(DamageSourceList.weak, amount * 2F);
}
}
diff --git a/java/darkknight/jewelrycraft/effects/ModifierEffects.java b/java/darkknight/jewelrycraft/effects/ModifierEffects.java
index 2d62639..d3c8e38 100644
--- a/java/darkknight/jewelrycraft/effects/ModifierEffects.java
+++ b/java/darkknight/jewelrycraft/effects/ModifierEffects.java
@@ -1,15 +1,17 @@
package darkknight.jewelrycraft.effects;
import java.util.ArrayList;
+import java.util.Random;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.DamageSource;
-public abstract class ModifierEffects
+public class ModifierEffects
{
protected ItemStack modifier;
+ protected Random rand = new Random();
protected static ArrayList<ModifierEffects> effects = new ArrayList<ModifierEffects>();
/**
@@ -34,7 +36,8 @@ public abstract class ModifierEffects
* @param player
* @param jewelry
*/
- public abstract void action(ItemStack item, EntityPlayer player, Item jewelry);
+ public void action(ItemStack item, EntityPlayer player, Item jewelry)
+ {};
/**
* @param item
@@ -43,7 +46,10 @@ public abstract class ModifierEffects
* @param jewelry
* @return
*/
- public abstract boolean onEntityAttackedCacellable(ItemStack item, EntityPlayer player, Entity target, Item jewelry, float amount);
+ public boolean onEntityAttackedCacellable(ItemStack item, EntityPlayer player, Entity target, Item jewelry, float amount)
+ {
+ return false;
+ }
/**
* @param item
@@ -52,24 +58,20 @@ public abstract class ModifierEffects
* @param jewelry
* @return
*/
- public abstract boolean onPlayerAttackedCacellable(ItemStack item, EntityPlayer player, DamageSource source, Item jewelry, float amount);
- /**
- * @param item
- * @param player
- * @param target
- * @param jewelry
- * @return
- */
- public abstract void onEntityAttacked(ItemStack item, EntityPlayer player, Entity target, Item jewelry, float amount);
+ public boolean onPlayerAttackedCacellable(ItemStack item, EntityPlayer player, DamageSource source, Item jewelry, float amount)
+ {
+ return false;
+ }
/**
* @param item
* @param player
- * @param source
+ * @param target
* @param jewelry
* @return
*/
- public abstract void onPlayerAttacked(ItemStack item, EntityPlayer player, DamageSource source, Item jewelry, float amount);
+ public void onEntityAttacked(ItemStack item, EntityPlayer player, Entity target, Item jewelry, float amount)
+ {}
/**
* @param item
@@ -78,5 +80,6 @@ public abstract class ModifierEffects
* @param jewelry
* @return
*/
- public abstract boolean onPlayerFall(ItemStack item, EntityPlayer player, Item jewelry);
+ public void onPlayerAttacked(ItemStack item, EntityPlayer player, DamageSource source, Item jewelry, float amount)
+ {}
}
diff --git a/java/darkknight/jewelrycraft/events/EntityEventHandler.java b/java/darkknight/jewelrycraft/events/EntityEventHandler.java
index 4e32376..f9cbd19 100644
--- a/java/darkknight/jewelrycraft/events/EntityEventHandler.java
+++ b/java/darkknight/jewelrycraft/events/EntityEventHandler.java
@@ -1,5 +1,6 @@
package darkknight.jewelrycraft.events;
+import ibxm.Player;
import java.io.EOFException;
import java.io.File;
import java.io.FileInputStream;
@@ -8,18 +9,22 @@ import java.io.IOException;
import java.util.Iterator;
import java.util.List;
import java.util.Random;
+import net.minecraft.client.Minecraft;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
+import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompressedStreamTools;
import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.server.MinecraftServer;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.MathHelper;
import net.minecraftforge.client.event.EntityViewRenderEvent;
+import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.EntityJoinWorldEvent;
import net.minecraftforge.event.entity.item.ItemTossEvent;
import net.minecraftforge.event.entity.living.LivingAttackEvent;
@@ -27,6 +32,7 @@ import net.minecraftforge.event.entity.living.LivingDeathEvent;
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;
import net.minecraftforge.event.entity.living.LivingFallEvent;
import net.minecraftforge.event.entity.player.PlayerEvent;
+import net.minecraftforge.event.entity.player.PlayerFlyableFallEvent;
import net.minecraftforge.event.world.WorldEvent;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.common.FMLCommonHandler;
@@ -34,15 +40,21 @@ import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import darkknight.jewelrycraft.JewelrycraftMod;
+import darkknight.jewelrycraft.config.ConfigHandler;
import darkknight.jewelrycraft.curses.Curse;
import darkknight.jewelrycraft.damage.DamageSourceList;
import darkknight.jewelrycraft.entities.EntityHalfHeart;
import darkknight.jewelrycraft.entities.EntityHeart;
import darkknight.jewelrycraft.item.ItemBaseJewelry;
+import darkknight.jewelrycraft.item.ItemBracelet;
import darkknight.jewelrycraft.item.ItemList;
+import darkknight.jewelrycraft.lib.Reference;
import darkknight.jewelrycraft.network.PacketClearColorCache;
import darkknight.jewelrycraft.network.PacketRequestPlayerInfo;
+import darkknight.jewelrycraft.network.PacketSendCurseStats;
+import darkknight.jewelrycraft.network.PacketSendPlayerInfo;
import darkknight.jewelrycraft.util.BlockUtils;
+import darkknight.jewelrycraft.util.JewelryNBT;
import darkknight.jewelrycraft.util.JewelrycraftUtil;
import darkknight.jewelrycraft.util.PlayerUtils;
@@ -73,6 +85,7 @@ public class EntityEventHandler
JewelrycraftMod.fancyRender = render;
for(Curse curse: Curse.getCurseList())
if (!persistTag.hasKey(curse.getName())) persistTag.setInteger(curse.getName(), 0);
+ persistTag.setBoolean("sendInfo", true);
}
}
@@ -83,10 +96,36 @@ public class EntityEventHandler
public void onEntityUpdate(LivingUpdateEvent event)
{
Entity entity = event.entity;
+ if (entity.getEntityData().getBoolean("stunned") && entity.getEntityData().getInteger("stunTime") > 0){
+ entity.motionX *= 0D;
+ entity.motionZ *= 0D;
+ entity.motionY *= 0D;
+ entity.rotationPitch = entity.prevRotationPitch;
+ entity.rotationYaw = entity.prevRotationYaw;
+ entity.getEntityData().setInteger("stunTime", entity.getEntityData().getInteger("stunTime") - 1);
+ if (entity.getEntityData().getInteger("stunTime") == 0) entity.getEntityData().setBoolean("stunned", false);
+ entity.worldObj.spawnParticle("spell", entity.posX, entity.posY + entity.height, entity.posZ, 0.0D, 0.3D, 0.0D);
+ }
if (entity instanceof EntityPlayer){
EntityPlayer player = (EntityPlayer)entity;
NBTTagCompound playerInfo = PlayerUtils.getModPlayerPersistTag(player, "Jewelrycraft");
playerInfo.setBoolean("fancyRender", JewelrycraftMod.fancyRender);
+ if (playerInfo.getBoolean("stunned") && playerInfo.getInteger("stunTime") > 0){
+ player.motionX *= 0D;
+ player.motionZ *= 0D;
+ player.motionY *= 0D;
+ player.rotationPitch = entity.prevRotationPitch;
+ player.rotationYaw = entity.prevRotationYaw;
+ playerInfo.setInteger("stunTime", playerInfo.getInteger("stunTime") - 1);
+ if (playerInfo.getInteger("stunTime") == 0) playerInfo.setBoolean("stunned", false);
+ player.worldObj.spawnParticle("spell", entity.posX, entity.posY + 0.5F, entity.posZ, 0.0D, 0.3D, 0.0D);
+ }
+ for(int i = 0; i < 18; i++)
+ if (playerInfo.hasKey("ext" + i)){
+ NBTTagCompound nbt = (NBTTagCompound)playerInfo.getTag("ext" + i);
+ ItemStack item = ItemStack.loadItemStackFromNBT(nbt);
+ ((ItemBaseJewelry)item.getItem()).action(item, player);
+ }
if (!player.worldObj.isRemote){
if (playerInfo.hasKey("reselectCurses") && !playerInfo.getBoolean("reselectCurses")){
playerInfo.setInteger("curseTime", playerInfo.getInteger("curseTime") - 10000);
@@ -94,27 +133,24 @@ public class EntityEventHandler
}
if (playerInfo.hasKey("playerCursePointsChanged") && playerInfo.getBoolean("playerCursePointsChanged")){
int points = playerInfo.getInteger("cursePoints");
- for(int i = 0; i <= 5; i++)
- if (points > i * 750) addCurse(player, playerInfo, ("curse" + i).toString());
+ for(int i = 1; i <= JewelrycraftMod.MAX_CURSES; i++)
+ if (points > (i - 1) * 1750) addCurse(player, playerInfo, i);
if (!playerInfo.hasKey("curseTime") || !playerInfo.hasKey("reselectCurses") || playerInfo.getBoolean("reselectCurses")){
playerInfo.setInteger("curseTime", 23000);
playerInfo.setBoolean("reselectCurses", false);
}
JewelrycraftMod.netWrapper.sendToServer(new PacketRequestPlayerInfo());
}
- for(int i = 0; i < 18; i++)
- if (playerInfo.hasKey("ext" + i)){
- NBTTagCompound nbt = (NBTTagCompound)playerInfo.getTag("ext" + i);
- ItemStack item = ItemStack.loadItemStackFromNBT(nbt);
- ((ItemBaseJewelry)item.getItem()).action(item, player);
- }
if (playerInfo.getBoolean("playerCursePointsChanged")) playerInfo.setBoolean("playerCursePointsChanged", false);
-// for(Curse curse: Curse.getCurseList())
-// if (playerInfo.getInteger(curse.getName()) > 0) curse.action(player.worldObj, player);
+ if (playerInfo.getBoolean("sendInfo")){
+ JewelrycraftMod.netWrapper.sendToAll(new PacketSendCurseStats());
+ playerInfo.setBoolean("sendInfo", false);
+ }
+ for(Curse curse: Curse.getCurseList())
+ if (playerInfo.getInteger(curse.getName()) > 0) curse.action(player.worldObj, player);
}
}
}
-
/**
* @param event
@@ -126,6 +162,7 @@ public class EntityEventHandler
if (entity instanceof EntityPlayer && !(event.source.getEntity() instanceof EntityPlayer)){
EntityPlayer player = (EntityPlayer)entity;
NBTTagCompound playerInfo = PlayerUtils.getModPlayerPersistTag(player, "Jewelrycraft");
+ if (event.source.getEntity() != null && event.source.getEntity().getEntityData().getBoolean("stunned")) event.setCanceled(true);
if (!player.worldObj.isRemote) for(int i = 0; i < 18; i++)
if (playerInfo.hasKey("ext" + i)){
NBTTagCompound nbt = (NBTTagCompound)playerInfo.getTag("ext" + i);
@@ -134,9 +171,14 @@ public class EntityEventHandler
event.setCanceled(true);
break;
}
+ if (playerInfo.getBoolean("negateDamage")){
+ playerInfo.setBoolean("negateDamage", false);
+ event.setCanceled(true);
+ break;
+ }
((ItemBaseJewelry)item.getItem()).onPlayerAttacked(item, player, event.source, event.ammount);
}
- if (!player.worldObj.isRemote && player.getHealth() != player.prevHealth){
+ if (player.getHealth() != player.prevHealth){
if (playerInfo.getFloat("WhiteHeart") > 0){
playerInfo.setFloat("WhiteHeart", 0f);
JewelrycraftMod.netWrapper.sendToServer(new PacketRequestPlayerInfo());
@@ -174,16 +216,28 @@ public class EntityEventHandler
}
}
}
+ for(Curse curse: Curse.getCurseList())
+ if (playerInfo.getInteger(curse.getName()) > 0) curse.attackedAction(player.worldObj, player);
}else if (event.source.getEntity() instanceof EntityPlayer){
EntityPlayer player = (EntityPlayer)event.source.getEntity();
NBTTagCompound playerInfo = PlayerUtils.getModPlayerPersistTag(player, "Jewelrycraft");
- if (!player.worldObj.isRemote) for(int i = 0; i < 18; i++)
+ for(int i = 0; i < 18; i++)
if (playerInfo.hasKey("ext" + i)){
NBTTagCompound nbt = (NBTTagCompound)playerInfo.getTag("ext" + i);
ItemStack item = ItemStack.loadItemStackFromNBT(nbt);
- ((ItemBaseJewelry)item.getItem()).onEntityAttackedCacellable(item, player, entity, event.ammount);
+ if (((ItemBaseJewelry)item.getItem()).onEntityAttackedCacellable(item, player, entity, event.ammount)){
+ event.setCanceled(true);
+ break;
+ }
+ if (playerInfo.getBoolean("weakDamage")){
+ playerInfo.setBoolean("weakDamage", false);
+ event.setCanceled(true);
+ break;
+ }
((ItemBaseJewelry)item.getItem()).onEntityAttacked(item, player, entity, event.ammount);
}
+ for(Curse curse: Curse.getCurseList())
+ if (playerInfo.getInteger(curse.getName()) > 0) curse.attackedByPlayerAction(entity.worldObj, player, entity);
}
}
@@ -198,61 +252,46 @@ public class EntityEventHandler
NBTTagCompound playerInfo = PlayerUtils.getModPlayerPersistTag(player, "Jewelrycraft");
if (playerInfo.hasKey("cursePoints") && playerInfo.getInteger("cursePoints") > 0){
int points = playerInfo.getInteger("cursePoints");
- for(int i = 0; i <= 5; i++)
- if (points > i * 750) addCurse(player, playerInfo, ("curse" + i).toString());
+ for(int i = 1; i <= JewelrycraftMod.MAX_CURSES; i++)
+ if (points > (i - 1) * 1750) addCurse(player, playerInfo, i);
if (!playerInfo.hasKey("curseTime") || !playerInfo.hasKey("reselectCurses") || playerInfo.getBoolean("reselectCurses")){
playerInfo.setInteger("curseTime", 23000);
playerInfo.setBoolean("reselectCurses", false);
}
}
+ playerInfo.setBoolean("sendInfo", true);
+ playerInfo.setFloat("BlueHeart", 0f);
+ playerInfo.setFloat("BlackHeart", 0f);
+ playerInfo.setFloat("WhiteHeart", 0f);
+ for(Curse curse: Curse.getCurseList())
+ if (playerInfo.getInteger(curse.getName()) > 0) curse.respawnAction(player.worldObj, player);
}
if (event.entity instanceof EntityPlayer && !(event.entity instanceof EntityPlayerMP)) JewelrycraftMod.netWrapper.sendToServer(new PacketRequestPlayerInfo());
}
- @SubscribeEvent
- public void onPlayerFall(LivingFallEvent event)
- {
- Entity entity = event.entity;
- if (entity instanceof EntityPlayer){
- EntityPlayer player = (EntityPlayer)entity;
- NBTTagCompound playerInfo = PlayerUtils.getModPlayerPersistTag(player, "Jewelrycraft");
- if (!player.worldObj.isRemote) for(int i = 0; i < 18; i++)
- if (playerInfo.hasKey("ext" + i)){
- NBTTagCompound nbt = (NBTTagCompound)playerInfo.getTag("ext" + i);
- ItemStack item = ItemStack.loadItemStackFromNBT(nbt);
- if (((ItemBaseJewelry)item.getItem()).onPlayerFall(item, player)){
- event.setCanceled(true);
- break;
- }
- }
- }
- }
-
/**
* @param player
* @param playerInfo
* @param curse
*/
- public void addCurse(EntityPlayer player, NBTTagCompound playerInfo, String curse)
+ public void addCurse(EntityPlayer player, NBTTagCompound playerInfo, int curseNo)
{
- if ((!playerInfo.hasKey(curse) || playerInfo.getInteger(curse) == 0) && Curse.availableCurses.size() > 0){
+ if (Curse.availableCurses.size() > 0 && curseNo > Curse.getCurseList().size() - Curse.availableCurses.size()){
int no = JewelrycraftUtil.rand.nextInt(Curse.availableCurses.size());
Curse cur = Curse.availableCurses.get(no);
- int grade = 1 + player.worldObj.rand.nextInt(2);
- playerInfo.setInteger(cur.getName(), grade);
+ playerInfo.setInteger(cur.getName(), 1);
Curse.availableCurses.remove(cur);
- playerInfo.setInteger(curse, grade);
+ playerInfo.setBoolean("sendInfo", true);
}
}
- public static void addCurse(EntityPlayer player, NBTTagCompound playerInfo, String curseNo, int curseID)
+ public static void addCurse(EntityPlayer player, NBTTagCompound playerInfo, int curseID, int grade)
{
- if ((!playerInfo.hasKey(curseNo) || playerInfo.getInteger(curseNo) <= 0) && Curse.availableCurses.size() > 0){
- Curse cur = Curse.availableCurses.get(curseID);
- int grade = 1 + player.worldObj.rand.nextInt(2);
+ Curse cur = Curse.getCurseList().get(curseID);
+ if (Curse.availableCurses.size() > 0 && Curse.availableCurses.contains(cur)){
playerInfo.setInteger(cur.getName(), grade);
Curse.availableCurses.remove(cur);
- playerInfo.setInteger(curseNo, grade);
+ playerInfo.setBoolean("sendInfo", true);
}
}
@@ -267,7 +306,10 @@ public class EntityEventHandler
entityitem.motionZ = 0;
entityitem.motionY = 0.11000000298023224D;
event.player.worldObj.spawnEntityInWorld(entityitem);
- event.player.addChatComponentMessage(new ChatComponentText("<" + event.player.getDisplayName() + "> This is MY item! MINE! I will NEVER give it to you! Mine! Mine! MINE!"));
+ List players = MinecraftServer.getServer().getConfigurationManager().playerEntityList;
+ Iterator plrs = players.iterator();
+ while (plrs.hasNext())
+ ((EntityPlayerMP)plrs.next()).addChatComponentMessage(new ChatComponentText("<" + event.player.getDisplayName() + "> This is MY item! MINE! I will NEVER give it to you! Mine! Mine! MINE!"));
event.setCanceled(true);
}
}
@@ -310,22 +352,24 @@ public class EntityEventHandler
}
}
}
- if (!entity.worldObj.isRemote && entity instanceof EntityPlayer){
+ if (entity instanceof EntityPlayer){
EntityPlayer player = (EntityPlayer)entity;
NBTTagCompound playerInfo = PlayerUtils.getModPlayerPersistTag(player, "Jewelrycraft");
+ playerInfo.setFloat("BlueHeart", 0f);
+ playerInfo.setFloat("BlackHeart", 0f);
+ playerInfo.setFloat("WhiteHeart", 0f);
if (playerInfo.hasKey("reselectCurses") && playerInfo.getBoolean("reselectCurses")){
for(Curse l: Curse.getCurseList()){
if (playerInfo.getInteger(l.getName()) == 1){
playerInfo.setInteger(l.getName(), 0);
- if(!Curse.availableCurses.contains(l)) Curse.availableCurses.add(l);
+ if (!Curse.availableCurses.contains(l)) Curse.availableCurses.add(l);
}else if (playerInfo.getInteger(l.getName()) >= 2) playerInfo.setInteger(l.getName(), 1);
}
- for(int i = 0; i <= 5; i++)
- if (playerInfo.hasKey(("curse" + i).toString()))
- playerInfo.setInteger(("curse" + i).toString(), playerInfo.getInteger(("curse" + i).toString()) == 1 ? 0:1);
-
- JewelrycraftMod.netWrapper.sendToServer(new PacketRequestPlayerInfo());
+ if (entity.worldObj.isRemote) JewelrycraftMod.netWrapper.sendToServer(new PacketRequestPlayerInfo());
}
+ playerInfo.setBoolean("sendInfo", true);
+ for(Curse curse: Curse.getCurseList())
+ if (playerInfo.getInteger(curse.getName()) > 0) curse.deathAction(player.worldObj, player);
}
if (event.entity instanceof EntityPlayer && !(event.entity instanceof EntityPlayerMP)) JewelrycraftMod.netWrapper.sendToServer(new PacketRequestPlayerInfo());
}
diff --git a/java/darkknight/jewelrycraft/events/PlayerRenderHandler.java b/java/darkknight/jewelrycraft/events/PlayerRenderHandler.java
index 65ce853..d85620a 100644
--- a/java/darkknight/jewelrycraft/events/PlayerRenderHandler.java
+++ b/java/darkknight/jewelrycraft/events/PlayerRenderHandler.java
@@ -1,11 +1,15 @@
package darkknight.jewelrycraft.events;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.server.MinecraftServer;
import net.minecraftforge.client.event.RenderPlayerEvent;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
-import darkknight.jewelrycraft.curses.Curse;
import darkknight.jewelrycraft.entities.renders.RenderHelper;
import darkknight.jewelrycraft.lib.Reference;
import darkknight.jewelrycraft.model.ModelMask;
@@ -17,25 +21,48 @@ public class PlayerRenderHandler
ModelMask maskModel = new ModelMask();
MaskRender mask = new MaskRender();
+ public static String[] infamyCache = new String[] {};
+
@SubscribeEvent
public void renderScreen(RenderPlayerEvent.Specials.Post event)
- {
- EntityPlayer player = event.entityPlayer;
- NBTTagCompound playerInfo = PlayerUtils.getModPlayerPersistTag(player, "Jewelrycraft");
- if (playerInfo.getInteger(Reference.MODNAME + ":" + "Greed") >= 0){
- float yaw = player.prevRotationYawHead + (player.rotationYawHead - player.prevRotationYawHead) * event.partialRenderTick;
- float yawOffset = player.prevRenderYawOffset + (player.renderYawOffset - player.prevRenderYawOffset) * event.partialRenderTick;
- float pitch = player.prevRotationPitch + (player.rotationPitch - player.prevRotationPitch) * event.partialRenderTick;
- GL11.glPushMatrix();
- GL11.glRotatef(yawOffset, 0, -1, 0);
- GL11.glRotatef(yaw - 90, 0, 1, 0);
- GL11.glRotatef(pitch, 0, 0, -1);
- GL11.glRotatef(90F, 0, 1F, 0F);
- RenderHelper.translateToHeadLevel(player);
- GL11.glScalef(1.6f, 1.6f, 1.6f);
- GL11.glTranslatef(-0.25F, -0.25F, -0.25F);
- mask.doRender(event.entityPlayer, 0F, 0F, 0F, 0F, 0F);
- GL11.glPopMatrix();
+ {
+ if (infamyCache != null)
+ {
+ Iterator<EntityPlayer> players = event.entityPlayer.worldObj.playerEntities.iterator();
+
+ while(players.hasNext())
+ {
+ EntityPlayer player = players.next();
+ if (checkPlayerInfamy(player.getDisplayName()) && event.entityPlayer.getDisplayName().equals(player.getDisplayName()))
+ {
+ float yaw = player.prevRotationYawHead + (player.rotationYawHead - player.prevRotationYawHead) * event.partialRenderTick;
+ float yawOffset = player.prevRenderYawOffset + (player.renderYawOffset - player.prevRenderYawOffset) * event.partialRenderTick;
+ float pitch = player.prevRotationPitch + (player.rotationPitch - player.prevRotationPitch) * event.partialRenderTick;
+ GL11.glPushMatrix();
+ GL11.glColor4f(1, 1, 1, 1);
+ GL11.glRotatef(yawOffset, 0, -1, 0);
+ GL11.glRotatef(yaw - 90, 0, 1, 0);
+ GL11.glRotatef(pitch, 0, 0, -1);
+ GL11.glRotatef(90F, 0, 1F, 0F);
+ RenderHelper.translateToHeadLevel(player);
+ GL11.glScalef(1.6f, 1.6f, 1.6f);
+ GL11.glTranslatef(-0.25F, -0.25F, -0.25F);
+ mask.doRender(event.entityPlayer, 0F, 0F, 0F, 0F, 0F);
+ GL11.glPopMatrix();
+ }
+ }
}
}
+
+ /**
+ * @param string
+ * @return
+ */
+ private boolean checkPlayerInfamy(String string)
+ {
+ for (int i = 0; i < infamyCache.length; i++)
+ if (infamyCache[i].equals(string)) return true;
+
+ return false;
+ }
}
diff --git a/java/darkknight/jewelrycraft/events/ScreenHandler.java b/java/darkknight/jewelrycraft/events/ScreenHandler.java
index 9364e88..7121f3e 100644
--- a/java/darkknight/jewelrycraft/events/ScreenHandler.java
+++ b/java/darkknight/jewelrycraft/events/ScreenHandler.java
@@ -17,7 +17,7 @@ import darkknight.jewelrycraft.curses.Curse;
public class ScreenHandler extends Gui
{
private Minecraft mc;
- public static NBTTagCompound tagCache;
+ public static NBTTagCompound tagCache = null;
public static int cooldown;
static ResourceLocation texture;
static ResourceLocation hearts = new ResourceLocation("jewelrycraft", "textures/gui/hearts.png");
@@ -32,6 +32,7 @@ public class ScreenHandler extends Gui
@SubscribeEvent
public void renderScreen(RenderGameOverlayEvent event)
{
+// if (event.type != ElementType.TEXT) Gui.drawRect(0, 0, mc.displayWidth, mc.displayHeight, 0xff000000);
if (event.isCancelable() || event.type != ElementType.ALL || tagCache == null) return;
if (!mc.gameSettings.showDebugInfo && !(mc.currentScreen instanceof GuiChat)){
int count = 0;
@@ -76,8 +77,11 @@ public class ScreenHandler extends Gui
count++;
}
}
+ GL11.glPushMatrix();
+ GL11.glColor4f(1f, 1f, 1f, 1.0f);
mc.renderEngine.bindTexture(hearts);
count = 0;
+ size = 16;
if (tagCache.getFloat("BlueHeart") > 0){
for(int i = 0; i < (int)tagCache.getFloat("BlueHeart") / 2; i++)
drawTexturedModalRect(2 + 13 * i, resolution.getScaledHeight() / 2 - 25 + 16 * count, 0 * size, 0 * size, size, size);
@@ -92,6 +96,7 @@ public class ScreenHandler extends Gui
count++;
if (tagCache.getFloat("WhiteHeart") > 0)
drawTexturedModalRect(2, resolution.getScaledHeight() / 2 - 25 + 16 * count, 2 * size, 1 * size, size, size);
+ GL11.glPopMatrix();
}
}
} \ No newline at end of file
diff --git a/java/darkknight/jewelrycraft/item/ItemBaseJewelry.java b/java/darkknight/jewelrycraft/item/ItemBaseJewelry.java
index fe614d0..cb38b76 100644
--- a/java/darkknight/jewelrycraft/item/ItemBaseJewelry.java
+++ b/java/darkknight/jewelrycraft/item/ItemBaseJewelry.java
@@ -26,6 +26,7 @@ import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
+import darkknight.jewelrycraft.JewelrycraftMod;
import darkknight.jewelrycraft.effects.ModifierEffects;
import darkknight.jewelrycraft.util.JewelryNBT;
@@ -35,6 +36,7 @@ public abstract class ItemBaseJewelry extends Item
{
super();
setMaxStackSize(1);
+ setCreativeTab(JewelrycraftMod.jewelrycraft);
}
public boolean requiresMultipleRenderPasses()
@@ -256,17 +258,4 @@ public abstract class ItemBaseJewelry extends Item
{
for(ModifierEffects mod: ModifierEffects.getEffects()) mod.onEntityAttacked(item, player, target, this, amount);
}
-
- /**
- * @param item
- * @param player
- * @param source
- * @return
- */
- public boolean onPlayerFall(ItemStack item, EntityPlayer player)
- {
- for(ModifierEffects mod: ModifierEffects.getEffects())
- return mod.onPlayerFall(item, player, this);
- return false;
- }
}
diff --git a/java/darkknight/jewelrycraft/network/PacketSendCurseStats.java b/java/darkknight/jewelrycraft/network/PacketSendCurseStats.java
new file mode 100644
index 0000000..3457235
--- /dev/null
+++ b/java/darkknight/jewelrycraft/network/PacketSendCurseStats.java
@@ -0,0 +1,71 @@
+/**
+ *
+ */
+package darkknight.jewelrycraft.network;
+
+import java.util.Iterator;
+import java.util.List;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.server.MinecraftServer;
+import io.netty.buffer.ByteBuf;
+import cpw.mods.fml.common.network.ByteBufUtils;
+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 darkknight.jewelrycraft.events.PlayerRenderHandler;
+import darkknight.jewelrycraft.lib.Reference;
+import darkknight.jewelrycraft.util.PlayerUtils;
+
+/**
+ * @author Sorin
+ *
+ */
+public class PacketSendCurseStats implements IMessage, IMessageHandler<PacketSendCurseStats, IMessage>
+{
+ public PacketSendCurseStats()
+ {
+
+ }
+
+ /**
+ * @param message
+ * @param ctx
+ * @return
+ */
+ @Override
+ public IMessage onMessage(PacketSendCurseStats message, MessageContext ctx)
+ {
+ return null;
+ }
+
+ /**
+ * @param buf
+ */
+ @Override
+ public void fromBytes(ByteBuf buf)
+ {
+ String temp = ByteBufUtils.readUTF8String(buf);
+ if (temp != "")
+ PlayerRenderHandler.infamyCache = temp.split(";");
+ else
+ PlayerRenderHandler.infamyCache = new String[] { };
+ }
+
+ /**
+ * @param buf
+ */
+ @Override
+ public void toBytes(ByteBuf buf)
+ {
+ Iterator<EntityPlayer> players = MinecraftServer.getServer().getConfigurationManager().playerEntityList.iterator();
+ String infamyPlayers = "";
+ while (players.hasNext())
+ {
+ EntityPlayer current = players.next();
+ if(PlayerUtils.getModPlayerPersistTag(current, "Jewelrycraft").getInteger(Reference.MODNAME + ":" + "Infamy") > 0)
+ infamyPlayers = infamyPlayers + (infamyPlayers == "" ? "" : ";") + current.getDisplayName();
+ }
+ ByteBufUtils.writeUTF8String(buf, infamyPlayers);
+ }
+}
diff --git a/java/darkknight/jewelrycraft/util/JewelrycraftUtil.java b/java/darkknight/jewelrycraft/util/JewelrycraftUtil.java
index 70129f0..cd2328c 100644
--- a/java/darkknight/jewelrycraft/util/JewelrycraftUtil.java
+++ b/java/darkknight/jewelrycraft/util/JewelrycraftUtil.java
@@ -51,16 +51,16 @@ public class JewelrycraftUtil
jewelry.add(new ItemStack(ItemList.earrings));
for(Object item: GameData.getItemRegistry()){
ArrayList<ItemStack> items = new ArrayList<ItemStack>();
- if (((Item)item).getHasSubtypes()){
- for(int i = 0; i < ((Item)item).getMaxDamage(); i++)
- items.add(new ItemStack((Item)item, 1, i));
- }else objects.add(new ItemStack((Item)item));
+ if (item != null && ((Item)item).getHasSubtypes()) ((Item)item).getSubItems((Item)item, null, items);
+ else objects.add(new ItemStack((Item)item));
+
if (!items.isEmpty()) objects.addAll(items);
}
}
/**
- * Adds curse points to a player
+ * Adds curse points to a player
+ *
* @param player the player to add the points to
* @param points amount of curse points
*/
diff --git a/java/darkknight/jewelrycraft/util/PlayerUtils.java b/java/darkknight/jewelrycraft/util/PlayerUtils.java
index 159ea98..f1655c0 100644
--- a/java/darkknight/jewelrycraft/util/PlayerUtils.java
+++ b/java/darkknight/jewelrycraft/util/PlayerUtils.java
@@ -1,5 +1,6 @@
package darkknight.jewelrycraft.util;
+import darkknight.jewelrycraft.events.ScreenHandler;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
@@ -17,6 +18,8 @@ public class PlayerUtils
*/
public static NBTTagCompound getModPlayerPersistTag(EntityPlayer player, String modName)
{
+ if (player.worldObj.isRemote && ScreenHandler.tagCache != null) return ScreenHandler.tagCache;
+
NBTTagCompound tag = player.getEntityData();
NBTTagCompound persistTag = null;
if (tag.hasKey(EntityPlayer.PERSISTED_NBT_TAG)) persistTag = tag.getCompoundTag(EntityPlayer.PERSISTED_NBT_TAG);
diff --git a/java/darkknight/jewelrycraft/worldGen/village/ComponentJewelry.java b/java/darkknight/jewelrycraft/worldGen/village/ComponentJewelry.java
index 6083049..c50e321 100644
--- a/java/darkknight/jewelrycraft/worldGen/village/ComponentJewelry.java
+++ b/java/darkknight/jewelrycraft/worldGen/village/ComponentJewelry.java
@@ -387,8 +387,8 @@ public class ComponentJewelry extends StructureVillagePieces.House1
int k1 = getZWithOffset(i, k);
placeBlockAtCurrentPosition(world, BlockList.molder, metadata, i, j, k, sbb);
TileEntityMolder molder = (TileEntityMolder)world.getTileEntity(i1, j1, k1);
- if (molder != null) if (hasMold){
- int meta = random.nextInt(ItemMolds.moldsItemNames.length + 1);
+ if (molder != null && !molder.hasMold) if (hasMold){
+ int meta = random.nextInt(ItemMolds.moldsItemNames.length);
molder.mold = new ItemStack(ItemList.molds, 1, meta);
molder.hasMold = true;
if (hasStuff){