Some new textures from BigBadChris, got conditional player mod sounds working again (same as in older versions of EE3), and worked on a bit of tool functionality

This commit is contained in:
Pahimar 2014-07-21 14:47:00 -04:00
parent f11b700704
commit e1c677d3d8
32 changed files with 349 additions and 203 deletions

View file

@ -53,74 +53,80 @@ public class DrawBlockHighlightEventHandler
private void drawSelectionBoxForShovel(DrawBlockHighlightEvent event, IModalTool modalTool)
{
event.setCanceled(true);
ToolMode toolMode = modalTool.getCurrentToolMode(event.currentItem);
int facing = MathHelper.floor_double(event.player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
if (toolMode == ToolMode.STANDARD)
if (toolMode != ToolMode.UNKNOWN)
{
drawSelectionBox(event.context, event.player, new MovingObjectPosition(event.target.blockX, event.target.blockY, event.target.blockZ, event.target.sideHit, event.target.hitVec), 0, event.partialTicks);
event.setCanceled(true);
if (toolMode == ToolMode.STANDARD)
{
drawSelectionBox(event.context, event.player, new MovingObjectPosition(event.target.blockX, event.target.blockY, event.target.blockZ, event.target.sideHit, event.target.hitVec), 0, event.partialTicks);
}
}
}
private void drawSelectionBoxForPickAxe(DrawBlockHighlightEvent event, IModalTool modalTool)
{
event.setCanceled(true);
ToolMode toolMode = modalTool.getCurrentToolMode(event.currentItem);
int facing = MathHelper.floor_double(event.player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
if (toolMode == ToolMode.STANDARD)
if (toolMode != ToolMode.UNKNOWN)
{
drawSelectionBox(event.context, event.player, new MovingObjectPosition(event.target.blockX, event.target.blockY, event.target.blockZ, event.target.sideHit, event.target.hitVec), 0, event.partialTicks);
}
else if (toolMode == ToolMode.WIDE)
{
drawSelectionBox(event.context, event.player, new MovingObjectPosition(event.target.blockX, event.target.blockY, event.target.blockZ, event.target.sideHit, event.target.hitVec), 0, event.partialTicks);
event.setCanceled(true);
if (toolMode == ToolMode.STANDARD)
{
drawSelectionBox(event.context, event.player, new MovingObjectPosition(event.target.blockX, event.target.blockY, event.target.blockZ, event.target.sideHit, event.target.hitVec), 0, event.partialTicks);
}
else if (toolMode == ToolMode.WIDE)
{
drawSelectionBox(event.context, event.player, new MovingObjectPosition(event.target.blockX, event.target.blockY, event.target.blockZ, event.target.sideHit, event.target.hitVec), 0, event.partialTicks);
if (event.target.sideHit == ForgeDirection.NORTH.ordinal() || event.target.sideHit == ForgeDirection.SOUTH.ordinal())
{
drawSelectionBox(event.context, event.player, new MovingObjectPosition(event.target.blockX - 1, event.target.blockY, event.target.blockZ, event.target.sideHit, event.target.hitVec), 0, event.partialTicks);
drawSelectionBox(event.context, event.player, new MovingObjectPosition(event.target.blockX + 1, event.target.blockY, event.target.blockZ, event.target.sideHit, event.target.hitVec), 0, event.partialTicks);
}
else if (event.target.sideHit == ForgeDirection.EAST.ordinal() || event.target.sideHit == ForgeDirection.WEST.ordinal())
{
drawSelectionBox(event.context, event.player, new MovingObjectPosition(event.target.blockX, event.target.blockY, event.target.blockZ - 1, event.target.sideHit, event.target.hitVec), 0, event.partialTicks);
drawSelectionBox(event.context, event.player, new MovingObjectPosition(event.target.blockX, event.target.blockY, event.target.blockZ + 1, event.target.sideHit, event.target.hitVec), 0, event.partialTicks);
}
else
{
if (facing == 0 || facing == 2)
if (event.target.sideHit == ForgeDirection.NORTH.ordinal() || event.target.sideHit == ForgeDirection.SOUTH.ordinal())
{
drawSelectionBox(event.context, event.player, new MovingObjectPosition(event.target.blockX - 1, event.target.blockY, event.target.blockZ, event.target.sideHit, event.target.hitVec), 0, event.partialTicks);
drawSelectionBox(event.context, event.player, new MovingObjectPosition(event.target.blockX + 1, event.target.blockY, event.target.blockZ, event.target.sideHit, event.target.hitVec), 0, event.partialTicks);
}
else
else if (event.target.sideHit == ForgeDirection.EAST.ordinal() || event.target.sideHit == ForgeDirection.WEST.ordinal())
{
drawSelectionBox(event.context, event.player, new MovingObjectPosition(event.target.blockX, event.target.blockY, event.target.blockZ - 1, event.target.sideHit, event.target.hitVec), 0, event.partialTicks);
drawSelectionBox(event.context, event.player, new MovingObjectPosition(event.target.blockX, event.target.blockY, event.target.blockZ + 1, event.target.sideHit, event.target.hitVec), 0, event.partialTicks);
}
else
{
if (facing == 0 || facing == 2)
{
drawSelectionBox(event.context, event.player, new MovingObjectPosition(event.target.blockX - 1, event.target.blockY, event.target.blockZ, event.target.sideHit, event.target.hitVec), 0, event.partialTicks);
drawSelectionBox(event.context, event.player, new MovingObjectPosition(event.target.blockX + 1, event.target.blockY, event.target.blockZ, event.target.sideHit, event.target.hitVec), 0, event.partialTicks);
}
else
{
drawSelectionBox(event.context, event.player, new MovingObjectPosition(event.target.blockX, event.target.blockY, event.target.blockZ - 1, event.target.sideHit, event.target.hitVec), 0, event.partialTicks);
drawSelectionBox(event.context, event.player, new MovingObjectPosition(event.target.blockX, event.target.blockY, event.target.blockZ + 1, event.target.sideHit, event.target.hitVec), 0, event.partialTicks);
}
}
}
}
else if (toolMode == ToolMode.TALL)
{
drawSelectionBox(event.context, event.player, new MovingObjectPosition(event.target.blockX, event.target.blockY, event.target.blockZ, event.target.sideHit, event.target.hitVec), 0, event.partialTicks);
else if (toolMode == ToolMode.TALL)
{
drawSelectionBox(event.context, event.player, new MovingObjectPosition(event.target.blockX, event.target.blockY, event.target.blockZ, event.target.sideHit, event.target.hitVec), 0, event.partialTicks);
if (event.target.sideHit == ForgeDirection.NORTH.ordinal() || event.target.sideHit == ForgeDirection.SOUTH.ordinal() || event.target.sideHit == ForgeDirection.EAST.ordinal() || event.target.sideHit == ForgeDirection.WEST.ordinal())
{
drawSelectionBox(event.context, event.player, new MovingObjectPosition(event.target.blockX, event.target.blockY - 1, event.target.blockZ, event.target.sideHit, event.target.hitVec), 0, event.partialTicks);
drawSelectionBox(event.context, event.player, new MovingObjectPosition(event.target.blockX, event.target.blockY + 1, event.target.blockZ, event.target.sideHit, event.target.hitVec), 0, event.partialTicks);
}
else
{
if (facing == 1 || facing == 3)
if (event.target.sideHit == ForgeDirection.NORTH.ordinal() || event.target.sideHit == ForgeDirection.SOUTH.ordinal() || event.target.sideHit == ForgeDirection.EAST.ordinal() || event.target.sideHit == ForgeDirection.WEST.ordinal())
{
drawSelectionBox(event.context, event.player, new MovingObjectPosition(event.target.blockX - 1, event.target.blockY, event.target.blockZ, event.target.sideHit, event.target.hitVec), 0, event.partialTicks);
drawSelectionBox(event.context, event.player, new MovingObjectPosition(event.target.blockX + 1, event.target.blockY, event.target.blockZ, event.target.sideHit, event.target.hitVec), 0, event.partialTicks);
drawSelectionBox(event.context, event.player, new MovingObjectPosition(event.target.blockX, event.target.blockY - 1, event.target.blockZ, event.target.sideHit, event.target.hitVec), 0, event.partialTicks);
drawSelectionBox(event.context, event.player, new MovingObjectPosition(event.target.blockX, event.target.blockY + 1, event.target.blockZ, event.target.sideHit, event.target.hitVec), 0, event.partialTicks);
}
else
{
drawSelectionBox(event.context, event.player, new MovingObjectPosition(event.target.blockX, event.target.blockY, event.target.blockZ - 1, event.target.sideHit, event.target.hitVec), 0, event.partialTicks);
drawSelectionBox(event.context, event.player, new MovingObjectPosition(event.target.blockX, event.target.blockY, event.target.blockZ + 1, event.target.sideHit, event.target.hitVec), 0, event.partialTicks);
if (facing == 1 || facing == 3)
{
drawSelectionBox(event.context, event.player, new MovingObjectPosition(event.target.blockX - 1, event.target.blockY, event.target.blockZ, event.target.sideHit, event.target.hitVec), 0, event.partialTicks);
drawSelectionBox(event.context, event.player, new MovingObjectPosition(event.target.blockX + 1, event.target.blockY, event.target.blockZ, event.target.sideHit, event.target.hitVec), 0, event.partialTicks);
}
else
{
drawSelectionBox(event.context, event.player, new MovingObjectPosition(event.target.blockX, event.target.blockY, event.target.blockZ - 1, event.target.sideHit, event.target.hitVec), 0, event.partialTicks);
drawSelectionBox(event.context, event.player, new MovingObjectPosition(event.target.blockX, event.target.blockY, event.target.blockZ + 1, event.target.sideHit, event.target.hitVec), 0, event.partialTicks);
}
}
}
}
@ -128,37 +134,46 @@ public class DrawBlockHighlightEventHandler
private void drawSelectionBoxForHammer(DrawBlockHighlightEvent event, IModalTool modalTool)
{
event.setCanceled(true);
ToolMode toolMode = modalTool.getCurrentToolMode(event.currentItem);
int facing = MathHelper.floor_double(event.player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
if (toolMode == ToolMode.STANDARD)
if (toolMode != ToolMode.UNKNOWN)
{
drawSelectionBox(event.context, event.player, new MovingObjectPosition(event.target.blockX, event.target.blockY, event.target.blockZ, event.target.sideHit, event.target.hitVec), 0, event.partialTicks);
event.setCanceled(true);
if (toolMode == ToolMode.STANDARD)
{
drawSelectionBox(event.context, event.player, new MovingObjectPosition(event.target.blockX, event.target.blockY, event.target.blockZ, event.target.sideHit, event.target.hitVec), 0, event.partialTicks);
}
}
}
private void drawSelectionBoxForAxe(DrawBlockHighlightEvent event, IModalTool modalTool)
{
event.setCanceled(true);
ToolMode toolMode = modalTool.getCurrentToolMode(event.currentItem);
int facing = MathHelper.floor_double(event.player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
if (toolMode == ToolMode.STANDARD)
if (toolMode != ToolMode.UNKNOWN)
{
drawSelectionBox(event.context, event.player, new MovingObjectPosition(event.target.blockX, event.target.blockY, event.target.blockZ, event.target.sideHit, event.target.hitVec), 0, event.partialTicks);
event.setCanceled(true);
if (toolMode == ToolMode.STANDARD)
{
drawSelectionBox(event.context, event.player, new MovingObjectPosition(event.target.blockX, event.target.blockY, event.target.blockZ, event.target.sideHit, event.target.hitVec), 0, event.partialTicks);
}
}
}
private void drawSelectionBoxForHoe(DrawBlockHighlightEvent event, IModalTool modalTool)
{
event.setCanceled(true);
ToolMode toolMode = modalTool.getCurrentToolMode(event.currentItem);
int facing = MathHelper.floor_double(event.player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
if (toolMode == ToolMode.STANDARD)
if (toolMode != ToolMode.UNKNOWN)
{
drawSelectionBox(event.context, event.player, new MovingObjectPosition(event.target.blockX, event.target.blockY, event.target.blockZ, event.target.sideHit, event.target.hitVec), 0, event.partialTicks);
event.setCanceled(true);
if (toolMode == ToolMode.STANDARD)
{
drawSelectionBox(event.context, event.player, new MovingObjectPosition(event.target.blockX, event.target.blockY, event.target.blockZ, event.target.sideHit, event.target.hitVec), 0, event.partialTicks);
}
}
}

View file

@ -0,0 +1,13 @@
package com.pahimar.ee3.client.util;
import com.pahimar.ee3.util.ResourceLocationHelper;
import cpw.mods.fml.client.FMLClientHandler;
import net.minecraft.client.audio.PositionedSoundRecord;
public class ClientSoundHelper
{
public static void playSound(String soundName, float xCoord, float yCoord, float zCoord, float volume, float pitch)
{
FMLClientHandler.instance().getClient().getSoundHandler().playSound(new PositionedSoundRecord(ResourceLocationHelper.getResourceLocation(soundName), volume, pitch, xCoord, yCoord, zCoord));
}
}

View file

@ -28,8 +28,9 @@ public class ConfigurationHandler
private static void loadConfiguration()
{
// TODO Come back and do these constants in logical locations and names
Settings.Transmutation.knowledgeMode = ConfigurationHelper.getString(configuration, Messages.Configuration.TRANSMUTATION_KNOWLEDGE_MODE, Messages.Configuration.CATEGORY_TRANSMUTATION, "All", StatCollector.translateToLocal(Messages.Configuration.TRANSMUTATION_KNOWLEDGE_MODE_COMMENT), new String[]{"All", "Select", "None"}, Messages.Configuration.TRANSMUTATION_KNOWLEDGE_MODE_LABEL);
Settings.Transmutation.knowledgeMode = ConfigurationHelper.getString(configuration, Messages.Configuration.TRANSMUTATION_KNOWLEDGE_MODE, Messages.Configuration.CATEGORY_TRANSMUTATION, Settings.Transmutation.KNOWLEDGE_MODE_ALL, StatCollector.translateToLocal(Messages.Configuration.TRANSMUTATION_KNOWLEDGE_MODE_COMMENT), new String[]{Settings.Transmutation.KNOWLEDGE_MODE_ALL, Settings.Transmutation.KNOWLEDGE_MODE_SELECT, Settings.Transmutation.KNOWLEDGE_MODE_NONE}, Messages.Configuration.TRANSMUTATION_KNOWLEDGE_MODE_LABEL);
Settings.Transmutation.useTemplateFile = configuration.getBoolean(Messages.Configuration.TRANSMUTATION_KNOWLEDGE_TEMPLATE, Messages.Configuration.CATEGORY_TRANSMUTATION, true, StatCollector.translateToLocal(Messages.Configuration.TRANSMUTATION_KNOWLEDGE_TEMPLATE_COMMENT), Messages.Configuration.TRANSMUTATION_KNOWLEDGE_TEMPLATE_LABEL);
Settings.Sounds.soundMode = ConfigurationHelper.getString(configuration, Messages.Configuration.SOUND_MODE, Configuration.CATEGORY_GENERAL, Settings.Sounds.SOUND_MODE_ALL, StatCollector.translateToLocal(Messages.Configuration.SOUND_MODE_COMMENT), new String[]{Settings.Sounds.SOUND_MODE_ALL, Settings.Sounds.SOUND_MODE_SELF, Settings.Sounds.SOUND_MODE_NONE}, Messages.Configuration.SOUND_MODE_LABEL);
LogHelper.info(Settings.Transmutation.knowledgeMode);
if (configuration.hasChanged())

View file

@ -5,17 +5,18 @@ import com.google.common.collect.Sets;
import com.pahimar.ee3.reference.*;
import com.pahimar.ee3.util.IChargeable;
import com.pahimar.ee3.util.IKeyBound;
import com.pahimar.ee3.util.IModalTool;
import com.pahimar.ee3.util.NBTHelper;
import com.pahimar.ee3.util.NetworkSoundHelper;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import java.util.Arrays;
import java.util.List;
import java.util.Set;
public class ItemDarkMatterAxe extends ItemToolEE implements IKeyBound, IChargeable, IModalTool
public class ItemDarkMatterAxe extends ItemToolModalEE implements IKeyBound, IChargeable
{
private static final Set blocksEffectiveAgainst = Sets.newHashSet(new Block[]{Blocks.planks, Blocks.bookshelf, Blocks.log, Blocks.log2, Blocks.chest, Blocks.pumpkin, Blocks.lit_pumpkin});
@ -85,29 +86,30 @@ public class ItemDarkMatterAxe extends ItemToolEE implements IKeyBound, IChargea
{
if (getChargeLevel(itemStack) == this.getMaxChargeLevel())
{
entityPlayer.worldObj.playSoundEffect(entityPlayer.posX, entityPlayer.posY, entityPlayer.posZ, Sounds.FAIL, 1.5f, 1.5f);
NetworkSoundHelper.playSoundAt(entityPlayer, Sounds.FAIL, 1.5f, 1.5f);
}
else
{
increaseChargeLevel(itemStack);
entityPlayer.worldObj.playSoundEffect(entityPlayer.posX, entityPlayer.posY, entityPlayer.posZ, Sounds.CHARGE_UP, 0.5F, 0.5F + 0.5F * (getChargeLevel(itemStack) * 1.0F / this.getMaxChargeLevel()));
NetworkSoundHelper.playSoundAt(entityPlayer, Sounds.CHARGE_UP, 0.5F, 0.5F + 0.5F * (getChargeLevel(itemStack) * 1.0F / this.getMaxChargeLevel()));
}
}
else
{
if (getChargeLevel(itemStack) == 0)
{
entityPlayer.worldObj.playSoundEffect(entityPlayer.posX, entityPlayer.posY, entityPlayer.posZ, Sounds.FAIL, 1.5f, 1.5f);
NetworkSoundHelper.playSoundAt(entityPlayer, Sounds.FAIL, 1.5f, 1.5f);
}
else
{
decreaseChargeLevel(itemStack);
entityPlayer.worldObj.playSoundEffect(entityPlayer.posX, entityPlayer.posY, entityPlayer.posZ, Sounds.CHARGE_DOWN, 0.5F, 1.0F - (0.5F - 0.5F * (getChargeLevel(itemStack) * 1.0F / this.getMaxChargeLevel())));
NetworkSoundHelper.playSoundAt(entityPlayer, Sounds.CHARGE_DOWN, 0.5F, 1.0F - (0.5F - 0.5F * (getChargeLevel(itemStack) * 1.0F / this.getMaxChargeLevel())));
}
}
}
else if (key == Key.EXTRA)
{
NetworkSoundHelper.playSoundAt(entityPlayer, Sounds.TOCK, 0.5f, 1.5F);
changeToolMode(itemStack);
}
}
@ -116,41 +118,6 @@ public class ItemDarkMatterAxe extends ItemToolEE implements IKeyBound, IChargea
public List<ToolMode> getAvailableToolModes()
{
// TODO
return null;
}
@Override
public ToolMode getCurrentToolMode(ItemStack itemStack)
{
if (NBTHelper.getShort(itemStack, Names.NBT.MODE) < ToolMode.TYPES.length)
{
return ToolMode.TYPES[NBTHelper.getShort(itemStack, Names.NBT.MODE)];
}
return null;
}
@Override
public void setToolMode(ItemStack itemStack, ToolMode toolMode)
{
NBTHelper.setShort(itemStack, Names.NBT.MODE, (short) toolMode.ordinal());
}
@Override
public void changeToolMode(ItemStack itemStack)
{
ToolMode currentToolMode = getCurrentToolMode(itemStack);
if (getAvailableToolModes().contains(currentToolMode))
{
if (getAvailableToolModes().indexOf(currentToolMode) == getAvailableToolModes().size() - 1)
{
setToolMode(itemStack, getAvailableToolModes().get(0));
}
else
{
setToolMode(itemStack, getAvailableToolModes().get(getAvailableToolModes().indexOf(currentToolMode) + 1));
}
}
return Arrays.asList(ToolMode.STANDARD);
}
}

View file

@ -2,10 +2,7 @@ package com.pahimar.ee3.item;
import com.pahimar.ee3.creativetab.CreativeTab;
import com.pahimar.ee3.reference.*;
import com.pahimar.ee3.util.IChargeable;
import com.pahimar.ee3.util.IKeyBound;
import com.pahimar.ee3.util.IModalTool;
import com.pahimar.ee3.util.NBTHelper;
import com.pahimar.ee3.util.*;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.texture.IIconRegister;
@ -13,6 +10,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemHoe;
import net.minecraft.item.ItemStack;
import java.util.Arrays;
import java.util.List;
public class ItemDarkMatterHoe extends ItemHoe implements IKeyBound, IChargeable, IModalTool
@ -126,29 +124,30 @@ public class ItemDarkMatterHoe extends ItemHoe implements IKeyBound, IChargeable
{
if (getChargeLevel(itemStack) == this.getMaxChargeLevel())
{
entityPlayer.worldObj.playSoundEffect(entityPlayer.posX, entityPlayer.posY, entityPlayer.posZ, Sounds.FAIL, 1.5f, 1.5f);
NetworkSoundHelper.playSoundAt(entityPlayer, Sounds.FAIL, 1.5f, 1.5f);
}
else
{
increaseChargeLevel(itemStack);
entityPlayer.worldObj.playSoundEffect(entityPlayer.posX, entityPlayer.posY, entityPlayer.posZ, Sounds.CHARGE_UP, 0.5F, 0.5F + 0.5F * (getChargeLevel(itemStack) * 1.0F / this.getMaxChargeLevel()));
NetworkSoundHelper.playSoundAt(entityPlayer, Sounds.CHARGE_UP, 0.5F, 0.5F + 0.5F * (getChargeLevel(itemStack) * 1.0F / this.getMaxChargeLevel()));
}
}
else
{
if (getChargeLevel(itemStack) == 0)
{
entityPlayer.worldObj.playSoundEffect(entityPlayer.posX, entityPlayer.posY, entityPlayer.posZ, Sounds.FAIL, 1.5f, 1.5f);
NetworkSoundHelper.playSoundAt(entityPlayer, Sounds.FAIL, 1.5f, 1.5f);
}
else
{
decreaseChargeLevel(itemStack);
entityPlayer.worldObj.playSoundEffect(entityPlayer.posX, entityPlayer.posY, entityPlayer.posZ, Sounds.CHARGE_DOWN, 0.5F, 1.0F - (0.5F - 0.5F * (getChargeLevel(itemStack) * 1.0F / this.getMaxChargeLevel())));
NetworkSoundHelper.playSoundAt(entityPlayer, Sounds.CHARGE_DOWN, 0.5F, 1.0F - (0.5F - 0.5F * (getChargeLevel(itemStack) * 1.0F / this.getMaxChargeLevel())));
}
}
}
else if (key == Key.EXTRA)
{
NetworkSoundHelper.playSoundAt(entityPlayer, Sounds.TOCK, 0.5f, 1.5F);
changeToolMode(itemStack);
}
}
@ -157,7 +156,7 @@ public class ItemDarkMatterHoe extends ItemHoe implements IKeyBound, IChargeable
public List<ToolMode> getAvailableToolModes()
{
// TODO
return null;
return Arrays.asList(ToolMode.STANDARD);
}
@Override

View file

@ -16,7 +16,7 @@ import java.util.Arrays;
import java.util.List;
import java.util.Set;
public class ItemDarkMatterPickAxe extends ItemToolEE implements IKeyBound, IChargeable, IModalTool
public class ItemDarkMatterPickAxe extends ItemToolModalEE implements IKeyBound, IChargeable
{
private static final Set blocksEffectiveAgainst = Sets.newHashSet(new Block[]{Blocks.cobblestone, Blocks.double_stone_slab, Blocks.stone_slab, Blocks.stone, Blocks.sandstone, Blocks.mossy_cobblestone, Blocks.iron_ore, Blocks.iron_block, Blocks.coal_ore, Blocks.gold_block, Blocks.gold_ore, Blocks.diamond_ore, Blocks.diamond_block, Blocks.ice, Blocks.netherrack, Blocks.lapis_ore, Blocks.lapis_block, Blocks.redstone_ore, Blocks.lit_redstone_ore, Blocks.rail, Blocks.detector_rail, Blocks.golden_rail, Blocks.activator_rail});
@ -117,29 +117,30 @@ public class ItemDarkMatterPickAxe extends ItemToolEE implements IKeyBound, ICha
{
if (getChargeLevel(itemStack) == this.getMaxChargeLevel())
{
entityPlayer.worldObj.playSoundEffect(entityPlayer.posX, entityPlayer.posY, entityPlayer.posZ, Sounds.FAIL, 1.5f, 1.5f);
NetworkSoundHelper.playSoundAt(entityPlayer, Sounds.FAIL, 1.5f, 1.5f);
}
else
{
increaseChargeLevel(itemStack);
entityPlayer.worldObj.playSoundEffect(entityPlayer.posX, entityPlayer.posY, entityPlayer.posZ, Sounds.CHARGE_UP, 0.5F, 0.5F + 0.5F * (getChargeLevel(itemStack) * 1.0F / this.getMaxChargeLevel()));
NetworkSoundHelper.playSoundAt(entityPlayer, Sounds.CHARGE_UP, 0.5F, 0.5F + 0.5F * (getChargeLevel(itemStack) * 1.0F / this.getMaxChargeLevel()));
}
}
else
{
if (getChargeLevel(itemStack) == 0)
{
entityPlayer.worldObj.playSoundEffect(entityPlayer.posX, entityPlayer.posY, entityPlayer.posZ, Sounds.FAIL, 1.5f, 1.5f);
NetworkSoundHelper.playSoundAt(entityPlayer, Sounds.FAIL, 1.5f, 1.5f);
}
else
{
decreaseChargeLevel(itemStack);
entityPlayer.worldObj.playSoundEffect(entityPlayer.posX, entityPlayer.posY, entityPlayer.posZ, Sounds.CHARGE_DOWN, 0.5F, 1.0F - (0.5F - 0.5F * (getChargeLevel(itemStack) * 1.0F / this.getMaxChargeLevel())));
NetworkSoundHelper.playSoundAt(entityPlayer, Sounds.CHARGE_DOWN, 0.5F, 1.0F - (0.5F - 0.5F * (getChargeLevel(itemStack) * 1.0F / this.getMaxChargeLevel())));
}
}
}
else if (key == Key.EXTRA)
{
NetworkSoundHelper.playSoundAt(entityPlayer, Sounds.TOCK, 0.5f, 1.5F);
changeToolMode(itemStack);
}
}
@ -149,39 +150,4 @@ public class ItemDarkMatterPickAxe extends ItemToolEE implements IKeyBound, ICha
{
return Arrays.asList(ToolMode.STANDARD, ToolMode.WIDE, ToolMode.TALL);
}
@Override
public ToolMode getCurrentToolMode(ItemStack itemStack)
{
if (NBTHelper.getShort(itemStack, Names.NBT.MODE) < ToolMode.TYPES.length)
{
return ToolMode.TYPES[NBTHelper.getShort(itemStack, Names.NBT.MODE)];
}
return null;
}
@Override
public void setToolMode(ItemStack itemStack, ToolMode toolMode)
{
NBTHelper.setShort(itemStack, Names.NBT.MODE, (short) toolMode.ordinal());
}
@Override
public void changeToolMode(ItemStack itemStack)
{
ToolMode currentToolMode = getCurrentToolMode(itemStack);
if (getAvailableToolModes().contains(currentToolMode))
{
if (getAvailableToolModes().indexOf(currentToolMode) == getAvailableToolModes().size() - 1)
{
setToolMode(itemStack, getAvailableToolModes().get(0));
}
else
{
setToolMode(itemStack, getAvailableToolModes().get(getAvailableToolModes().indexOf(currentToolMode) + 1));
}
}
}
}

View file

@ -5,17 +5,18 @@ import com.google.common.collect.Sets;
import com.pahimar.ee3.reference.*;
import com.pahimar.ee3.util.IChargeable;
import com.pahimar.ee3.util.IKeyBound;
import com.pahimar.ee3.util.IModalTool;
import com.pahimar.ee3.util.NBTHelper;
import com.pahimar.ee3.util.NetworkSoundHelper;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import java.util.Arrays;
import java.util.List;
import java.util.Set;
public class ItemDarkMatterShovel extends ItemToolEE implements IKeyBound, IChargeable, IModalTool
public class ItemDarkMatterShovel extends ItemToolModalEE implements IKeyBound, IChargeable
{
private static final Set blocksEffectiveAgainst = Sets.newHashSet(new Block[]{Blocks.grass, Blocks.dirt, Blocks.sand, Blocks.gravel, Blocks.snow_layer, Blocks.snow, Blocks.clay, Blocks.farmland, Blocks.soul_sand, Blocks.mycelium});
@ -85,29 +86,30 @@ public class ItemDarkMatterShovel extends ItemToolEE implements IKeyBound, IChar
{
if (getChargeLevel(itemStack) == this.getMaxChargeLevel())
{
entityPlayer.worldObj.playSoundEffect(entityPlayer.posX, entityPlayer.posY, entityPlayer.posZ, Sounds.FAIL, 1.5f, 1.5f);
NetworkSoundHelper.playSoundAt(entityPlayer, Sounds.FAIL, 1.5f, 1.5f);
}
else
{
increaseChargeLevel(itemStack);
entityPlayer.worldObj.playSoundEffect(entityPlayer.posX, entityPlayer.posY, entityPlayer.posZ, Sounds.CHARGE_UP, 0.5F, 0.5F + 0.5F * (getChargeLevel(itemStack) * 1.0F / this.getMaxChargeLevel()));
NetworkSoundHelper.playSoundAt(entityPlayer, Sounds.CHARGE_UP, 0.5F, 0.5F + 0.5F * (getChargeLevel(itemStack) * 1.0F / this.getMaxChargeLevel()));
}
}
else
{
if (getChargeLevel(itemStack) == 0)
{
entityPlayer.worldObj.playSoundEffect(entityPlayer.posX, entityPlayer.posY, entityPlayer.posZ, Sounds.FAIL, 1.5f, 1.5f);
NetworkSoundHelper.playSoundAt(entityPlayer, Sounds.FAIL, 1.5f, 1.5f);
}
else
{
decreaseChargeLevel(itemStack);
entityPlayer.worldObj.playSoundEffect(entityPlayer.posX, entityPlayer.posY, entityPlayer.posZ, Sounds.CHARGE_DOWN, 0.5F, 1.0F - (0.5F - 0.5F * (getChargeLevel(itemStack) * 1.0F / this.getMaxChargeLevel())));
NetworkSoundHelper.playSoundAt(entityPlayer, Sounds.CHARGE_DOWN, 0.5F, 1.0F - (0.5F - 0.5F * (getChargeLevel(itemStack) * 1.0F / this.getMaxChargeLevel())));
}
}
}
else if (key == Key.EXTRA)
{
NetworkSoundHelper.playSoundAt(entityPlayer, Sounds.TOCK, 0.5f, 1.5F);
changeToolMode(itemStack);
}
}
@ -116,41 +118,6 @@ public class ItemDarkMatterShovel extends ItemToolEE implements IKeyBound, IChar
public List<ToolMode> getAvailableToolModes()
{
// TODO
return null;
}
@Override
public ToolMode getCurrentToolMode(ItemStack itemStack)
{
if (NBTHelper.getShort(itemStack, Names.NBT.MODE) < ToolMode.TYPES.length)
{
return ToolMode.TYPES[NBTHelper.getShort(itemStack, Names.NBT.MODE)];
}
return null;
}
@Override
public void setToolMode(ItemStack itemStack, ToolMode toolMode)
{
NBTHelper.setShort(itemStack, Names.NBT.MODE, (short) toolMode.ordinal());
}
@Override
public void changeToolMode(ItemStack itemStack)
{
ToolMode currentToolMode = getCurrentToolMode(itemStack);
if (getAvailableToolModes().contains(currentToolMode))
{
if (getAvailableToolModes().indexOf(currentToolMode) == getAvailableToolModes().size() - 1)
{
setToolMode(itemStack, getAvailableToolModes().get(0));
}
else
{
setToolMode(itemStack, getAvailableToolModes().get(getAvailableToolModes().indexOf(currentToolMode) + 1));
}
}
return Arrays.asList(ToolMode.STANDARD);
}
}

View file

@ -0,0 +1,71 @@
package com.pahimar.ee3.item;
import com.pahimar.ee3.reference.Names;
import com.pahimar.ee3.reference.ToolMode;
import com.pahimar.ee3.util.IModalTool;
import com.pahimar.ee3.util.NBTHelper;
import net.minecraft.item.ItemStack;
import java.util.Arrays;
import java.util.List;
import java.util.Set;
public class ItemToolModalEE extends ItemToolEE implements IModalTool
{
public ItemToolModalEE(float damageVsEntity, ToolMaterial toolMaterial, Set blocksEffectiveAgainst)
{
super(damageVsEntity, toolMaterial, blocksEffectiveAgainst);
}
@Override
public List<ToolMode> getAvailableToolModes()
{
return Arrays.asList(ToolMode.UNKNOWN);
}
@Override
public ToolMode getCurrentToolMode(ItemStack itemStack)
{
if (NBTHelper.getShort(itemStack, Names.NBT.MODE) < ToolMode.TYPES.length)
{
return ToolMode.TYPES[NBTHelper.getShort(itemStack, Names.NBT.MODE)];
}
return ToolMode.UNKNOWN;
}
@Override
public void setToolMode(ItemStack itemStack, ToolMode toolMode)
{
NBTHelper.setShort(itemStack, Names.NBT.MODE, (short) toolMode.ordinal());
}
@Override
public void changeToolMode(ItemStack itemStack)
{
ToolMode currentToolMode = getCurrentToolMode(itemStack);
if (getAvailableToolModes().size() > 0)
{
if (getAvailableToolModes().contains(currentToolMode))
{
if (getAvailableToolModes().indexOf(currentToolMode) == getAvailableToolModes().size() - 1)
{
setToolMode(itemStack, getAvailableToolModes().get(0));
}
else
{
setToolMode(itemStack, getAvailableToolModes().get(getAvailableToolModes().indexOf(currentToolMode) + 1));
}
}
else
{
setToolMode(itemStack, getAvailableToolModes().get(0));
}
}
else
{
setToolMode(itemStack, ToolMode.UNKNOWN);
}
}
}

View file

@ -17,5 +17,6 @@ public class PacketHandler
INSTANCE.registerMessage(MessageTileEntityAludel.class, MessageTileEntityAludel.class, 2, Side.CLIENT);
INSTANCE.registerMessage(MessageTileEntityGlassBell.class, MessageTileEntityGlassBell.class, 3, Side.CLIENT);
INSTANCE.registerMessage(MessageKeyPressed.class, MessageKeyPressed.class, 4, Side.SERVER);
INSTANCE.registerMessage(MessageSoundEvent.class, MessageSoundEvent.class, 5, Side.CLIENT);
}
}

