Animation
This commit is contained in:
parent
bdc34d673c
commit
2177b72e41
5 changed files with 32 additions and 17 deletions
|
@ -30,7 +30,7 @@ public class BlockAlarm extends BaseTileBlock {
|
|||
public static PropertyBool ACTIVE;
|
||||
|
||||
private static AxisAlignedBB[] GenBoundingBoxes(double depth, double width) {
|
||||
AxisAlignedBB[] bb = {
|
||||
AxisAlignedBB[] dimm = {
|
||||
new AxisAlignedBB(width, 1.0 - depth, width, 1.0 - width, 1.0D, 1.0 - width),
|
||||
new AxisAlignedBB(width, 0.0D, width, 1.0 - width, depth, 1.0 - width),
|
||||
new AxisAlignedBB(width, width, 1.0 - depth, 1.0 - width, 1.0 - width, 1.0D),
|
||||
|
@ -38,16 +38,15 @@ public class BlockAlarm extends BaseTileBlock {
|
|||
new AxisAlignedBB(1.0 - depth, width, width, 1.0D, 1.0 - width, 1.0 - width),
|
||||
new AxisAlignedBB(0.0D, width, width, depth, 1.0 - width, 1.0 - width),
|
||||
};
|
||||
return bb;
|
||||
return dimm;
|
||||
}
|
||||
|
||||
private AxisAlignedBB[] bbs;
|
||||
|
||||
public BlockAlarm() {
|
||||
super(Material.ROCK);
|
||||
setUnlocalizedName("techreborn.alarm");
|
||||
this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH).withProperty(ACTIVE, false));
|
||||
this.bbs = GenBoundingBoxes(0.19, 0.81);
|
||||
this.bbs = GenBoundingBoxes(0.19, 0.8);
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
ShootingStar.registerModel(new ModelCompound(ModInfo.MOD_ID, this, "machines/lighting"));
|
||||
}
|
||||
|
|
|
@ -3,13 +3,20 @@ package techreborn.tiles;
|
|||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ITickable;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import techreborn.blocks.BlockAlarm;
|
||||
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);
|
||||
}
|
||||
}
|
||||
public class TileAlarm extends TileEntity implements ITickable {
|
||||
boolean state = false;
|
||||
int selectedSound;
|
||||
@Override
|
||||
public void update() {
|
||||
if (!world.isRemote && world.getTotalWorldTime() % 25 == 0 && world.isBlockPowered(getPos())) {
|
||||
BlockAlarm.setActive(true, world, pos);
|
||||
state = true;
|
||||
} else if(!world.isRemote && world.getTotalWorldTime() % 25 == 0 ) {
|
||||
BlockAlarm.setActive(false, world, pos);
|
||||
state = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,13 +2,18 @@
|
|||
"forge_marker": 1,
|
||||
"defaults": {
|
||||
"transform": "forge:default-block",
|
||||
"model": "techreborn:alarm"
|
||||
"model": "techreborn:alarm",
|
||||
"textures": {
|
||||
"particle": "#alarm"
|
||||
}
|
||||
},
|
||||
"variants": {
|
||||
"inventory": {
|
||||
"transform": "forge:default-block",
|
||||
"model": "techreborn:alarm",
|
||||
"textures": {}
|
||||
"textures": {
|
||||
"alarm": "techreborn:blocks/machines/lighting/alarm_off"
|
||||
}
|
||||
},
|
||||
"facing": {
|
||||
"down": {
|
||||
|
@ -35,7 +40,7 @@
|
|||
"active": {
|
||||
"true": {
|
||||
"textures": {
|
||||
"alarm": "techreborn:blocks/machines/lighting/alarm_off"
|
||||
"alarm": "techreborn:blocks/machines/lighting/alarm_on"
|
||||
}
|
||||
},
|
||||
"false": {
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
{
|
||||
"textures": {
|
||||
"0": "techreborn:blocks/machines/lighting/alarm_off",
|
||||
"particle": "techreborn:blocks/machines/lighting/alarm_off"
|
||||
"0": "#alarm"
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"name": "cube",
|
||||
"name": "Alarm",
|
||||
"from": [3, 0, 3],
|
||||
"to": [13, 3, 13],
|
||||
"faces": {
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"animation": {
|
||||
"frametime": 5
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue