1 Commits

Author SHA1 Message Date
KitsuShadow
d7e1d7b185 Sounds in work on SpringBox 2015-08-31 06:40:00 -04:00
9 changed files with 80 additions and 2 deletions

View File

@@ -16,6 +16,8 @@ import cpw.mods.fml.common.event.FMLPreInitializationEvent;
@Mod(modid = ModInfo.MOD_ID, name = ModInfo.MOD_NAME, version = ModInfo.MOD_VERSION)
public class Energy {
public static final String MOD_ID = ModInfo.MOD_ID;
@SidedProxy(clientSide = ModInfo.CLIENT_PROXY, serverSide = ModInfo.COMMON_PROXY)
public static CommonProxy proxy;

View File

@@ -1,8 +1,11 @@
package nmd.primal.energy.block;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.block.material.Material;
import net.minecraft.client.main.Main;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
@@ -10,6 +13,7 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MathHelper;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import nmd.primal.energy.Energy;
import nmd.primal.energy.block.grinder.CrankGrinder;
import nmd.primal.energy.block.lathe.LatheBase;
import nmd.primal.energy.common.ModInfo;
@@ -22,6 +26,8 @@ import nmd.primal.energy.util.EnergyUtil;
public class CrankBlock extends Block implements ITileEntityProvider{
private static Random rand = new Random();
protected CrankBlock(String unlocalizedName, Material mat) {
super(mat);
this.setBlockName(unlocalizedName);
@@ -57,6 +63,7 @@ public class CrankBlock extends Block implements ITileEntityProvider{
tileGrinder.power+=15;
tileGrinder.workCount+=20;
tileGrinder.getStackInSlot(1).setItemDamage(tileGrinder.getStackInSlot(1).getItemDamage()+1);
}
tileGrinder.markDirty();
tileGrinder.markForUpdate();

View File

@@ -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;
}
}

View File

@@ -14,6 +14,7 @@ import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.IExtendedEntityProperties;
import nmd.primal.energy.common.ModInfo;
import nmd.primal.energy.item.ModItems;
import nmd.primal.energy.util.LatheRecipes;
@@ -64,6 +65,7 @@ public class TileEntLatheBase extends TileEntity implements IInventory {
int y = this.yCoord;
int z = this.zCoord;
if(!world.isRemote){
playSound(world, x,y,z);
if(this.isPowered==true){
this.power--;
rot-=45;
@@ -81,6 +83,18 @@ public class TileEntLatheBase extends TileEntity implements IInventory {
}
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
public ItemStack decrStackSize(int slot, int amount) {

View File

@@ -15,7 +15,9 @@ import net.minecraft.network.NetworkManager;
import net.minecraft.network.Packet;
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import nmd.primal.energy.common.ModInfo;
import nmd.primal.energy.util.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 z = this.zCoord;
if(!world.isRemote){
doRotation();
playSound(world, x,y,z);
doRotation(world, x,y,z);
doWork(world, x,y,z);
}
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){
this.power--;
rot-=45;
//System.out.println(rot);
if(rot>=360||rot<=-360){
rot=0;

View File

@@ -0,0 +1,4 @@
{
"stonegrinder": {"category": "neutral", "sounds": [{"name": "stonegrinder", "stream": false}]},
"lathewood": {"category": "neutral", "sounds": [{"name": "lathewood", "stream": false}]}
}

Binary file not shown.

View File

@@ -0,0 +1,3 @@
{
"stonegrinder": {"category": "neutral", "sounds": [{"name": "stonegrinder", "stream": false}]}
}