View file

@ -0,0 +1,97 @@
package com.pahimar.ee3.network.message;
import com.pahimar.ee3.EquivalentExchange3;
import com.pahimar.ee3.reference.Settings;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import io.netty.buffer.ByteBuf;
import net.minecraft.entity.player.EntityPlayer;
import java.util.UUID;
public class MessageSoundEvent implements IMessage, IMessageHandler<MessageSoundEvent, IMessage>
{
private long mostSigUUID, leastSigUUID;
private String soundName;
private float xCoord, yCoord, zCoord;
private float volume, pitch;
public MessageSoundEvent()
{
}
public MessageSoundEvent(EntityPlayer entityPlayer, String soundName, float volume, float pitch)
{
this.mostSigUUID = entityPlayer.getUniqueID().getMostSignificantBits();
this.leastSigUUID = entityPlayer.getUniqueID().getLeastSignificantBits();
this.soundName = soundName;
this.xCoord = (float) entityPlayer.posX;
this.yCoord = (float) entityPlayer.posY;
this.zCoord = (float) entityPlayer.posZ;
this.volume = volume;
this.pitch = pitch;
}
public MessageSoundEvent(String soundName, float xCoord, float yCoord, float zCoord, float volume, float pitch)
{
this.mostSigUUID = 0;
this.leastSigUUID = 0;
this.soundName = soundName;
this.xCoord = xCoord;
this.yCoord = yCoord;
this.zCoord = zCoord;
this.volume = volume;
this.pitch = pitch;
}
@Override
public void fromBytes(ByteBuf byteBuf)
{
this.mostSigUUID = byteBuf.readLong();
this.leastSigUUID = byteBuf.readLong();
int soundNameLength = byteBuf.readInt();
this.soundName = new String(byteBuf.readBytes(soundNameLength).array());
this.xCoord = byteBuf.readFloat();
this.yCoord = byteBuf.readFloat();
this.zCoord = byteBuf.readFloat();
this.volume = byteBuf.readFloat();
this.pitch = byteBuf.readFloat();
}
@Override
public void toBytes(ByteBuf byteBuf)
{
byteBuf.writeLong(mostSigUUID);
byteBuf.writeLong(leastSigUUID);
byteBuf.writeInt(soundName.length());
byteBuf.writeBytes(soundName.getBytes());
byteBuf.writeFloat(xCoord);
byteBuf.writeFloat(yCoord);
byteBuf.writeFloat(zCoord);
byteBuf.writeFloat(volume);
byteBuf.writeFloat(pitch);
}
@Override
public IMessage onMessage(MessageSoundEvent event, MessageContext context)
{
UUID originUUID = new UUID(event.mostSigUUID, event.leastSigUUID);
if (Settings.Sounds.soundMode.equalsIgnoreCase(Settings.Sounds.SOUND_MODE_ALL))
{
EquivalentExchange3.proxy.playSound(event.soundName, event.xCoord, event.yCoord, event.zCoord, event.volume, event.pitch);
}
else if (Settings.Sounds.soundMode.equalsIgnoreCase(Settings.Sounds.SOUND_MODE_SELF))
{
if (FMLClientHandler.instance().getClient().thePlayer.getUniqueID().equals(originUUID))
{
EquivalentExchange3.proxy.playSound(event.soundName, event.xCoord, event.yCoord, event.zCoord, event.volume, event.pitch);
}
}
return null;
}
}

View file

@ -6,6 +6,7 @@ import com.pahimar.ee3.client.handler.KeyInputEventHandler;
import com.pahimar.ee3.client.renderer.item.*;
import com.pahimar.ee3.client.renderer.tileentity.*;
import com.pahimar.ee3.client.settings.Keybindings;
import com.pahimar.ee3.client.util.ClientSoundHelper;
import com.pahimar.ee3.init.ModBlocks;
import com.pahimar.ee3.reference.RenderIds;
import com.pahimar.ee3.tileentity.*;
@ -36,6 +37,12 @@ public class ClientProxy extends CommonProxy
ClientRegistry.registerKeyBinding(Keybindings.toggle);
}
@Override
public void playSound(String soundName, float xCoord, float yCoord, float zCoord, float volume, float pitch)
{
ClientSoundHelper.playSound(soundName, xCoord, yCoord, zCoord, volume, pitch);
}
@Override
public void initRenderingAndTextures()
{

View file

@ -9,4 +9,6 @@ public interface IProxy
public abstract void registerEventHandlers();
public abstract void registerKeybindings();
public abstract void playSound(String soundName, float xCoord, float yCoord, float zCoord, float volume, float pitch);
}

View file

@ -13,4 +13,10 @@ public class ServerProxy extends CommonProxy
{
// NOOP
}
@Override
public void playSound(String soundName, float xCoord, float yCoord, float zCoord, float volume, float pitch)
{
// NOOP
}
}

View file

@ -20,5 +20,9 @@ public final class Messages
public static final String TRANSMUTATION_KNOWLEDGE_TEMPLATE = "useTemplateFile";
public static final String TRANSMUTATION_KNOWLEDGE_TEMPLATE_LABEL = "general.transmutation.knowledge.template.label";
public static final String TRANSMUTATION_KNOWLEDGE_TEMPLATE_COMMENT = "general.transmutation.knowledge.template.comment";
public static final String SOUND_MODE = "soundMode";
public static final String SOUND_MODE_LABEL = "general.sound.soundMode.label";
public static final String SOUND_MODE_COMMENT = "general.sound.soundMode.comment";
}
}

View file

@ -8,6 +8,15 @@ public class Settings
public static final String KNOWLEDGE_MODE_ALL = "All";
public static final String KNOWLEDGE_MODE_SELECT = "Select";
public static final String KNOWLEDGE_MODE_NONE = "None";
public static boolean useTemplateFile;
}
public static class Sounds
{
public static String soundMode;
public static final String SOUND_MODE_ALL = "All";
public static final String SOUND_MODE_SELF = "Self";
public static final String SOUND_MODE_NONE = "None";
}
}

View file

@ -4,21 +4,20 @@ public class Sounds
{
public static final String CHEST_OPEN = "random.chestopen";
public static final String CHEST_CLOSE = "random.chestclosed";
private static final String SOUND_PREFIX = Reference.MOD_ID.toLowerCase() + ":";
public static final String CHARGE_DOWN = SOUND_PREFIX + "chargeDown";
public static final String CHARGE_UP = SOUND_PREFIX + "chargeUp";
public static final String DESTRUCTION = SOUND_PREFIX + "destruct";
public static final String FAIL = SOUND_PREFIX + "fail";
public static final String CHARGE_FAIL = FAIL;
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";
public static final String CHARGE_DOWN = "chargeDown";
public static final String CHARGE_UP = "chargeUp";
public static final String DESTRUCTION = "destruct";
public static final String FAIL = "fail";
public static final String GUST = "gust";
public static final String HEAL = "heal";
public static final String KINESIS = "kinesis";
public static final String LAUNCH = "launch";
public static final String NOVA = "nova";
public static final String PHILOSOPHERS_BALL = "philball";
public static final String TOCK = "tock";
public static final String TRANSMUTE = "transmute";
public static final String WALL = "wall";
public static final String WATER_BALL = "waterball";
public static final String WIND = "wind";
}

