Start work on the alarm

This commit is contained in:
modmuss50 2017-12-18 19:58:52 +00:00
parent 5be3163eeb
commit 7594b55fb5
No known key found for this signature in database
GPG key ID: 773D17BE8BF49C82
7 changed files with 53 additions and 0 deletions

View file

@ -0,0 +1,25 @@
package techreborn.blocks;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import techreborn.client.TechRebornCreativeTab;
import techreborn.tiles.TileAlarm;
import javax.annotation.Nullable;
public class BlockAlarm extends BlockContainer {
public BlockAlarm() {
super(Material.ROCK);
setUnlocalizedName("techreborn.alarm");
setCreativeTab(TechRebornCreativeTab.instance);
}
@Nullable
@Override
public TileEntity createNewTileEntity(World worldIn, int meta) {
return new TileAlarm();
}
}

View file

@ -152,6 +152,7 @@ public class ModBlocks {
public static Block LAMP_INCANDESCENT;
public static Block LAMP_LED;
public static Block ALARM;
/**
* Register blocks
@ -427,6 +428,10 @@ public class ModBlocks {
GameRegistry.registerTileEntity(TileLamp.class, "TileLampTR");
ALARM = new BlockAlarm();
registerBlock(ALARM, "alarm");
GameRegistry.registerTileEntity(TileAlarm.class, "TileAlarmTR");
//TODO enable when done
// flare = new BlockFlare();
// registerBlock(flare, "flare");

View file

@ -43,6 +43,7 @@ public class ModSounds {
public static SoundEvent AUTO_CRAFTING;
public static SoundEvent MACHINE_RUN;
public static SoundEvent MACHINE_START;
public static SoundEvent ALARM;
public static void init() {
CABLE_SHOCK = getSound("cable_shock");
@ -51,6 +52,7 @@ public class ModSounds {
AUTO_CRAFTING = getSound("auto_crafting");
MACHINE_RUN = getSound("machine_run");
MACHINE_START = getSound("machine_start");
ALARM = getSound("alarm");
RecipeCrafter.soundHanlder = new SoundHandler();
}

View file

@ -0,0 +1,15 @@
package techreborn.tiles;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ITickable;
import net.minecraft.util.SoundCategory;
import techreborn.init.ModSounds;
public class TileAlarm extends TileEntity implements ITickable{
@Override
public void update() {
if(!world.isRemote && world.getTotalWorldTime() % 25 == 0 && world.isBlockPowered(getPos())){
world.playSound(null, getPos().getX(), getPos().getY(), getPos().getZ(), ModSounds.ALARM, SoundCategory.BLOCKS, 4F, 1F);
}
}
}

View file

@ -34,5 +34,11 @@
"sounds": [
"techreborn:machine_start"
]
},
"alarm": {
"category": "block",
"sounds": [
"techreborn:alarm"
]
}
}

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB