Sounds in work on SpringBox
This commit is contained in:
@@ -16,6 +16,8 @@ import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
|||||||
@Mod(modid = ModInfo.MOD_ID, name = ModInfo.MOD_NAME, version = ModInfo.MOD_VERSION)
|
@Mod(modid = ModInfo.MOD_ID, name = ModInfo.MOD_NAME, version = ModInfo.MOD_VERSION)
|
||||||
public class Energy {
|
public class Energy {
|
||||||
|
|
||||||
|
public static final String MOD_ID = ModInfo.MOD_ID;
|
||||||
|
|
||||||
@SidedProxy(clientSide = ModInfo.CLIENT_PROXY, serverSide = ModInfo.COMMON_PROXY)
|
@SidedProxy(clientSide = ModInfo.CLIENT_PROXY, serverSide = ModInfo.COMMON_PROXY)
|
||||||
public static CommonProxy proxy;
|
public static CommonProxy proxy;
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
package nmd.primal.energy.block;
|
package nmd.primal.energy.block;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.ITileEntityProvider;
|
import net.minecraft.block.ITileEntityProvider;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
|
import net.minecraft.client.main.Main;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
@@ -10,6 +13,7 @@ import net.minecraft.tileentity.TileEntity;
|
|||||||
import net.minecraft.util.MathHelper;
|
import net.minecraft.util.MathHelper;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
import nmd.primal.energy.Energy;
|
||||||
import nmd.primal.energy.block.grinder.CrankGrinder;
|
import nmd.primal.energy.block.grinder.CrankGrinder;
|
||||||
import nmd.primal.energy.block.lathe.LatheBase;
|
import nmd.primal.energy.block.lathe.LatheBase;
|
||||||
import nmd.primal.energy.common.ModInfo;
|
import nmd.primal.energy.common.ModInfo;
|
||||||
@@ -22,6 +26,8 @@ import nmd.primal.energy.util.EnergyUtil;
|
|||||||
|
|
||||||
public class CrankBlock extends Block implements ITileEntityProvider{
|
public class CrankBlock extends Block implements ITileEntityProvider{
|
||||||
|
|
||||||
|
private static Random rand = new Random();
|
||||||
|
|
||||||
protected CrankBlock(String unlocalizedName, Material mat) {
|
protected CrankBlock(String unlocalizedName, Material mat) {
|
||||||
super(mat);
|
super(mat);
|
||||||
this.setBlockName(unlocalizedName);
|
this.setBlockName(unlocalizedName);
|
||||||
@@ -57,6 +63,7 @@ public class CrankBlock extends Block implements ITileEntityProvider{
|
|||||||
tileGrinder.power+=15;
|
tileGrinder.power+=15;
|
||||||
tileGrinder.workCount+=20;
|
tileGrinder.workCount+=20;
|
||||||
tileGrinder.getStackInSlot(1).setItemDamage(tileGrinder.getStackInSlot(1).getItemDamage()+1);
|
tileGrinder.getStackInSlot(1).setItemDamage(tileGrinder.getStackInSlot(1).getItemDamage()+1);
|
||||||
|
|
||||||
}
|
}
|
||||||
tileGrinder.markDirty();
|
tileGrinder.markDirty();
|
||||||
tileGrinder.markForUpdate();
|
tileGrinder.markForUpdate();
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
package nmd.primal.energy.block.battery;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.ITileEntityProvider;
|
||||||
|
import net.minecraft.block.material.Material;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import nmd.primal.energy.common.ModInfo;
|
||||||
|
import nmd.primal.energy.util.CustomTab;
|
||||||
|
|
||||||
|
public class StandardSpringBox extends Block implements ITileEntityProvider{
|
||||||
|
|
||||||
|
private static Random rand = new Random();
|
||||||
|
|
||||||
|
protected StandardSpringBox(String unlocalizedName, Material mat) {
|
||||||
|
super(mat);
|
||||||
|
this.setBlockName(unlocalizedName);
|
||||||
|
this.setBlockTextureName(ModInfo.MOD_ID + ":" + unlocalizedName);
|
||||||
|
this.setCreativeTab(CustomTab.NMDEnergyTab);
|
||||||
|
this.setHardness(1.0F);
|
||||||
|
this.setResistance(6.0F);
|
||||||
|
this.setStepSound(soundTypeStone);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TileEntity createNewTileEntity(World world, int i) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -14,6 +14,7 @@ import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
|
|||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.IExtendedEntityProperties;
|
import net.minecraftforge.common.IExtendedEntityProperties;
|
||||||
|
import nmd.primal.energy.common.ModInfo;
|
||||||
import nmd.primal.energy.item.ModItems;
|
import nmd.primal.energy.item.ModItems;
|
||||||
import nmd.primal.energy.util.LatheRecipes;
|
import nmd.primal.energy.util.LatheRecipes;
|
||||||
|
|
||||||
@@ -64,6 +65,7 @@ public class TileEntLatheBase extends TileEntity implements IInventory {
|
|||||||
int y = this.yCoord;
|
int y = this.yCoord;
|
||||||
int z = this.zCoord;
|
int z = this.zCoord;
|
||||||
if(!world.isRemote){
|
if(!world.isRemote){
|
||||||
|
playSound(world, x,y,z);
|
||||||
if(this.isPowered==true){
|
if(this.isPowered==true){
|
||||||
this.power--;
|
this.power--;
|
||||||
rot-=45;
|
rot-=45;
|
||||||
@@ -81,6 +83,18 @@ public class TileEntLatheBase extends TileEntity implements IInventory {
|
|||||||
}
|
}
|
||||||
if (worldObj.isRemote) return;
|
if (worldObj.isRemote) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void playSound(World world, int x, int y, int z){
|
||||||
|
if(this.isPowered==true){
|
||||||
|
if(i==0){
|
||||||
|
world.playSoundEffect(x, y, z, ModInfo.MOD_ID + ":lathewood", 10.25f, (float) (world.rand.nextFloat()*0.1+0.9f));
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
if(i==15){
|
||||||
|
i=0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack decrStackSize(int slot, int amount) {
|
public ItemStack decrStackSize(int slot, int amount) {
|
||||||
|
|||||||
@@ -15,7 +15,9 @@ import net.minecraft.network.NetworkManager;
|
|||||||
import net.minecraft.network.Packet;
|
import net.minecraft.network.Packet;
|
||||||
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
|
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.util.MathHelper;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
import nmd.primal.energy.common.ModInfo;
|
||||||
import nmd.primal.energy.util.GrinderRecipes;
|
import nmd.primal.energy.util.GrinderRecipes;
|
||||||
|
|
||||||
public class TileEntCrankGrinder extends TileEntity implements IInventory, GrinderRecipes {
|
public class TileEntCrankGrinder extends TileEntity implements IInventory, GrinderRecipes {
|
||||||
@@ -35,16 +37,30 @@ public class TileEntCrankGrinder extends TileEntity implements IInventory, Grind
|
|||||||
int y = this.yCoord;
|
int y = this.yCoord;
|
||||||
int z = this.zCoord;
|
int z = this.zCoord;
|
||||||
if(!world.isRemote){
|
if(!world.isRemote){
|
||||||
doRotation();
|
playSound(world, x,y,z);
|
||||||
|
doRotation(world, x,y,z);
|
||||||
doWork(world, x,y,z);
|
doWork(world, x,y,z);
|
||||||
}
|
}
|
||||||
if (worldObj.isRemote) return;
|
if (worldObj.isRemote) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void playSound(World world, int x, int y, int z){
|
||||||
|
if(this.isPowered==true){
|
||||||
|
if(i==0){
|
||||||
|
world.playSoundEffect(x, y, z, ModInfo.MOD_ID + ":stonegrinder", 0.25f, (float) (world.rand.nextFloat()*0.1+0.9f));
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
if(i==15){
|
||||||
|
i=0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void doRotation(){
|
private void doRotation(World world, int x, int y, int z){
|
||||||
if(this.isPowered==true){
|
if(this.isPowered==true){
|
||||||
this.power--;
|
this.power--;
|
||||||
rot-=45;
|
rot-=45;
|
||||||
|
|
||||||
//System.out.println(rot);
|
//System.out.println(rot);
|
||||||
if(rot>=360||rot<=-360){
|
if(rot>=360||rot<=-360){
|
||||||
rot=0;
|
rot=0;
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"stonegrinder": {"category": "neutral", "sounds": [{"name": "stonegrinder", "stream": false}]},
|
||||||
|
"lathewood": {"category": "neutral", "sounds": [{"name": "lathewood", "stream": false}]}
|
||||||
|
}
|
||||||
|
|||||||
BIN
src/main/resources/assets/energy/sounds/lathewood.ogg
Normal file
BIN
src/main/resources/assets/energy/sounds/lathewood.ogg
Normal file
Binary file not shown.
3
src/main/resources/assets/energy/sounds/sounds.json
Normal file
3
src/main/resources/assets/energy/sounds/sounds.json
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"stonegrinder": {"category": "neutral", "sounds": [{"name": "stonegrinder", "stream": false}]}
|
||||||
|
}
|
||||||
BIN
src/main/resources/assets/energy/sounds/stonegrinder.ogg
Normal file
BIN
src/main/resources/assets/energy/sounds/stonegrinder.ogg
Normal file
Binary file not shown.
Reference in New Issue
Block a user