View file

@ -2,7 +2,7 @@ package com.pahimar.ee3.reference;
public enum ToolMode
{
STANDARD, DEEP, WIDE, TALL, SQUARE, CUBE, SLASH, MEGA;
UNKNOWN, STANDARD, DEEP, WIDE, TALL, SQUARE, CUBE, SLASH, MEGA;
public static final ToolMode[] TYPES = ToolMode.values();
}

View file

@ -0,0 +1,19 @@
package com.pahimar.ee3.util;
import com.pahimar.ee3.network.PacketHandler;
import com.pahimar.ee3.network.message.MessageSoundEvent;
import cpw.mods.fml.common.network.NetworkRegistry;
import net.minecraft.entity.player.EntityPlayer;
public class NetworkSoundHelper
{
public static void playSoundAt(EntityPlayer entityPlayer, String soundName, float volume, float pitch)
{
playSoundAt(entityPlayer, soundName, volume, pitch, 32d);
}
public static void playSoundAt(EntityPlayer entityPlayer, String soundName, float volume, float pitch, double range)
{
PacketHandler.INSTANCE.sendToAllAround(new MessageSoundEvent(entityPlayer, soundName, volume, pitch), new NetworkRegistry.TargetPoint(entityPlayer.worldObj.provider.dimensionId, entityPlayer.posX, entityPlayer.posY, entityPlayer.posZ, range));
}
}

