Format + license headers.
This commit is contained in:
parent
2a0a9e5636
commit
268a16958b
2 changed files with 65 additions and 17 deletions
|
@ -1,3 +1,27 @@
|
|||
/*
|
||||
* This file is part of TechReborn, licensed under the MIT License (MIT).
|
||||
*
|
||||
* Copyright (c) 2017 TechReborn
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package techreborn.blocks;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
|
@ -23,7 +47,6 @@ import techreborn.tiles.TileAlarm;
|
|||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
//TODO: On/off variants, Placeable on walls/roofs(faces), Visible when holding in hand, and recipe.
|
||||
|
||||
public class BlockAlarm extends BaseTileBlock {
|
||||
public static PropertyDirection FACING;
|
||||
|
@ -84,8 +107,8 @@ public class BlockAlarm extends BaseTileBlock {
|
|||
world.setBlockState(pos, world.getBlockState(pos).withProperty(FACING, facing));
|
||||
}
|
||||
|
||||
public static void setActive(Boolean active, World world, BlockPos pos) {
|
||||
EnumFacing facing = (EnumFacing)world.getBlockState(pos).getValue(FACING);
|
||||
public static void setActive(boolean active, World world, BlockPos pos) {
|
||||
EnumFacing facing = world.getBlockState(pos).getValue(FACING);
|
||||
IBlockState state = world.getBlockState(pos).withProperty(ACTIVE, active).withProperty(FACING, facing);
|
||||
world.setBlockState(pos, state, 3);
|
||||
}
|
||||
|
|
|
@ -1,3 +1,27 @@
|
|||
/*
|
||||
* This file is part of TechReborn, licensed under the MIT License (MIT).
|
||||
*
|
||||
* Copyright (c) 2017 TechReborn
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package techreborn.tiles;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
@ -6,18 +30,19 @@ import net.minecraft.util.SoundCategory;
|
|||
import techreborn.blocks.BlockAlarm;
|
||||
import techreborn.init.ModSounds;
|
||||
|
||||
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);
|
||||
world.playSound(null, getPos().getX(), getPos().getY(), getPos().getZ(), ModSounds.ALARM, SoundCategory.BLOCKS, 4F, 1F);
|
||||
state = true;
|
||||
} else if(!world.isRemote && world.getTotalWorldTime() % 25 == 0 ) {
|
||||
BlockAlarm.setActive(false, world, pos);
|
||||
state = false;
|
||||
}
|
||||
}
|
||||
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);
|
||||
world.playSound(null, getPos().getX(), getPos().getY(), getPos().getZ(), ModSounds.ALARM, SoundCategory.BLOCKS, 4F, 1F);
|
||||
state = true;
|
||||
} else if (!world.isRemote && world.getTotalWorldTime() % 25 == 0) {
|
||||
BlockAlarm.setActive(false, world, pos);
|
||||
state = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue