Skip to content

Commit

Permalink
Updated Tombstone XP drop and made big changes to Spike item
Browse files Browse the repository at this point in the history
  • Loading branch information
soultek101 committed Oct 22, 2014
1 parent f60d646 commit 4b433d7
Show file tree
Hide file tree
Showing 37 changed files with 545 additions and 81 deletions.
14 changes: 10 additions & 4 deletions src/main/java/com/stek101/projectzulu/common/DeathGamerules.java
Original file line number Diff line number Diff line change
Expand Up @@ -220,13 +220,19 @@ public void onPlayerDeath(PlayerDropsEvent event) {

/* Get items/XP to drop and clear them from Player */
int xpDropped = 0;

if (dropXP) {
if (!player.worldObj.isRemote) {
if (maxDropXP + percKeptXp > 100){
ProjectZuluLog.warning("Warning : The total of MaxDropXP and percKeptXP is greater than 100. Resetting to default");
maxDropXP = 100;
percKeptXp = 0;
}
//xpDropped = player.experienceTotal;
xpDropped = player.experienceTotal * (maxDropXP/100);
int keptXp = (player.experienceTotal - xpDropped) * (percKeptXp / 100);

xpDropped = xpDropped > maxDropXP ? maxDropXP : xpDropped;
xpDropped = (int) (player.experienceTotal * ((float) maxDropXP/100));

int keptXp = (int) ((player.experienceTotal - xpDropped) * ((float) percKeptXp / 100));
//xpDropped = xpDropped > maxDropXP ? maxDropXP : xpDropped;

redistributor.addExperience(player, keptXp >= 0 ? keptXp : 0);
player.experienceLevel = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,10 @@ public void registration(ItemBlockManager manager) {
new PalmTreeSlabDeclaration(), new PalmTreeDoubleSlabDeclaration(), new PalmTreeStairsDeclaration(),
new PalmTreeLeavesDeclaration(), new PalmTreeSapling(), new CoconutDeclaration(),
new QuickSandDeclaration(), new NightBloomDeclaration(), new CreeperBlossomDeclaration(),
new SpikesDeclaration(), new CampfireDeclaration(), new MobSkullsDeclaration(),
new SpikesDeclaration("Ivory"), new CampfireDeclaration(), new MobSkullsDeclaration(),
new TombstoneDeclaration(), new UniversalFlowerPotDeclaration(), new BrewingStandSingleDeclaration(),
new BrewingStandTripleDeclaration());
new BrewingStandTripleDeclaration(), new SpikesDeclaration("Wood"), new SpikesDeclaration("Stone"),
new SpikesDeclaration("Iron"));

manager.addItemBlock(new AnkhDeclaration(), new AloeVeraSeedsDeclaration(), new WaterDropletDeclaration(),
new CoconutMilkFragmentDeclaration(), new CoconutSeedDeclaration(), new CoconutShellDeclaration(),
Expand Down
15 changes: 12 additions & 3 deletions src/main/java/com/stek101/projectzulu/common/ProjectZulu_Core.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@ public static int getNextDefaultEggID() {
// public static PacketPipeline getPipeline() {
// return packetPipeline;
// }

public static String Updates = "";
public static boolean modOutDated = false;
public static boolean checkForUpdates = true;
//UpdateEventHandler UEH = new UpdateEventHandler();

@SidedProxy(clientSide = "com.stek101.projectzulu.common.ClientProxyProjectZulu", serverSide = "com.stek101.projectzulu.common.CommonProxyProjectZulu")
public static CommonProxyProjectZulu proxy;
Expand All @@ -110,6 +115,10 @@ public String getIdentifier() {

@EventHandler
public void preInit(FMLPreInitializationEvent event) {
//if (checkForUpdates)
// UpdateMonitor.checkForUpdates();
//FMLCommonHandler.instance().bus().register(new UpdateEventHandler());

modConfigDirectoryFile = event.getModConfigurationDirectory();

ProjectZuluLog.configureLogging(modConfigDirectoryFile);
Expand Down Expand Up @@ -166,8 +175,7 @@ public void preInit(FMLPreInitializationEvent event) {
ProjectZuluLog.info("Completed ItemBlock Registration");

ProjectZuluLog.info("Registering Entites");
CustomEntityManager.INSTANCE.registerEntities(modConfigDirectoryFile);

CustomEntityManager.INSTANCE.registerEntities(modConfigDirectoryFile);
}

private void attemptLoadModule(String classResourceName) {
Expand Down Expand Up @@ -238,5 +246,6 @@ public void serverStart(FMLServerStartedEvent event) {
moduleInfo.module.serverStart(event, modConfigDirectoryFile);
}
}
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,8 @@
import com.stek101.projectzulu.common.mobs.entitydefaults.GreenFinchDeclaration;
import com.stek101.projectzulu.common.mobs.entitydefaults.HauntedArmorDeclaration;
import com.stek101.projectzulu.common.mobs.entitydefaults.HornbillDeclaration;
import com.stek101.projectzulu.common.mobs.entitydefaults.HorseBeigeDeclaration;
import com.stek101.projectzulu.common.mobs.entitydefaults.HorseBlackDeclaration;
import com.stek101.projectzulu.common.mobs.entitydefaults.HorseBrownDeclaration;
import com.stek101.projectzulu.common.mobs.entitydefaults.HorseDarkBlackDeclaration;
import com.stek101.projectzulu.common.mobs.entitydefaults.HorseDarkBrownDeclaration;
import com.stek101.projectzulu.common.mobs.entitydefaults.HorseGreyDeclaration;
import com.stek101.projectzulu.common.mobs.entitydefaults.HorseRandomDeclaration;
import com.stek101.projectzulu.common.mobs.entitydefaults.HorseWhiteDeclaration;
import com.stek101.projectzulu.common.mobs.entitydefaults.LizardDeclaration;
import com.stek101.projectzulu.common.mobs.entitydefaults.LizardSpitDeclaration;
import com.stek101.projectzulu.common.mobs.entitydefaults.MammothDeclaration;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.stek101.projectzulu.common;

import net.minecraft.util.ChatComponentText;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.PlayerEvent;

public class UpdateEventHandler {

@SubscribeEvent
public void checkForUpdate(PlayerEvent.PlayerLoggedInEvent event)
{
if(ProjectZulu_Core.modOutDated)
{
event.player.addChatComponentMessage(new ChatComponentText("Attention : Your copy of the Project Zulu mod for MC 1.7.10 is Outdated. Please visit the Project Zulu for MC 1.7.10 thread in the Minecraft Forums to get the latest copy."));
//event.player.addChatComponentMessage(new ChatComponentText("Changelog: http://www.yahoo.com"));
//event.player.addChatComponentMessage(new ChatComponentText(updates));
}
}
}
98 changes: 98 additions & 0 deletions src/main/java/com/stek101/projectzulu/common/UpdateMonitor.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
package com.stek101.projectzulu.common;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;

import com.stek101.projectzulu.common.core.DefaultProps;

public class UpdateMonitor {


public static void checkForUpdates()
{
int currentVersion = DefaultProps.Version_Code;
int nextVersion = getLatest();
if (currentVersion < nextVersion)
{
//ProjectZulu_Core.Updates = getUpdate(nextVersion);
ProjectZulu_Core.modOutDated = true;
}
else
{
ProjectZulu_Core.modOutDated = false;
}
}

public static int getLatest()
{
try
{
URL url = new URL("http://soultek101.weebly.com/uploads/4/1/2/0/41209035/versioncontrol.txt");
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("GET");
connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
connection.setRequestProperty("Content-Language", "en-US");
connection.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.56 Safari/535.11");
connection.setUseCaches(false);
connection.setDoInput(true);
connection.setDoOutput(true);

InputStream is = connection.getInputStream();

BufferedReader br = new BufferedReader(new InputStreamReader(is));
String line;
StringBuffer response = new StringBuffer();

while ((line = br.readLine()) != null)
{
response.append(line);
}
br.close();
return Integer.parseInt(response.toString());
}
catch (IOException e)
{
e.printStackTrace();
}
return -1;
}

/* private static String getUpdate(int version)
{
try
{
URL url = new URL("http://soultek101.weebly.com/uploads/4/1/2/0/41209035/versioncontrol.txt");
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("POST");
connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
connection.setRequestProperty("Content-Language", "en-US");
connection.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.56 Safari/535.11");
connection.setUseCaches(false);
connection.setDoInput(true);
connection.setDoOutput(true);
InputStream is = connection.getInputStream();
BufferedReader br = new BufferedReader(new InputStreamReader(is));
String line;
StringBuffer response = new StringBuffer();
while ((line = br.readLine()) != null)
{
response.append(line);
}
br.close();
return response.toString();
}
catch (IOException e)
{
e.printStackTrace();
}
return "Error";
} */

}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ public enum BlockList {
public static Optional<? extends Block> creeperBlossom = Optional.absent();
public static Optional<? extends Block> quickSand = Optional.absent();

public static Optional<? extends Block> spike = Optional.absent();
public static Optional<? extends Block> spike_ivory = Optional.absent();
public static Optional<? extends Block> spike_wood = Optional.absent();
public static Optional<? extends Block> spike_stone = Optional.absent();
public static Optional<? extends Block> spike_iron = Optional.absent();
public static Optional<? extends Block> campfire = Optional.absent();
public static Optional<? extends Block> mobHeads = Optional.absent();
public static Optional<? extends Block> tombstone = Optional.absent();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public enum ItemList {
public static Optional<? extends Item> hammerToolNether = Optional.absent();
public static Optional<? extends Item> hammerToolDiamond = Optional.absent();
public static Optional<? extends Item> hammerToolGold = Optional.absent();
public static Optional<? extends Item> xpGem = Optional.absent();

/* Armor */
public static Optional<? extends Item> scaleArmorHead = Optional.absent();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ public static void setupBlockModuleRecipies() {
'S' }, new OptionalItemStack(Items.gold_ingot), new OptionalItemStack(Items.stick));
addRecipe(new OptionalItemStack(ItemList.hammerToolDiamond), new String[] { "XSX", " S ", " S " }, new char[] { 'X',
'S' }, new OptionalItemStack(Items.diamond), new OptionalItemStack(Items.stick));
addRecipe(new OptionalItemStack(ItemList.hammerToolDiamond), new String[] { "XSX", " S ", " S " }, new char[] { 'X',
'S' }, new OptionalItemStack(Items.diamond), new OptionalItemStack(Items.stick));

/* Tombstone */
addRecipe(new OptionalItemStack(BlockList.tombstone), new String[] { "CCC", "CSC", "CCC" }, new char[] { 'C',
Expand Down Expand Up @@ -143,8 +145,19 @@ public static void setupBlockModuleRecipies() {
addShapelessRecipe(
new OptionalItemStack(ItemList.genericCraftingItems, 2, ItemGenerics.Properties.Salt.meta()),
new OptionalItemStack(Items.gunpowder));
addRecipe(new OptionalItemStack(BlockList.spike), new String[] { " ", " ", "TTT" }, 'T',

addRecipe(new OptionalItemStack(BlockList.spike_ivory), new String[] { " ", " ", "TTT" }, 'T',
new OptionalItemStack(ItemList.genericCraftingItems, 1, ItemGenerics.Properties.Tusk.meta()));

addRecipe(new OptionalItemStack(BlockList.spike_wood), new String[] { " ", " X ", "XXX" }, 'X',
new OptionalItemStack(Items.stick));

addRecipe(new OptionalItemStack(BlockList.spike_iron), new String[] { " ", " X ", "XXX" }, 'X',
new OptionalItemStack(Items.iron_ingot));

addRecipe(new OptionalItemStack(BlockList.spike_stone), new String[] { " ", " X ", "XXX" }, 'X',
new OptionalItemStack(Blocks.stone));

addShapelessRecipe(new OptionalItemStack(Items.string), new OptionalItemStack(ItemList.genericCraftingItems, 1,
ItemGenerics.Properties.RawFiber.meta()), new OptionalItemStack(ItemList.genericCraftingItems, 1,
ItemGenerics.Properties.RawFiber.meta()), new OptionalItemStack(ItemList.genericCraftingItems, 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,10 @@
import net.minecraft.world.World;
import net.minecraftforge.oredict.OreDictionary;

import com.google.common.base.Optional;
import com.google.common.collect.Sets;
import com.stek101.projectzulu.common.ProjectZulu_Core;
import com.stek101.projectzulu.common.api.BlockList;
import com.stek101.projectzulu.common.api.ItemList;
import com.stek101.projectzulu.common.core.DefaultProps;
import com.stek101.projectzulu.common.core.OptionalItemStack;


import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.relauncher.Side;
Expand Down Expand Up @@ -293,11 +289,5 @@ else if (blockMetaData == 1){
}
return true;
}

// @Override
// public boolean onBlockStartBreak(ItemStack itemstack, int x, int y, int z, EntityPlayer entityplayer) {





}
66 changes: 66 additions & 0 deletions src/main/java/com/stek101/projectzulu/common/blocks/ItemXPGem.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
package com.stek101.projectzulu.common.blocks;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;

import com.stek101.projectzulu.common.ProjectZulu_Core;
import com.stek101.projectzulu.common.core.DefaultProps;

public class ItemXPGem extends Item {
private int storedXP;
private String playerName;

public ItemXPGem(boolean full3D, String name, int xpAmount) {
/*maxStackSize = 64;
setMaxDamage(10);
setCreativeTab(ProjectZulu_Core.projectZuluCreativeTab);
bFull3D = full3D;
setHasSubtypes(true);
setUnlocalizedName(name);
setTextureName(DefaultProps.blockKey + ":" + name);
this.storedXP = xpAmount;*/
this(full3D, name, xpAmount, "");
}

public ItemXPGem(boolean full3D, String name, int xpAmount, String playerName) {
super();
maxStackSize = 1;
setMaxDamage(10);
setCreativeTab(ProjectZulu_Core.projectZuluCreativeTab);
bFull3D = full3D;
setHasSubtypes(true);
setUnlocalizedName(name);
setTextureName(DefaultProps.blockKey + ":" + name);
this.storedXP = xpAmount;
this.playerName = playerName;
}

public void setStoredXP(int xpAmount){
storedXP = xpAmount;
}

@Override
public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer player) {
if (this.playerName != "") {
if (player.getDisplayName() == this.playerName)
{
player.addExperience(this.storedXP);
itemstack.damageItem(10, player);
}
else
{
System.out.println("Your are not the owner of this XP Gem. BEGONE!!!!");
}
}
else{
itemstack.damageItem(10, player);
}
return itemstack;
}




}
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package com.stek101.projectzulu.common.blocks;

import net.minecraft.item.ItemStack;

import com.stek101.projectzulu.common.api.ItemList;

import net.minecraft.item.ItemStack;
import cpw.mods.fml.common.IFuelHandler;

public class PZFuelHandler implements IFuelHandler {
Expand Down
Loading

0 comments on commit 4b433d7

Please sign in to comment.