Skip to content

Commit

Permalink
Working Isaac, working blood
Browse files Browse the repository at this point in the history
  • Loading branch information
sirolf2009 committed Jun 3, 2013
1 parent ad926be commit 854d6f0
Show file tree
Hide file tree
Showing 40 changed files with 399 additions and 280 deletions.
63 changes: 40 additions & 23 deletions common/com/sirolf2009/necromancy/Necromancy.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
package com.sirolf2009.necromancy;

import java.awt.Color;
import java.io.File;
import java.io.IOException;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
import java.util.logging.Logger;

import net.minecraft.block.Block;
Expand All @@ -12,8 +16,8 @@
import net.minecraft.item.EnumArmorMaterial;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.server.dedicated.PropertyManager;
import net.minecraft.stats.Achievement;
import net.minecraft.world.WorldType;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraftforge.common.AchievementPage;
import net.minecraftforge.common.Configuration;
Expand Down Expand Up @@ -42,6 +46,7 @@
import com.sirolf2009.necromancy.entity.EntityMinion;
import com.sirolf2009.necromancy.entity.EntityNightCrawler;
import com.sirolf2009.necromancy.entity.EntityTear;
import com.sirolf2009.necromancy.entity.EntityTearBlood;
import com.sirolf2009.necromancy.entity.EntityTeddy;
import com.sirolf2009.necromancy.entity.necroapi.NecroEntityCaveSpider;
import com.sirolf2009.necromancy.entity.necroapi.NecroEntityChicken;
Expand All @@ -58,7 +63,6 @@
import com.sirolf2009.necromancy.entity.necroapi.NecroEntitySquid;
import com.sirolf2009.necromancy.entity.necroapi.NecroEntityVillager;
import com.sirolf2009.necromancy.entity.necroapi.NecroEntityWitch;
import com.sirolf2009.necromancy.entity.necroapi.NecroEntityWither;
import com.sirolf2009.necromancy.entity.necroapi.NecroEntityZombie;
import com.sirolf2009.necromancy.generation.WorldGenerator;
import com.sirolf2009.necromancy.item.ItemBodyPart;
Expand All @@ -76,11 +80,13 @@