View file

@ -6,6 +6,9 @@ general.transmutation.knowledge.mode.comment=All - Player can learn all items th
general.transmutation.knowledge.template.label=Use Knowledge Template File
general.transmutation.knowledge.template.comment=If true, new player's will have their transmutation knowledge copied from the knowledge template file (template.ee3)
general.sound.soundMode.label=Sounds
general.sound.soundMode.comment='All' plays mod sounds from all players, 'Self' only plays mod sounds from you, and 'None' plays no mod sounds
# Keys
key.categories.ee3=Equivalent Exchange 3
key.charge=Charge
@ -47,11 +50,11 @@ item.ee3:matterVoid.name=Void Matter [WIP]
# Tools
item.ee3:shovelDarkMatter.name=Dark Matter Shovel [WIP]
item.ee3:pickaxeDarkMatter.name=Dark Matter Pickaxe [WIP]
item.ee3:pickAxeDarkMatter.name=Dark Matter Pickaxe [WIP]
item.ee3:hammerDarkMatter.name=Dark Matter Hammer [WIP]
item.ee3:axeDarkMatter.name=Dark Matter Axe [WIP]
item.ee3:hoeDarkMatter.name=Dark Matter Hoe [WIP]
item.ee3:fishingrodDarkMatter.name=Dark Matter Fishing Rod [WIP]
item.ee3:fishingRodDarkMatter.name=Dark Matter Fishing Rod [WIP]
item.ee3:shearsDarkMatter.name=Dark Matter Shears [WIP]
# Weapons

Binary file not shown.

Before

Width:  |  Height:  |  Size: 349 B

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 360 B

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 148 B

After

Width:  |  Height:  |  Size: 772 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 153 B

After

Width:  |  Height:  |  Size: 797 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 181 B

After

Width:  |  Height:  |  Size: 953 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 548 B

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 399 B

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 525 B

After

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 576 B

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 364 B

After

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 400 B

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 351 B

After

Width:  |  Height:  |  Size: 1.9 KiB