Skip to content

Commit

Permalink
version 1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
sirolf2009 committed Jun 12, 2013
1 parent aa48211 commit aafd309
Show file tree
Hide file tree
Showing 21 changed files with 319 additions and 1,402 deletions.
27 changes: 15 additions & 12 deletions common/com/sirolf2009/necromancy/Necromancy.java
Original file line number Diff line number Diff line change
Expand Up @@ -196,10 +196,8 @@ public void preInit(FMLPreInitializationEvent event) {
NecroEntityBase.organID = OrgansID;

MinecraftForge.EVENT_BUS.register(eventHandler);
}

@Mod.Init
public void init(FMLInitializationEvent event) {
LanguageRegistry.instance().addStringLocalization("itemGroup.Necromancy", "en_US", "Necromancy");
LanguageRegistry.instance().addStringLocalization("itemGroup.BodyParts", "en_US", "Bodyparts");
initItems();
Expand All @@ -214,14 +212,6 @@ public void init(FMLInitializationEvent event) {
VillagerRegistry.instance().registerVillageCreationHandler(packetHandler);
ArrayList<Class<PacketHandler>> villageComponentsList = new ArrayList<Class<PacketHandler>>();
villageComponentsList.add(PacketHandler.class);
NecronomiconAchieve = new Achievement(666, "NecronomiconAchieve", 0, 0, necronomicon, null).registerAchievement();
SewingAchieve = new Achievement(666 + 1, "SewingAchieve", -2, 0, sewing, NecronomiconAchieve).registerAchievement();
AltarAchieve = new Achievement(666 + 2, "AltarAchieve", 0, 2, altar, NecronomiconAchieve).registerAchievement();
SpawnAchieve = new Achievement(666 + 3, "SpawnAchieve", 2, 4, necromanticItems, AltarAchieve).registerAchievement().setSpecial();

addAchievementLocalizations();
achievePage = new AchievementPage("Necromancy", new Achievement[] { NecronomiconAchieve, SpawnAchieve, AltarAchieve, SewingAchieve });
AchievementPage.registerAchievementPage(achievePage);

GameRegistry.registerWorldGenerator(new WorldGenerator());

Expand All @@ -235,6 +225,19 @@ public void init(FMLInitializationEvent event) {
} catch (IOException e) {
System.err.println("not connected to the internet, special scythes are de-activated");
}

NecronomiconAchieve = new Achievement(666, "NecronomiconAchieve", 0, 0, necronomicon, null).registerAchievement();
SewingAchieve = new Achievement(666 + 1, "SewingAchieve", -2, 0, sewing, NecronomiconAchieve).registerAchievement();
AltarAchieve = new Achievement(666 + 2, "AltarAchieve", 0, 2, altar, NecronomiconAchieve).registerAchievement();
SpawnAchieve = new Achievement(666 + 3, "SpawnAchieve", 2, 4, necromanticItems, AltarAchieve).registerAchievement().setSpecial();

addAchievementLocalizations();
achievePage = new AchievementPage("Necromancy", new Achievement[] { NecronomiconAchieve, SpawnAchieve, AltarAchieve, SewingAchieve });
AchievementPage.registerAchievementPage(achievePage);
}

@Mod.Init
public void init(FMLInitializationEvent event) {
}

@Mod.PostInit
Expand Down Expand Up @@ -266,7 +269,7 @@ private void initEntities() {
EntityRegistry.registerGlobalEntityID(EntityNightCrawler.class, "NightCrawler", EntityRegistry.findGlobalUniqueEntityId(), new Color(6, 6, 6).getRGB(), new Color(13, 13, 13).getRGB());
EntityRegistry.registerModEntity(EntityNightCrawler.class, "NightCrawler", modIDs++, this, 80, 1, true);
LanguageRegistry.instance().addStringLocalization("entity.NightCrawler.name", "en_US", "Night Crawler");
EntityRegistry.addSpawn(EntityNightCrawler.class, 1, 1, 1, EnumCreatureType.monster, BiomeGenBase.forest, BiomeGenBase.swampland);
EntityRegistry.addSpawn(EntityNightCrawler.class, 1, 1, 1, EnumCreatureType.monster, BiomeGenBase.beach);

IsaacID = EntityRegistry.findGlobalUniqueEntityId();
EntityRegistry.registerGlobalEntityID(EntityIsaacNormal.class, "IsaacNormal", IsaacID, new Color(6, 6, 6).getRGB(), new Color(204, 153, 153).getRGB());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ public BlockBloodFlowing(int par1) {
super(par1, Material.water);
blockHardness = 100F;
this.setLightOpacity(3);
this.setCreativeTab(Necromancy.tabNecromancy);
this.setUnlocalizedName("BloodFlowing");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ public BlockBloodStationary(int id) {
blockHardness = 100F;
this.setLightOpacity(3);
this.setUnlocalizedName("BloodStationary");
this.setCreativeTab(Necromancy.tabNecromancy);
this.disableStats();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.sirolf2009.necromancy.client.model;

import org.lwjgl.opengl.GL11;

import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
Expand Down Expand Up @@ -183,6 +185,9 @@ public ModelNightCrawler() {
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
super.render(entity, f, f1, f2, f3, f4, f5);
setRotationAngles(f, f1, f2, f3, f4, f5, entity);
GL11.glPushMatrix();
GL11.glScalef(1.4F, 1.4F, 1.4F);
GL11.glTranslatef(0, -.4F, 0);
midBody.render(f5);
upperBody.render(f5);
neck.render(f5);
Expand All @@ -201,6 +206,7 @@ public void render(Entity entity, float f, float f1, float f2, float f3, float f
headset.render(f5);
leftarmset.render(f5);
rightarmset.render(f5);
GL11.glPopMatrix();
}

private void setRotation(ModelRenderer model, float x, float y, float z) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import com.sirolf2009.necromancy.Necromancy;
import com.sirolf2009.necromancy.client.model.ModelScythe;
import com.sirolf2009.necromancy.client.model.ModelScytheSpecial;
import com.sirolf2009.necromancy.core.proxy.ClientProxy;
import com.sirolf2009.necromancy.lib.Reference;

import cpw.mods.fml.client.FMLClientHandler;
Expand Down Expand Up @@ -49,19 +48,19 @@ public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
renderScythe(0F, 1F, 0F, 1F, 1F, 180F, 1);
break;
case EQUIPPED:
if (ClientProxy.mc.gameSettings.thirdPersonView == 0) {
/*if (ClientProxy.mc.gameSettings.thirdPersonView == 0) {
if (isSpecial) {
renderSpecialScythe(0F, 1F, 0F, 20F, -140F, 20F, .6F);
} else {
renderScythe(0F, 2.2F, 0F, -10F, 140F, 180F, 2);
}
} else {
} else {*/
if (isSpecial) {
renderSpecialScythe(.8F, 1.2F, .8F, 0F, -20F, 0F, 1.2F);
renderSpecialScythe(.8F, 1F, .8F, 0F, 220F, 0F, 1.2F);
} else {
renderScythe(-0.8F, 1.2F, 1.6F, 90F, 170F, 130F, 2);
renderScythe(0.8F, 2F, 0.8F, 1F, 120F, 180F, 1.2F);
}
}
//}
break;
case INVENTORY:
renderScythe(0F, 0.4F, 0F, 150F, 60F, 0F, 0.8F);
Expand Down
80 changes: 80 additions & 0 deletions common/com/sirolf2009/necromancy/command/CommandMinion.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
package com.sirolf2009.necromancy.command;

import java.util.ArrayList;
import java.util.List;

import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.network.PacketDispatcher;
import cpw.mods.fml.common.network.Player;

import net.minecraft.command.CommandBase;
import net.minecraft.command.ICommandSender;
import net.minecraft.command.WrongUsageException;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.packet.Packet250CustomPayload;
import net.minecraft.server.MinecraftServer;

public class CommandMinion extends CommandBase {

@Override
public String getCommandName() {
return "minion";
}

@Override
public void processCommand(ICommandSender var1, String[] var2) {
if(var2.length >= 2) {
EntityPlayerMP player = func_82359_c(var1, var1.getCommandSenderName());
NBTTagCompound nbt = player.getEntityData();
Packet250CustomPayload packet = null;
if(var2[0].equals("set")) {
if(var2[1].equals("aggressive")) {
nbt.setBoolean("aggressive", true);
packet = new Packet250CustomPayload("NecromancyMod", new byte[] {0, 1});
var1.sendChatToPlayer("Minions are set to aggressive");
} else if(var2[1].equals("passive")) {
nbt.setBoolean("aggressive", false);
packet = new Packet250CustomPayload("NecromancyMod", new byte[] {0, 0});
var1.sendChatToPlayer("Minions are set to passive");
} else {
throw new WrongUsageException("minion", new Object[0]);
}
} else if(var2[0].equals("friend")) {
nbt.setString(var2[1], "friend");
packet = new Packet250CustomPayload("NecromancyMod", new byte[] {1, (byte) func_82359_c(var1, var2[1]).entityId});
var1.sendChatToPlayer(var2[1]+ " is now a friend");
} else if(var2[0].equals("enemy")) {
nbt.setString(var2[1], "enemy");
packet = new Packet250CustomPayload("NecromancyMod", new byte[] {2, (byte) func_82359_c(var1, var2[1]).entityId});
var1.sendChatToPlayer(var2[1]+ " is now an enemy");
} else {
throw new WrongUsageException("minion", new Object[0]);
}
PacketDispatcher.sendPacketToAllPlayers(packet);
}
}

public List<String> addTabCompletionOptions(ICommandSender par1ICommandSender, String[] par2ArrayOfStr) {
List<String> result = new ArrayList<String>();
if(par2ArrayOfStr.length == 1) {
result.add("set");
result.add("friend");
result.add("enemy");
} else if(par2ArrayOfStr.length == 2) {
if(par2ArrayOfStr[0].equals("set")) {
result.add("aggressive");
result.add("passive");
} else if(par2ArrayOfStr[0].equals("friend") || par2ArrayOfStr[0].equals("enemy")) {
for(int i = 0; i < getPlayers().length; i++)
result.add(getPlayers()[i]);
}
}
return result;
}

protected String[] getPlayers() {
return MinecraftServer.getServer().getAllUsernames();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

import com.sirolf2009.necromancy.Necromancy;
import com.sirolf2009.necromancy.client.model.ModelMinion;
import com.sirolf2009.necromancy.command.CommandMinion;
import com.sirolf2009.necromancy.command.CommandRemodel;
import com.sirolf2009.necromancy.lib.Reference;

Expand All @@ -26,7 +27,7 @@ public class EventHandler {

@ForgeSubscribe
public void LivingDropsEvent(LivingDeathEvent evt) {
if (evt.entity instanceof EntityLiving && !evt.entity.worldObj.isRemote && rand.nextInt(100) <= 4) {
if (evt.entity instanceof EntityLiving && !evt.entity.worldObj.isRemote && rand.nextInt(100) <= 6-1) {
switch (rand.nextInt(7)) {
case 0:
evt.entity.entityDropItem(new ItemStack(Necromancy.organs, 1, 0), 1);
Expand Down Expand Up @@ -55,6 +56,7 @@ public void LivingDropsEvent(LivingDeathEvent evt) {

public void initCommands(FMLServerStartingEvent event) {
event.registerServerCommand(new CommandRemodel());
event.registerServerCommand(new CommandMinion());
}

@ForgeSubscribe
Expand Down
29 changes: 23 additions & 6 deletions common/com/sirolf2009/necromancy/core/handler/PacketHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@
import java.util.List;
import java.util.Random;

import org.bouncycastle.util.encoders.Hex;

import net.minecraft.entity.Entity;
import net.minecraft.entity.passive.EntityVillager;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.network.INetworkManager;
import net.minecraft.network.packet.Packet250CustomPayload;
Expand All @@ -20,10 +24,12 @@
import com.sirolf2009.necromancy.block.BlockSewing;
import com.sirolf2009.necromancy.client.gui.GuiAltar;
import com.sirolf2009.necromancy.client.gui.GuiSewing;
import com.sirolf2009.necromancy.core.proxy.ClientProxy;
import com.sirolf2009.necromancy.generation.villagecomponent.ComponentVillageCemetery;
import com.sirolf2009.necromancy.inventory.ContainerAltar;
import com.sirolf2009.necromancy.inventory.ContainerNecronomiconCrafting;
import com.sirolf2009.necromancy.inventory.ContainerSewing;
import com.sirolf2009.necromancy.item.ItemBodyPart;
import com.sirolf2009.necromancy.item.ItemNecroSkull;
import com.sirolf2009.necromancy.item.ItemNecromancy;
import com.sirolf2009.necromancy.tileentity.TileEntityAltar;
Expand Down Expand Up @@ -58,7 +64,6 @@ public Object getClientGuiElement(int ID, EntityPlayer player, World world, int
return null;
}

@SuppressWarnings("static-access")
@Override
public void onCrafting(EntityPlayer player, ItemStack item, IInventory craftMatrix) {
if (item != null && item.getItemName().equals("item.Necronomicon")) {
Expand All @@ -76,9 +81,9 @@ public void onCrafting(EntityPlayer player, ItemStack item, IInventory craftMatr
if (item != null && item.getItemName().equals("tile.skullWall")) {
Necromancy.logger.info(craftMatrix.getStackInSlot(0) + " is in " + craftMatrix.getStackInSlot(0).getItemName());
item.stackTagCompound.setString("Base", craftMatrix.getStackInSlot(1).getItemName());
item.stackTagCompound.setString("Skull1", ((ItemNecroSkull) craftMatrix.getStackInSlot(1).getItem()).skullTypes[craftMatrix.getStackInSlot(1).getItemDamage()]);
item.stackTagCompound.setString("Skull2", ((ItemNecroSkull) craftMatrix.getStackInSlot(4).getItem()).skullTypes[craftMatrix.getStackInSlot(4).getItemDamage()]);
item.stackTagCompound.setString("Skull3", ((ItemNecroSkull) craftMatrix.getStackInSlot(5).getItem()).skullTypes[craftMatrix.getStackInSlot(5).getItemDamage()]);
item.stackTagCompound.setString("Skull1", ItemNecroSkull.skullTypes[craftMatrix.getStackInSlot(1).getItemDamage()]);
item.stackTagCompound.setString("Skull2", ItemNecroSkull.skullTypes[craftMatrix.getStackInSlot(4).getItemDamage()]);
item.stackTagCompound.setString("Skull3", ItemNecroSkull.skullTypes[craftMatrix.getStackInSlot(5).getItemDamage()]);

}
}
Expand All @@ -89,6 +94,16 @@ public void onSmelting(EntityPlayer player, ItemStack item) {

@Override
public void onPacketData(INetworkManager manager, Packet250CustomPayload packet, Player player) {
if(packet.data[0] == 0) {
ClientProxy.mc.thePlayer.getEntityData().setBoolean("aggressive", packet.data[1] == 1);
} else if(packet.data[0] == 1) { //we're making friends :D
EntityPlayer playerEntity = (EntityPlayer) ClientProxy.mc.theWorld.getEntityByID(packet.data[1] & 0xFF);
playerEntity.getEntityData().setString(playerEntity.username, "friend");
} else if(packet.data[0] == 2) { //who needs friends anyway
EntityPlayer playerEntity = (EntityPlayer) ClientProxy.mc.theWorld.getEntityByID(packet.data[1] & 0xFF);
System.out.println("player found by packet data "+playerEntity);
playerEntity.getEntityData().setString(playerEntity.username, "enemy");
}
}

@Override
Expand All @@ -110,7 +125,9 @@ public Object buildComponent(StructureVillagePieceWeight villagePiece, Component
@SuppressWarnings("unchecked")
@Override
public void manipulateTradesForVillager(EntityVillager villager, MerchantRecipeList recipeList, Random random) {
recipeList.add(new MerchantRecipe(new ItemStack(net.minecraft.item.Item.emerald, 6), new ItemStack(net.minecraft.item.Item.book), new ItemStack(Necromancy.necronomicon)));
recipeList.add(new MerchantRecipe(new ItemStack(net.minecraft.item.Item.emerald, 1), new ItemStack(net.minecraft.item.Item.rottenFlesh, 6), new ItemStack(Necromancy.necromanticItems, 1, random.nextInt(ItemNecromancy.names.length))));
recipeList.add(new MerchantRecipe(new ItemStack(Item.emerald, 6), new ItemStack(Item.book), new ItemStack(Necromancy.necronomicon)));
recipeList.add(new MerchantRecipe(new ItemStack(Item.emerald, new Random().nextInt(3)), null, new ItemStack(Necromancy.bodyparts, 1, random.nextInt(ItemBodyPart.necroEntities.size()-1))));
recipeList.add(new MerchantRecipe(new ItemStack(Necromancy.bodyparts, 1, random.nextInt(ItemBodyPart.necroEntities.size()-1)), null, new ItemStack(Item.emerald, new Random().nextInt(3))));
recipeList.add(new MerchantRecipe(new ItemStack(Necromancy.bodyparts, 1, random.nextInt(ItemBodyPart.necroEntities.size()-1)), null, new ItemStack(Item.emerald, new Random().nextInt(3))));
}
}
6 changes: 2 additions & 4 deletions common/com/sirolf2009/necromancy/core/proxy/ClientProxy.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.sirolf2009.necromancy.core.proxy;

import net.minecraft.client.Minecraft;
import net.minecraft.tileentity.TileEntitySkull;
import net.minecraftforge.client.MinecraftForgeClient;
import net.minecraftforge.liquids.LiquidDictionary;
import net.minecraftforge.liquids.LiquidStack;
Expand All @@ -22,7 +21,6 @@
import com.sirolf2009.necromancy.client.renderer.RenderTearBlood;
import com.sirolf2009.necromancy.client.renderer.RenderTeddy;
import com.sirolf2009.necromancy.client.renderer.tileentity.TileEntityAltarRenderer;
import com.sirolf2009.necromancy.client.renderer.tileentity.TileEntityNecroSkullRenderer;
import com.sirolf2009.necromancy.client.renderer.tileentity.TileEntitySewingRenderer;
import com.sirolf2009.necromancy.client.renderer.tileentity.TileEntitySkullWallRenderer;
import com.sirolf2009.necromancy.core.handler.KeyHandlerNecro;
Expand Down Expand Up @@ -67,8 +65,8 @@ public void init() {
RenderingRegistry.registerEntityRenderingHandler(EntityTearBlood.class, new RenderTearBlood());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityAltar.class, new TileEntityAltarRenderer());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntitySewing.class, new TileEntitySewingRenderer());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntitySkullWall.class, new TileEntitySkullWallRenderer());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntitySkull.class, new TileEntityNecroSkullRenderer());
//ClientRegistry.bindTileEntitySpecialRenderer(TileEntitySkullWall.class, new TileEntitySkullWallRenderer());
//ClientRegistry.bindTileEntitySpecialRenderer(TileEntitySkull.class, new TileEntityNecroSkullRenderer());
MinecraftForgeClient.registerItemRenderer(Necromancy.AltarID, new TileEntityAltarRenderer());
MinecraftForgeClient.registerItemRenderer(Necromancy.SewingID, new TileEntitySewingRenderer());
// MinecraftForgeClient.registerItemRenderer(Necromancy.SkullWallID, new
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ public CraftingManagerSewing() {
addRecipe(mob.armItem, mob.armRecipe);
}
if ((mob = (NecroEntityBase) itr.next()).hasLegs) {
System.out.println(mob.mobName + ", " + mob.legItem + ", " + mob.hasLegs);
addRecipe(mob.legItem, mob.legRecipe);
}
}
Expand Down
Loading

0 comments on commit aafd309

Please sign in to comment.