Removed buggy Loot Ball implementation (not likely needing them in EE3, and solved them in EE2)

Restructured sounds to take into account the new resource directory structure, cleaned up the reference of things
This commit is contained in:
pahimar 2012-05-18 15:41:12 -04:00
parent dd7c354fd6
commit eb633a3695
10 changed files with 40 additions and 168 deletions

View file

@ -5,6 +5,9 @@ import java.lang.reflect.Method;
import java.net.URL;
import java.net.URLClassLoader;
import static ee3.lib.Reference.*;
import static ee3.lib.Sounds.*;
import net.minecraft.src.ModLoader;
import net.minecraft.src.SoundManager;
import net.minecraft.src.SoundPoolEntry;
@ -18,17 +21,11 @@ import net.minecraft.src.forge.ISoundHandler;
*/
public class SoundHandler implements ISoundHandler {
private String[] eeSoundFiles = {"ee/sound/break.ogg", "ee/sound/chargetick.ogg", "ee/sound/destruct.ogg",
"ee/sound/flash.ogg", "ee/sound/gust.ogg", "ee/sound/heal.ogg",
"ee/sound/kinesis.ogg", "ee/sound/launch.ogg", "ee/sound/nova.ogg",
"ee/sound/philball.ogg", "ee/sound/tock.ogg", "ee/sound/transmute.ogg",
"ee/sound/wall.ogg", "ee/sound/waterball.ogg", "ee/sound/wind.ogg"};
@Override
// Initializes our entries into the Sound Pool
public void onLoadSoundSettings(SoundManager soundManager) {
for (int i = 0; i < eeSoundFiles.length; i++)
soundManager.getSoundsPool().addSound(eeSoundFiles[i], this.getClass().getResource("/" + eeSoundFiles[i]));
for (int i = 0; i < soundFiles.length; i++)
soundManager.getSoundsPool().addSound(soundFiles[i], this.getClass().getResource("/" + soundFiles[i]));
}
@Override public void onSetupAudio(SoundManager soundManager) { }

View file

@ -119,8 +119,6 @@ public class ConfigurationManager {
DARK_MATTER_ARMOR = prop.getInt();
prop = config.getOrCreateIntProperty("wardOfXeno", CATEGORY_ITEM, 27297);
WARD_OF_XENOPHOBIA = prop.getInt();
prop = config.getOrCreateIntProperty("lootBall", CATEGORY_ITEM, 27298);
LOOT_BALL = prop.getInt();
/* Keybinds */
prop = config.getOrCreateIntProperty("extra", CATEGORY_KEYBIND, 46);

View file

@ -1,38 +0,0 @@
package ee3.core;
import ee3.item.ItemLootBall;
import net.minecraft.src.EntityItem;
import net.minecraft.src.EntityPlayer;
import net.minecraft.src.ItemStack;
import net.minecraft.src.forge.IPickupHandler;
public class PickupHandler implements IPickupHandler {
public PickupHandler() { }
@Override
public boolean onItemPickup(EntityPlayer player, EntityItem entityItem) {
ItemStack itemstack = entityItem.item;
if (itemstack == null || itemstack.stackSize <= 0)
return false;
if (entityItem.item.getItem() instanceof ItemLootBall) {
System.out.println("Found a loot ball");
ItemLootBall lootBall = (ItemLootBall) itemstack.getItem();
ItemStack[] loot = lootBall.inventory.getInventoryContents();
if (loot != null)
for (int i = 0; i < loot.length; i++) {
if (player.inventory.addItemStackToInventory(loot[i]) == false)
player.dropPlayerItem(loot[i]);
}
// Destroy the itemstack
itemstack.stackSize = 0;
}
return true;
}
}

View file

@ -1,75 +0,0 @@
package ee3.item;
import ee3.lib.Reference;
import net.minecraft.src.EntityPlayer;
import net.minecraft.src.IInventory;
import net.minecraft.src.Item;
import net.minecraft.src.ItemStack;
import net.minecraft.src.NBTTagCompound;
import net.minecraft.src.NBTTagList;
public class InventoryLootBall implements IInventory {
public ItemStack parent;
public ItemStack[] inventoryStacks;
public InventoryLootBall(int i) {
inventoryStacks = new ItemStack[i];
}
public InventoryLootBall(ItemStack parent, ItemStack[] itemStacks) {
this.parent = parent;
this.inventoryStacks = itemStacks;
readFromNBT(parent.getTagCompound());
}
private void save() {
NBTTagCompound nbttagcompound = parent.getTagCompound();
if(nbttagcompound == null)
nbttagcompound = new NBTTagCompound();
writeToNBT(nbttagcompound);
parent.setTagCompound(nbttagcompound);
}
public void readFromNBT(NBTTagCompound nbttagcompound) {
if(nbttagcompound == null)
return;
if(nbttagcompound.hasKey("Items")) {
NBTTagList nbttaglist = nbttagcompound.getTagList("Items");
inventoryStacks = new ItemStack[getSizeInventory()];
for(int i = 0; i < nbttaglist.tagCount(); i++) {
NBTTagCompound nbttagcompound1 = (NBTTagCompound)nbttaglist.tagAt(i);
byte byte0 = nbttagcompound1.getByte("Slot");
if(byte0 >= 0 && byte0 < inventoryStacks.length)
inventoryStacks[byte0] = ItemStack.loadItemStackFromNBT(nbttagcompound1);
}
}
}
public void writeToNBT(NBTTagCompound nbttagcompound) {
NBTTagList nbttaglist = new NBTTagList();
for(int i = 0; i < inventoryStacks.length; i++)
if(inventoryStacks[i] != null) {
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
nbttagcompound1.setByte("Slot", (byte)i);
inventoryStacks[i].writeToNBT(nbttagcompound1);
nbttaglist.appendTag(nbttagcompound1);
}
nbttagcompound.setTag("Items", nbttaglist);
}
public ItemStack[] getInventoryContents() { return inventoryStacks; }
@Override public int getSizeInventory() { return inventoryStacks.length; }
@Override public ItemStack getStackInSlot(int var1) { return inventoryStacks[var1]; }
@Override public ItemStack decrStackSize(int var1, int var2) { return null; }
@Override public ItemStack getStackInSlotOnClosing(int var1) { return null; }
@Override public void setInventorySlotContents(int var1, ItemStack var2) { inventoryStacks[var1] = var2; }
@Override public String getInvName() { return "Loot Ball"; }
@Override public int getInventoryStackLimit() { return 64; }
@Override public void onInventoryChanged() { }
@Override public boolean isUseableByPlayer(EntityPlayer var1) { return true; }
@Override public void openChest() { }
@Override public void closeChest() { }
}

View file

@ -1,23 +0,0 @@
package ee3.item;
import net.minecraft.src.Item;
import net.minecraft.src.ItemStack;
public class ItemLootBall extends ItemEE {
public InventoryLootBall inventory;
public ItemLootBall(int i) {
super(i);
inventory = new InventoryLootBall(new ItemStack(this), null);
}
public ItemLootBall(int i, ItemStack[] itemStack) {
super(i);
inventory = new InventoryLootBall(new ItemStack(this), itemStack);
}
public void setInventory(ItemStack[] items) {
inventory = new InventoryLootBall(new ItemStack(this), items);
}
}

View file

@ -21,17 +21,14 @@ public class ModItems {
initialized = true;
System.out.println("philStone: " + ItemIds.PHIL_STONE);
System.out.println("lootBall: " + ItemIds.LOOT_BALL);
/* Initialise each mod item individually */
philStone = new ItemPhilosopherStone(ItemIds.PHIL_STONE).setIconCoord(0, 0).setItemName("philStone");
lootBall = new ItemLootBall(ItemIds.LOOT_BALL).setIconCoord(11, 6).setItemName("lootBall");
/* Set the Container items for our mod items */
philStone.setContainerItem(philStone);
/* Add the item names to the mod items */
ModLoader.addName(philStone, "Philosopher's Stone");
ModLoader.addName(lootBall, "Loot Ball");
}
}

View file

@ -36,5 +36,4 @@ public class ItemIds {
public static int DARK_MATTER_BOW;
public static int DARK_MATTER_FISHING_ROD;
public static int DARK_MATTER_ARMOR;
public static int LOOT_BALL = 27298;
}

View file

@ -18,4 +18,5 @@ public class Reference {
public static final String GUI_SHEET_LOCATION = "/ee3/art/gui/";
public static final String ARMOR_SHEET_LOCATION = "/ee3/art/armor/";
public static final String SOUND_RESOURCE_LOCATION = "/ee3/sound/";
public static final String SOUND_PREFIX = "ee3.sound.";
}

View file

@ -1,24 +1,43 @@
package ee3.lib;
import static ee3.lib.Reference.*;
/**
* TODO Class Description
* @author pahimar
*
*/
public class Sounds {
public static final String BREAK = "ee.sound.break";
public static final String CHARGE_TICK = "ee.sound.chargetick";
public static final String DESTRUCTION = "ee.sound.destruct";
public static final String FLASH = "ee.sound.flash";
public static final String GUST = "ee.sound.gust";
public static final String HEAL = "ee.sound.heal";
public static final String KINESIS = "ee.sound.kinesis";
public static final String LAUNCH = "ee.sound.launch";
public static final String NOVA = "ee.sound.nova";
public static final String PHILOSOPHERS_BALL = "ee.sound.philball";
public static final String TOCK = "ee.sound.tock";
public static final String TRANSMUTE = "ee.sound.transmute";
public static final String WALL = "ee.sound.wall";
public static final String WATER_BALL = "ee.sound.waterball";
public static final String WIND = "ee.sound.wind";
public static String[] soundFiles = {SOUND_RESOURCE_LOCATION + "break.ogg",
SOUND_RESOURCE_LOCATION + "chargetick.ogg",
SOUND_RESOURCE_LOCATION + "destruct.ogg",
SOUND_RESOURCE_LOCATION + "flash.ogg",
SOUND_RESOURCE_LOCATION + "gust.ogg",
SOUND_RESOURCE_LOCATION + "heal.ogg",
SOUND_RESOURCE_LOCATION + "kinesis.ogg",
SOUND_RESOURCE_LOCATION + "launch.ogg",
SOUND_RESOURCE_LOCATION + "nova.ogg",
SOUND_RESOURCE_LOCATION + "philball.ogg",
SOUND_RESOURCE_LOCATION + "tock.ogg",
SOUND_RESOURCE_LOCATION + "transmute.ogg",
SOUND_RESOURCE_LOCATION + "wall.ogg",
SOUND_RESOURCE_LOCATION + "waterball.ogg",
SOUND_RESOURCE_LOCATION + "wind.ogg"};
public static final String BREAK = SOUND_PREFIX + "break";
public static final String CHARGE_TICK = SOUND_PREFIX + "chargetick";
public static final String DESTRUCTION = SOUND_PREFIX + "destruct";
public static final String FLASH = SOUND_PREFIX + "flash";
public static final String GUST = SOUND_PREFIX + "gust";
public static final String HEAL = SOUND_PREFIX + "heal";
public static final String KINESIS = SOUND_PREFIX + "kinesis";
public static final String LAUNCH = SOUND_PREFIX + "launch";
public static final String NOVA = SOUND_PREFIX + "nova";
public static final String PHILOSOPHERS_BALL = SOUND_PREFIX + "philball";
public static final String TOCK = SOUND_PREFIX + "tock";
public static final String TRANSMUTE = SOUND_PREFIX + "transmute";
public static final String WALL = SOUND_PREFIX + "wall";
public static final String WATER_BALL = SOUND_PREFIX + "waterball";
public static final String WIND = SOUND_PREFIX + "wind";
}

View file

@ -2,7 +2,6 @@ package net.minecraft.src;
import ee3.addons.BuildCraftAddon;
import ee3.core.ConfigurationManager;
import ee3.core.PickupHandler;
import ee3.core.RecipesPhilStone;
import ee3.core.ServerClientProxy;
import ee3.core.Version;
@ -60,8 +59,6 @@ public class mod_EE3 extends NetworkMod {
RecipesPhilStone.initRecipes();
BuildCraftAddon.init();
MinecraftForge.registerPickupHandler(new PickupHandler());
}
@Override