Start work on the alarm
This commit is contained in:
parent
5be3163eeb
commit
7594b55fb5
7 changed files with 53 additions and 0 deletions
25
src/main/java/techreborn/blocks/BlockAlarm.java
Normal file
25
src/main/java/techreborn/blocks/BlockAlarm.java
Normal 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();
|
||||
}
|
||||
}
|
|
@ -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");
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
15
src/main/java/techreborn/tiles/TileAlarm.java
Normal file
15
src/main/java/techreborn/tiles/TileAlarm.java
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -34,5 +34,11 @@
|
|||
"sounds": [
|
||||
"techreborn:machine_start"
|
||||
]
|
||||
},
|
||||
"alarm": {
|
||||
"category": "block",
|
||||
"sounds": [
|
||||
"techreborn:alarm"
|
||||
]
|
||||
}
|
||||
}
|
BIN
src/main/resources/assets/techreborn/sounds/alarm.ogg
Normal file
BIN
src/main/resources/assets/techreborn/sounds/alarm.ogg
Normal file
Binary file not shown.
BIN
src/main/resources/assets/techreborn/textures/blocks/alarm.png
Normal file
BIN
src/main/resources/assets/techreborn/textures/blocks/alarm.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.9 KiB |
Loading…
Reference in a new issue