Code cleanup

This commit is contained in:
Shadowfacts 2017-07-01 19:27:50 -04:00
parent b97e44f816
commit 6f551660c7
Signed by: shadowfacts
GPG Key ID: 94A5AB95422746E5
11 changed files with 18 additions and 35 deletions

View File

@ -8,8 +8,6 @@ import net.minecraft.item.ItemStack
*/
object EHCreativeTab: CreativeTabs(MOD_ID) {
override fun getTabIconItem(): ItemStack {
return ItemStack(ExtraHoppers.blocks.woodenHopper)
}
override fun getTabIconItem() = ItemStack(ExtraHoppers.blocks.woodenHopper)
}

View File

@ -3,7 +3,6 @@ package net.shadowfacts.extrahoppers
import net.minecraft.block.Block
import net.minecraft.item.Item
import net.minecraftforge.client.event.ModelRegistryEvent
import net.minecraftforge.common.MinecraftForge
import net.minecraftforge.event.RegistryEvent
import net.minecraftforge.fml.client.registry.ClientRegistry
import net.minecraftforge.fml.common.Mod
@ -20,7 +19,6 @@ import net.shadowfacts.extrahoppers.block.fluid.TileEntityFluidHopper
import net.shadowfacts.extrahoppers.block.inverted.TileEntityInvertedHopper
import net.shadowfacts.extrahoppers.block.wooden.TileEntityWoodenHopper
import net.shadowfacts.extrahoppers.block.wooden_fluid.TileEntityWoodenFluidHopper
import net.shadowfacts.extrahoppers.event.ClientEventHandler
import net.shadowfacts.extrahoppers.gui.GUIHandler
/**
@ -45,8 +43,6 @@ object ExtraHoppers {
fun preInitClient(event: FMLPreInitializationEvent) {
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityFluidHopper::class.java, TESRFluidHopper)
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityWoodenFluidHopper::class.java, TESRFluidHopper)
MinecraftForge.EVENT_BUS.register(ClientEventHandler)
}
@Mod.EventBusSubscriber

View File

@ -5,4 +5,4 @@ package net.shadowfacts.extrahoppers
*/
const val MOD_ID = "extrahoppers"
const val NAME = "Extra Hoppers"
const val VERSION = "@VERSION@"
const val VERSION = "2.0.0-a1"

View File

@ -21,9 +21,7 @@ abstract class BlockTE<out TE: BaseTileEntity>(name: String, material: Material
abstract override fun createTileEntity(world: World, state: IBlockState): TE
override fun hasTileEntity(state: IBlockState): Boolean {
return true
}
override fun hasTileEntity(state: IBlockState) = true
fun getTileEntity(world: IBlockAccess, pos: BlockPos): TE {
return world.getTileEntity(pos) as TE

View File

@ -24,9 +24,7 @@ class BlockAdvancedHopper(inverted: Boolean): BlockHopperBase<TileEntityAdvanced
}
@Deprecated("")
override fun hasComparatorInputOverride(state: IBlockState?): Boolean {
return true
}
override fun hasComparatorInputOverride(state: IBlockState) = true
@Deprecated("")
override fun getComparatorInputOverride(state: IBlockState, world: World, pos: BlockPos): Int {

View File

@ -79,9 +79,10 @@ abstract class BlockHopperBase<out TE: BaseTileEntity>(val inverted: Boolean, va
}
@Deprecated("")
override fun isOpaqueCube(state: IBlockState?): Boolean {
return false
}
override fun isOpaqueCube(state: IBlockState) = false
@Deprecated("")
override fun isFullCube(state: IBlockState?) = false
}

View File

@ -25,9 +25,7 @@ class BlockInvertedHopper: BlockHopperBase<TileEntityInvertedHopper>(true, false
}
@Deprecated("")
override fun hasComparatorInputOverride(state: IBlockState): Boolean {
return true
}
override fun hasComparatorInputOverride(state: IBlockState) = true
@Deprecated("")
override fun getComparatorInputOverride(state: IBlockState, world: World, pos: BlockPos): Int {

View File

@ -4,15 +4,19 @@ import net.minecraft.client.resources.I18n
import net.minecraft.util.text.TextFormatting
import net.minecraftforge.event.entity.player.ItemTooltipEvent
import net.minecraftforge.fluids.capability.CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY
import net.minecraftforge.fml.common.Mod
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import net.shadowfacts.extrahoppers.EHConfig
import net.shadowfacts.extrahoppers.MOD_ID
import net.shadowfacts.extrahoppers.gui.GUIHandler
/**
* @author shadowfacts
*/
@Mod.EventBusSubscriber(modid = MOD_ID)
object ClientEventHandler {
@JvmStatic
@SubscribeEvent
fun itemTooltip(event: ItemTooltipEvent) {
if (GUIHandler.woodenFluidHopperOpen) {

View File

@ -12,13 +12,9 @@ import net.shadowfacts.shadowmc.util.MouseButton
//TODO: move me to ShadowMC
class UIFilterButton(val callback: (UIFilterButton) -> Unit, id: String, vararg classes: String): UIButtonBase("", id, *classes) {
override fun getMinDimensions(): UIDimensions {
return preferredDimensions
}
override fun getMinDimensions() = preferredDimensions
override fun getPreferredDimensions(): UIDimensions {
return UIDimensions(20, 20)
}
override fun getPreferredDimensions() = UIDimensions(20, 20)
override fun handlePress(mouseX: Int, mouseY: Int, button: MouseButton?): Boolean {
callback(this)

View File

@ -9,8 +9,6 @@ import net.shadowfacts.shadowmc.ui.element.UIFluidIndicator
*/
class UIFluidIndicator(tank: IFluidTank, id: String, vararg classes: String): UIFluidIndicator(tank, id, *classes) {
override fun getPreferredDimensions(): UIDimensions {
return UIDimensions(20, 73)
}
override fun getPreferredDimensions() = UIDimensions(20, 73)
}

View File

@ -11,13 +11,9 @@ object NoOpFilter: Filter<Any>() {
override fun setFromStack(i: Int, stack: ItemStack) {
}
override fun accepts(stack: Any): Boolean {
return true
}
override fun accepts(stack: Any) = true
override fun writeToNBT(tag: NBTTagCompound): NBTTagCompound {
return tag
}
override fun writeToNBT(tag: NBTTagCompound) = tag
override fun readFromNBT(tag: NBTTagCompound) {
}