Working sounds

This commit is contained in:
mDiyo 2013-05-12 19:24:44 -07:00
parent 979d876e0b
commit 34b48b29f0
15 changed files with 108 additions and 89 deletions

View File

@ -37,7 +37,7 @@ import cpw.mods.fml.common.registry.VillagerRegistry;
* @dependencies: IC2 API
*/
@Mod(modid = "TConstruct", name = "TConstruct", version = "1.5.1_1.3.3.11", dependencies = "required-after:Forge@[7.7.1.675,)")
@Mod(modid = "TConstruct", name = "TConstruct", version = "1.5.1_1.3.3.12", dependencies = "required-after:Forge@[7.7.1.675,)")
@NetworkMod(serverSideRequired = false, clientSideRequired = true, channels = { "TConstruct" }, packetHandler = mods.tinker.tconstruct.util.network.TPacketHandler.class)
public class TConstruct
{

View File

@ -325,7 +325,7 @@ public class TContent implements IFuelHandler
pickaxe = new Pickaxe(PHConstruct.pickaxe);
shovel = new Shovel(PHConstruct.shovel);
axe = new Axe(PHConstruct.axe);
axe = new Hatchet(PHConstruct.axe);
broadsword = new Broadsword(PHConstruct.broadsword);
longsword = new Longsword(PHConstruct.longsword);
rapier = new Rapier(PHConstruct.rapier);

View File

@ -60,8 +60,8 @@ public class SlotTool extends Slot
for (int i = 1; i <= 3; i++)
inventory.decrStackSize(i, 1);
if (!player.worldObj.isRemote && full )
//player.worldObj.playSoundEffect(player.posX, player.posY, player.posZ, "crafting.saw", 0.5F, 0.4F / (random.nextFloat() * 0.4F + 0.8F));
player.worldObj.playAuxSFX(1021, (int)player.posX, (int)player.posY, (int)player.posZ, 0);
player.worldObj.playSoundEffect(player.posX, player.posY, player.posZ, "mods.tinker.resources.sounds.little_saw", 1.0F, (random.nextFloat() - random.nextFloat()) * 0.2F + 1.0F);
//player.worldObj.playAuxSFX(1021, (int)player.posX, (int)player.posY, (int)player.posZ, 0);
}
}
}

View File

