From 268a16958b8f901e391ca5ed7a6bf95735d314bc Mon Sep 17 00:00:00 2001 From: modmuss50 Date: Mon, 8 Jan 2018 18:29:12 +0000 Subject: [PATCH] Format + license headers. --- .../java/techreborn/blocks/BlockAlarm.java | 29 ++++++++-- src/main/java/techreborn/tiles/TileAlarm.java | 53 ++++++++++++++----- 2 files changed, 65 insertions(+), 17 deletions(-) diff --git a/src/main/java/techreborn/blocks/BlockAlarm.java b/src/main/java/techreborn/blocks/BlockAlarm.java index d1e43a990..0a7c8686b 100644 --- a/src/main/java/techreborn/blocks/BlockAlarm.java +++ b/src/main/java/techreborn/blocks/BlockAlarm.java @@ -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); } diff --git a/src/main/java/techreborn/tiles/TileAlarm.java b/src/main/java/techreborn/tiles/TileAlarm.java index ff314362c..6dbadcd8e 100644 --- a/src/main/java/techreborn/tiles/TileAlarm.java +++ b/src/main/java/techreborn/tiles/TileAlarm.java @@ -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; + } + } }