import cpw.mods.fml.common.FMLLog;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.ServerStarted;
import cpw.mods.fml.common.Mod.ServerStarting;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.event.FMLServerStartedEvent;
import cpw.mods.fml.common.event.FMLServerStartingEvent;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.registry.EntityRegistry;
Expand Down Expand Up @@ -119,6 +125,7 @@ public class Necromancy {
public static int NecroVillagerID;
public static int TeddyID;
public static int IsaacID;
public static int maxSpawn = -1;
public static boolean Christmas = false;
public static boolean renderSpecialScythe = false;

Expand All @@ -138,8 +145,8 @@ public class Necromancy {
public static Block altar;
public static Block altarBlock;
public static Block sewing;
public static Block bloodFlowing;
public static Block bloodStill;
public static BlockBloodFlowing bloodFlowing;
public static BlockBloodStationary bloodStill;
// public static Block skullWall;

public static EnumArmorMaterial isaac = EnumHelper.addArmorMaterial("Isaac", Integer.MAX_VALUE, new int[] { 0, 0, 0, 0 }, 0);
Expand Down Expand Up @@ -186,9 +193,6 @@ public void preInit(FMLPreInitializationEvent event) {
config.save();
}

IsaacID = EntityRegistry.findGlobalUniqueEntityId();
TeddyID = EntityRegistry.findGlobalUniqueEntityId();

NecroEntityBase.organID = OrgansID;

MinecraftForge.EVENT_BUS.register(eventHandler);
Expand All @@ -200,6 +204,8 @@ public void init(FMLInitializationEvent event) {
LanguageRegistry.instance().addStringLocalization("itemGroup.BodyParts", "en_US", "Bodyparts");
initItems();
initEntities();
spawner = new ItemSpawner(SpawnerID).setUnlocalizedName("NecroSpawner");
LanguageRegistry.addName(new ItemStack(spawner, 1, 0), "Isaac's Soul Heart");
initBlocks();
initRecipes();
proxy.init();
Expand All @@ -219,13 +225,16 @@ public void init(FMLInitializationEvent event) {

GameRegistry.registerWorldGenerator(new WorldGenerator());

specialFolk.add("sirolf2009");
specialFolk.add("mr_boness");
specialFolk.add("creeperrain");
specialFolk.add("sander_de_ronde");
specialFolk.add("Honeydew");
specialFolk.add("CaptainSparklez");
specialFolk.add("MinecraftWero");
try {
URL url = new URL("https://dl.dropboxusercontent.com/u/50553915/necromancy/specialFolk.txt");
Scanner s = new Scanner(url.openStream());
while (s.hasNext()) {
specialFolk.add(s.nextLine());
}
s.close();
} catch (IOException e) {
System.err.println("not connected to the internet, special scythes are de-activated");
}
}

@Mod.PostInit
Expand All @@ -239,11 +248,18 @@ public void serverStarting(FMLServerStartingEvent event) {
eventHandler.initCommands(event);
}

@ServerStarted
public void serverStarted(FMLServerStartedEvent event) {
if (new File("server.properties").exists()) {
PropertyManager manager = new PropertyManager(new File("server.properties"), null);
maxSpawn = manager.getIntProperty("max_minion_spawn", -1);
}
}

private void initEntities() {
int modIDs = 0;
EntityRegistry.registerGlobalEntityID(EntityMinion.class, "minionNecro", EntityRegistry.findGlobalUniqueEntityId(), new Color(99, 69, 29).getRGB(), Color.red.getRGB());
LanguageRegistry.instance().addStringLocalization("entity.minionNecro.name", "en_US", "Minion");

TeddyID = EntityRegistry.findGlobalUniqueEntityId();
EntityRegistry.registerGlobalEntityID(EntityTeddy.class, "teddyNecro", TeddyID, new Color(99, 69, 29).getRGB(), Color.red.getRGB());
LanguageRegistry.instance().addStringLocalization("entity.teddyNecro.name", "en_US", "Teddy Bear");

Expand All @@ -252,9 +268,9 @@ private void initEntities() {
LanguageRegistry.instance().addStringLocalization("entity.NightCrawler.name", "en_US", "Night Crawler");
EntityRegistry.addSpawn(EntityNightCrawler.class, 1, 1, 1, EnumCreatureType.monster, BiomeGenBase.forest, BiomeGenBase.swampland);

IsaacID = EntityRegistry.findGlobalUniqueEntityId();
EntityRegistry.registerGlobalEntityID(EntityIsaacNormal.class, "IsaacNormal", IsaacID, new Color(6, 6, 6).getRGB(), new Color(204, 153, 153).getRGB());
LanguageRegistry.instance().addStringLocalization("entity.IsaacNormal.name", "en_US", "Isaac");
EntityRegistry.addSpawn(EntityIsaacNormal.class, 1, 1, 1, EnumCreatureType.monster, WorldType.base12Biomes);

EntityRegistry.registerGlobalEntityID(EntityIsaacBlood.class, "IsaacBlood", EntityRegistry.findGlobalUniqueEntityId(), new Color(16, 6, 6).getRGB(), new Color(214, 153, 153).getRGB());
LanguageRegistry.instance().addStringLocalization("entity.IsaacBlood.name", "en_US", "Isaac Blood Mode");
Expand All @@ -265,22 +281,25 @@ private void initEntities() {
EntityRegistry.registerGlobalEntityID(EntityIsaacBody.class, "IsaacBody", EntityRegistry.findGlobalUniqueEntityId(), new Color(36, 6, 6).getRGB(), new Color(214, 153, 153).getRGB());
LanguageRegistry.instance().addStringLocalization("entity.IsaacBody.name", "en_US", "Isaac's Body");

EntityRegistry.registerGlobalEntityID(EntityMinion.class, "minionNecro", EntityRegistry.findGlobalUniqueEntityId(), new Color(99, 69, 29).getRGB(), Color.red.getRGB());
LanguageRegistry.instance().addStringLocalization("entity.minionNecro.name", "en_US", "Minion");

EntityRegistry.registerModEntity(EntityTear.class, "TearNormal", 6, this, 144, 2, true);
EntityRegistry.registerModEntity(EntityTearBlood.class, "TearBlood", 7, this, 144, 2, true);

NecroVillagerID = EntityRegistry.findGlobalUniqueEntityId();
VillagerRegistry.instance().registerVillagerType(NecroVillagerID, Reference.LOC_RESOURCES_TEXTURES_ENTITIES + "/villagerNecro.png");
VillagerRegistry.instance().registerVillageTradeHandler(NecroVillagerID, packetHandler);

NecroEntityRegistry.RegisterEntity(new NecroEntitySkeleton());
NecroEntityRegistry.RegisterEntity(new NecroEntityWither());
NecroEntityRegistry.RegisterEntity(new NecroEntityZombie());
NecroEntityRegistry.RegisterEntity(new NecroEntityPig());
NecroEntityRegistry.RegisterEntity(new NecroEntityCow());
NecroEntityRegistry.RegisterEntity(new NecroEntityPigZombie());
NecroEntityRegistry.RegisterEntity(new NecroEntityCreeper());
NecroEntityRegistry.RegisterEntity(new NecroEntitySpider());
NecroEntityRegistry.RegisterEntity(new NecroEntityEnderman());
//NecroEntityRegistry.RegisterEntity(new NecroEntitySlimeSmall());
// NecroEntityRegistry.RegisterEntity(new NecroEntitySlimeSmall());
NecroEntityRegistry.RegisterEntity(new NecroEntityIsaac());
NecroEntityRegistry.RegisterEntity(new NecroEntityChicken());
NecroEntityRegistry.RegisterEntity(new NecroEntityMooshroom());
Expand Down Expand Up @@ -348,14 +367,12 @@ private void initItems() {
// skull = new ItemNecroSkull(skullID);
isaacsHead = new ItemIsaacsHead(IsaacsHeadID, isaac, proxy.addArmour("Isaac"), 0);
LanguageRegistry.addName(isaacsHead, "Isaac's Severed Head");
spawner = new ItemSpawner(SpawnerID).setUnlocalizedName("NecroSpawner");
LanguageRegistry.addName(new ItemStack(spawner, 1, 0), "Isaac's Soul Heart");
}

private void initRecipes() {
GameRegistry.addRecipe(new ItemStack(necronomicon, 1), new Object[] { "LSL", "IBF", "LNL", Character.valueOf('B'), Item.book, Character.valueOf('L'), Item.leather, Character.valueOf('S'), new ItemStack(necromanticItems, 1, 6), Character.valueOf('I'), new ItemStack(Item.dyePowder, 1, 0), Character.valueOf('F'), Item.feather, Character.valueOf('N'), Item.netherStalkSeeds });
GameRegistry.addRecipe(new ItemStack(necronomicon, 1), new Object[] { "LSL", "IBF", "LNL", Character.valueOf('B'), Item.book, Character.valueOf('L'), Item.leather, Character.valueOf('S'), ItemNecromancy.getItemStackFromName("Jar of Blood"), Character.valueOf('I'), new ItemStack(Item.dyePowder, 1, 0), Character.valueOf('F'), Item.feather, Character.valueOf('N'), Item.netherStalkSeeds });
GameRegistry.addRecipe(ItemNecromancy.getItemStackFromName("Bone Needle"), new Object[] { "X", Character.valueOf('X'), new ItemStack(Item.dyePowder, 1, 15) });
GameRegistry.addRecipe(new ItemStack(scythe, 1), new Object[] { "IH", " S", " B", Character.valueOf('I'), Block.obsidian, 'H', Item.hoeIron, 'S', Item.stick, 'B', new ItemStack(necromanticItems, 1, 6) });
GameRegistry.addRecipe(new ItemStack(scythe, 1), new Object[] { "IH", " S", " B", Character.valueOf('I'), Block.obsidian, 'H', Item.hoeIron, 'S', Item.stick, 'B', ItemNecromancy.getItemStackFromName("Jar of Blood") });
GameRegistry.addRecipe(new ItemStack(sewing, 1), new Object[] { "III", "ISB", "III", 'I', Item.ingotIron, 'S', Item.silk, 'B', ItemNecromancy.getItemStackFromName("Bone Needle") });
GameRegistry.addRecipe(ItemNecromancy.getItemStackFromName("Brain on a Stick"), new Object[] { "# ", " X", '#', Item.fishingRod, 'X', new ItemStack(organs, 1, 0) });
// GameRegistry.addRecipe(new ItemStack(skullWall, 6), new Object[] {
Expand Down
20 changes: 20 additions & 0 deletions common/com/sirolf2009/necromancy/block/BlockBloodFlowing.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,16 @@

import net.minecraft.block.BlockFlowing;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.Icon;
import net.minecraftforge.liquids.IBlockLiquid;

import com.sirolf2009.necromancy.Necromancy;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

public class BlockBloodFlowing extends BlockFlowing implements IBlockLiquid {

public BlockBloodFlowing(int par1) {
Expand Down Expand Up @@ -56,4 +61,19 @@ public NBTTagCompound getLiquidProperties() {
public String getLiquidBlockTextureFile() {
return "necromancy:blood";
}

@Override
public void registerIcons(IconRegister par1IconRegister) {
theIcon = new Icon[] { par1IconRegister.registerIcon("necromancy:blood"), par1IconRegister.registerIcon("necromancy:blood_flow") };
iconForWorldRender = theIcon;
iconForInvRender = iconForWorldRender[0];
}

@SideOnly(Side.CLIENT)
public static Icon func_94424_b(String par0Str) {
return par0Str == "blood" ? Necromancy.bloodFlowing.iconForWorldRender[0] : Necromancy.bloodFlowing.iconForWorldRender[1];
}

public Icon iconForInvRender;
public Icon[] iconForWorldRender;
}
18 changes: 18 additions & 0 deletions common/com/sirolf2009/necromancy/block/BlockBloodStationary.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,15 @@

import net.minecraft.block.BlockStationary;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.util.Icon;
import net.minecraftforge.liquids.ILiquid;

import com.sirolf2009.necromancy.Necromancy;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

public class BlockBloodStationary extends BlockStationary implements ILiquid {

public BlockBloodStationary(int id) {
Expand All @@ -32,4 +37,17 @@ public int stillLiquidMeta() {
return 0;
}

@Override
public void registerIcons(IconRegister par1IconRegister) {
theIcon = new Icon[] { par1IconRegister.registerIcon("necromancy:blood"), par1IconRegister.registerIcon("necromancy:blood") };
iconForInvRender = theIcon[0];
}

@SideOnly(Side.CLIENT)
public static Icon func_94424_b(String par0Str) {
return par0Str == "blood" ? Necromancy.bloodFlowing.iconForWorldRender[0] : Necromancy.bloodFlowing.iconForWorldRender[1];
}

public Icon iconForInvRender;

}
2 changes: 1 addition & 1 deletion common/com/sirolf2009/necromancy/client/gui/GuiSewing.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ protected void drawGuiContainerForegroundLayer() {
@Override
protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
mc.renderEngine.bindTexture(Reference.LOC_RESOURCES_TEXTURES_GUIS + "/Sewing.png");
mc.renderEngine.bindTexture(Reference.LOC_RESOURCES_TEXTURES_GUIS + "/sewingGui.png");
int var5 = (width - xSize) / 2;
int var6 = (height - ySize) / 2;
drawTexturedModalRect(var5, var6, 0, 0, xSize, ySize);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ public void render(Entity par1Entity, float par2, float par3, float par4, float
GL11.glPushMatrix();
GL11.glTranslatef(armRightPos[0] / 16, armRightPos[1] / 16, armRightPos[2] / 16);
bindTexByPart(parts[3]);
NecroEntityBase mob = NecroEntityRegistry.registeredEntities.get(armLeft[0].name);
mob.preRender(minion, armLeft, "armLeft", this);
NecroEntityBase mob = NecroEntityRegistry.registeredEntities.get(armRight[0].name);
mob.preRender(minion, armLeft, "armRight", this);
for (BodyPart part : armRight) {
part.render(par7);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,25 @@
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;

import com.sirolf2009.necromancy.entity.EntityIsaacBlood;
import com.sirolf2009.necromancy.entity.EntityIsaacBody;

public class RenderIsaacBlood extends RenderLiving {
public class RenderIsaacMelee extends RenderLiving {

public RenderIsaacBlood(ModelBase par1ModelBase, float par2) {
public RenderIsaacMelee(ModelBase par1ModelBase, float par2) {
super(par1ModelBase, par2);
}

@Override
public void doRenderLiving(EntityLiving el, double d1, double d2, double d3, float f1, float f2) {
renderIsaacNormal((EntityIsaacBlood) el, d1, d2, d3, f1, f2);
renderIsaacNormal((EntityIsaacBody) el, d1, d2, d3, f1, f2);
}

@Override
public void doRender(Entity el, double d1, double d2, double d3, float f1, float f2) {
renderIsaacNormal((EntityIsaacBlood) el, d1, d2, d3, f1, f2);
renderIsaacNormal((EntityIsaacBody) el, d1, d2, d3, f1, f2);
}

public void renderIsaacNormal(EntityIsaacBlood em, double d1, double d2, double d3, float f1, float f2) {
public void renderIsaacNormal(EntityIsaacBody em, double d1, double d2, double d3, float f1, float f2) {
super.doRenderLiving(em, d1, d2, d3, f1, f2);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,26 @@
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;

import com.sirolf2009.necromancy.entity.EntityIsaacBlood;
import com.sirolf2009.necromancy.entity.EntityIsaacNormal;

public class RenderIsaacNormal extends RenderLiving {
public class RenderIsaacRanged extends RenderLiving {

public RenderIsaacNormal(ModelBase par1ModelBase, float par2) {
public RenderIsaacRanged(ModelBase par1ModelBase, float par2) {
super(par1ModelBase, par2);
}

@Override
public void doRenderLiving(EntityLiving el, double d1, double d2, double d3, float f1, float f2) {
renderIsaacNormal((EntityIsaacNormal) el, d1, d2, d3, f1, f2);
renderIsaac((EntityIsaacNormal) el, d1, d2, d3, f1, f2);
}

@Override
public void doRender(Entity el, double d1, double d2, double d3, float f1, float f2) {
renderIsaacNormal((EntityIsaacNormal) el, d1, d2, d3, f1, f2);
renderIsaac((EntityIsaacNormal) el, d1, d2, d3, f1, f2);
}

public void renderIsaacNormal(EntityIsaacNormal em, double d1, double d2, double d3, float f1, float f2) {
public void renderIsaac(EntityIsaacNormal em, double d1, double d2, double d3, float f1, float f2) {
super.doRenderLiving(em, d1, d2, d3, f1, f2);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;

import com.sirolf2009.necromancy.entity.EntityTear;
import com.sirolf2009.necromancy.item.ItemNecromancy;

import cpw.mods.fml.relauncher.Side;
Expand All @@ -22,11 +21,7 @@ public class RenderTear extends Render {

@Override
public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9) {

Icon icon = ItemNecromancy.tearNormal;
if (((EntityTear) par1Entity).type == "Blood") {
icon = ItemNecromancy.tearBlood;
}

if (icon != null) {
GL11.glPushMatrix();
Expand Down
Loading

0 comments on commit 854d6f0

Please sign in to comment.