@ -39,7 +39,7 @@ public class Pattern extends CraftingItem
"ingot", "rod", "pickaxe", "shovel", "axe", "swordblade", "largeguard", "mediumguard", "crossbar", "binding", "frypan", "sign", "knifeblade", "chisel" };
/*@SideOnly(Side.CLIENT)
public void updateIcons(IconRegister iconRegister)
public void registerIcons(IconRegister iconRegister)
{
this.icons = new Icon[textureNames.length];

View File

@ -81,7 +81,7 @@ public class RedstoneBallRepeaterItem extends Item
}
@SideOnly(Side.CLIENT)
public void updateIcons(IconRegister iconRegister)
public void registerIcons(IconRegister iconRegister)
{
this.itemIcon = iconRegister.registerIcon("tinker:redstoneball");
}

View File

@ -32,7 +32,7 @@ public class ToolPart extends CraftingItem
}
/*@SideOnly(Side.CLIENT)
public void updateIcons(IconRegister iconRegister)
public void registerIcons(IconRegister iconRegister)
{
this.icons = new Icon[textureNames.length];

View File

@ -29,7 +29,7 @@ public class ToolShard extends ToolPart
}
@SideOnly(Side.CLIENT)
public void updateIcons(IconRegister iconRegister)
public void registerIcons(IconRegister iconRegister)
{
this.icons = new Icon[textureNames.length];

View File

@ -4,6 +4,7 @@ import mods.tinker.tconstruct.blocks.logic.EquipLogic;
import mods.tinker.tconstruct.common.TContent;
import mods.tinker.tconstruct.library.tools.AbilityHelper;
import mods.tinker.tconstruct.library.tools.Weapon;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
@ -16,29 +17,40 @@ import cpw.mods.fml.relauncher.SideOnly;
public class FryingPan extends Weapon
{
public FryingPan(int itemID)
{
super(itemID, 2);
this.setUnlocalizedName("InfiTool.FryingPan");
}
@Override
public boolean hitEntity(ItemStack stack, EntityLiving mob, EntityLiving player)
{
AbilityHelper.knockbackEntity(mob, 1.7f);
mob.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 100, 0)); //5 seconds of stun
player.worldObj.playSoundEffect(mob.posX, mob.posY, mob.posZ, "hit.frypan", 1.0F, (random.nextFloat() - random.nextFloat()) * 0.2F + 1.0F);
return true;
}
public String getToolName()
{
return "Frying Pan";
}
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float clickX, float clickY, float clickZ)
public FryingPan(int itemID)
{
super(itemID, 2);
this.setUnlocalizedName("InfiTool.FryingPan");
}
@Override
public boolean hitEntity (ItemStack stack, EntityLiving mob, EntityLiving player)
{
AbilityHelper.knockbackEntity(mob, 1.7f);
mob.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 100, 0)); //5 seconds of stun
return true;
}
@Override
public boolean onLeftClickEntity (ItemStack stack, EntityPlayer player, Entity mob)
{
if (mob.canAttackWithItem() && !mob.func_85031_j(player) && mob.hurtResistantTime < 14)
AbilityHelper.onLeftClickEntity(stack, player, mob, this);
return true;
}
public void onEntityDamaged(World world, EntityPlayer player, Entity entity)
{
world.playSoundEffect(entity.posX, entity.posY, entity.posZ, "mods.tinker.resources.sounds.frypan_hit", 1.0F, (random.nextFloat() - random.nextFloat()) * 0.2F + 1.0F);
}
public String getToolName ()
{
return "Frying Pan";
}
public boolean onItemUse (ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float clickX, float clickY, float clickZ)
{
player.worldObj.playSoundEffect(player.posX, player.posY, player.posZ, "hit.frypan", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
if (side == 0 || !player.isSneaking())
{
return false;
@ -87,7 +99,7 @@ public class FryingPan extends Weapon
world.setBlock(x, y, z, TContent.heldItemBlock.blockID, 0, 3);
EquipLogic logic = (EquipLogic) world.getBlockTileEntity(x, y, z);
logic.setEquipmentItem(stack);
logic.setEquipmentItem(stack);
--stack.stackSize;
return true;
@ -95,64 +107,64 @@ public class FryingPan extends Weapon
}
}
@Override
protected Item getHeadItem ()
{
return TContent.frypanHead;
}
@Override
protected Item getHeadItem ()
{
return TContent.frypanHead;
}
@Override
protected Item getAccessoryItem ()
{
return null;
}
@Override
protected Item getAccessoryItem ()
{
return null;
}
@SideOnly(Side.CLIENT)
@SideOnly(Side.CLIENT)
@Override
public int getRenderPasses (int metadata)
{
return 8;
}
@Override
public int getPartAmount()
{
return 2;
}
@Override
public int getPartAmount ()
{
return 2;
}
@Override
public void registerPartPaths (int index, String[] location)
{
headStrings.put(index, location[0]);
brokenHeadStrings.put(index, location[1]);
handleStrings.put(index, location[2]);
}
@Override
public void registerPartPaths (int index, String[] location)
{
headStrings.put(index, location[0]);
brokenHeadStrings.put(index, location[1]);
handleStrings.put(index, location[2]);
}
@Override
public String getIconSuffix (int partType)
{
switch (partType)
{
case 0:
return "_frypan_head";
case 1:
return "_frypan_head_broken";
case 2:
return "_frypan_handle";
default:
return "";
}
}
@Override
public String getIconSuffix (int partType)
{
switch (partType)
{
case 0:
return "_frypan_head";
case 1:
return "_frypan_head_broken";
case 2:
return "_frypan_handle";
default:
return "";
}
}
@Override
public String getEffectSuffix ()
{
return "_frypan_effect";
}
@Override
public String getEffectSuffix ()
{
return "_frypan_effect";
}
@Override
public String getDefaultFolder ()
{
return "frypan";
}
@Override
public String getDefaultFolder ()
{
return "frypan";
}
}

View File

@ -12,9 +12,9 @@ import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class Axe extends HarvestTool
public class Hatchet extends HarvestTool
{
public Axe(int itemID)
public Hatchet(int itemID)
{
super(itemID, 3);
this.setUnlocalizedName("InfiTool.Axe");
@ -48,7 +48,7 @@ public class Axe extends HarvestTool
return AbilityHelper.onBlockChanged(itemstack, world, bID, x, y, z, player, random);
}
static Material[] materials = { Material.wood, Material.leaves, Material.circuits, Material.cactus, Material.pumpkin };
static Material[] materials = { Material.wood, Material.leaves, Material.vine, Material.circuits, Material.cactus, Material.pumpkin };
@Override
protected Item getHeadItem ()

View File

@ -42,7 +42,7 @@ public class Mattock extends DualHarvestTool
return "shovel";
}
static Material[] axeMaterials = { Material.wood, Material.cactus, Material.pumpkin, Material.plants };
static Material[] axeMaterials = { Material.wood, Material.cactus, Material.pumpkin, Material.plants, Material.vine };
static Material[] shovelMaterials = { Material.grass, Material.ground, Material.clay };
public float getDurabilityModifier ()

View File

@ -138,6 +138,7 @@ public class AbilityHelper
if (causedDamage)
{
damageTool(stack, 1, player, false);
tool.onEntityDamaged(player.worldObj, player, entity);
int drain = toolTags.getInteger("Necrotic") * 2;
if (drain > 0)
player.heal(random.nextInt(drain));

View File

@ -429,6 +429,12 @@ public abstract class ToolCore extends Item implements ICustomElectricItem, IBox
return ret;
}
//Used for sounds and the like
public void onEntityDamaged(World world, EntityPlayer player, Entity entity)
{
}
/* Creative mode tools */
static String[] toolMaterialNames = { "Wooden ", "Stone ", "Iron ", "Flint ", "Cactus ", "Bone ", "Obsidian ", "Netherrack ", "Slime ", "Paper ", "Cobalt ", "Ardite ", "Manyullyn ", "Copper ",
"Bronze ", "Alumite ", "Steel ", "Slime " };

View File

@ -51,8 +51,8 @@ public class TEventHandler
{
try
{
event.manager.soundPoolSounds.addSound("hit.frypan", TConstruct.class.getResource("/mods/tinker/resources/sounds/frypan_hit.ogg"));
event.manager.soundPoolSounds.addSound("crafting.saw", TConstruct.class.getResource("/mods/tinker/resources/sounds/little_saw.ogg"));
event.manager.soundPoolSounds.addSound("mods/tinker/resources/sounds/frypan_hit.ogg", TConstruct.class.getResource("/mods/tinker/resources/sounds/frypan_hit.ogg"));
event.manager.soundPoolSounds.addSound("mods/tinker/resources/sounds/little_saw.ogg", TConstruct.class.getResource("/mods/tinker/resources/sounds/little_saw.ogg"));
System.out.println("[TConstruct] Successfully loaded sounds.");
}
catch (Exception e)