mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-17 03:15:35 -04:00
it: fuel slot
This commit is contained in:
parent
3119918641
commit
e417671473
@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2020-2022 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
|
||||
*/
|
||||
|
||||
package de.bixilon.minosoft.data.container.slots
|
||||
|
||||
import de.bixilon.minosoft.data.container.click.ContainerTestUtil
|
||||
import de.bixilon.minosoft.data.container.stack.ItemStack
|
||||
import de.bixilon.minosoft.data.registries.items.AppleTestO
|
||||
import de.bixilon.minosoft.data.registries.items.CoalTest0
|
||||
import de.bixilon.minosoft.data.registries.items.LavaBucketTest0
|
||||
import de.bixilon.minosoft.data.registries.items.WaterBucketTest0
|
||||
import org.testng.Assert.assertFalse
|
||||
import org.testng.Assert.assertTrue
|
||||
import org.testng.annotations.Test
|
||||
|
||||
@Test(groups = ["container"])
|
||||
class FuelSlotTypeTest {
|
||||
|
||||
fun apple() {
|
||||
assertFalse(FuelSlotType.canPut(ContainerTestUtil.createContainer(), 0, ItemStack(AppleTestO.item)))
|
||||
}
|
||||
|
||||
fun lavaBucket() {
|
||||
assertTrue(FuelSlotType.canPut(ContainerTestUtil.createContainer(), 0, ItemStack(LavaBucketTest0.item)))
|
||||
}
|
||||
|
||||
fun waterBucket() {
|
||||
assertFalse(FuelSlotType.canPut(ContainerTestUtil.createContainer(), 0, ItemStack(WaterBucketTest0.item)))
|
||||
}
|
||||
|
||||
fun coal() {
|
||||
assertTrue(FuelSlotType.canPut(ContainerTestUtil.createContainer(), 0, ItemStack(CoalTest0.item)))
|
||||
}
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2020-2022 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
|
||||
*/
|
||||
|
||||
package de.bixilon.minosoft.data.registries.items
|
||||
|
||||
import de.bixilon.kutil.cast.CastUtil.unsafeNull
|
||||
import de.bixilon.minosoft.data.registries.item.MinecraftItems
|
||||
import de.bixilon.minosoft.data.registries.item.items.Item
|
||||
import org.testng.annotations.Test
|
||||
|
||||
@Test(groups = ["item"])
|
||||
class CoalTest : ItemTest<Item>() {
|
||||
|
||||
init {
|
||||
CoalTest0 = this
|
||||
}
|
||||
|
||||
fun getTorch() {
|
||||
super.retrieveBlock(MinecraftItems.COAL)
|
||||
}
|
||||
}
|
||||
|
||||
var CoalTest0: CoalTest = unsafeNull()
|
@ -26,7 +26,7 @@ class EggTest : ItemTest<Item>() {
|
||||
}
|
||||
|
||||
fun getTorch() {
|
||||
super.retrieveBlock(MinecraftItems.APPLE)
|
||||
super.retrieveBlock(MinecraftItems.EGG)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2020-2022 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
|
||||
*/
|
||||
|
||||
package de.bixilon.minosoft.data.registries.items
|
||||
|
||||
import de.bixilon.kutil.cast.CastUtil.unsafeNull
|
||||
import de.bixilon.minosoft.data.registries.fluid.lava.LavaFluid
|
||||
import de.bixilon.minosoft.data.registries.item.MinecraftItems
|
||||
import de.bixilon.minosoft.data.registries.item.items.bucket.BucketItem
|
||||
import org.testng.Assert.assertTrue
|
||||
import org.testng.annotations.Test
|
||||
|
||||
@Test(groups = ["item"])
|
||||
class LavaBucketTest : ItemTest<BucketItem>() {
|
||||
|
||||
init {
|
||||
LavaBucketTest0 = this
|
||||
assertTrue(item.fluid is LavaFluid)
|
||||
}
|
||||
|
||||
fun getTorch() {
|
||||
super.retrieveBlock(MinecraftItems.LAVA_BUCKET)
|
||||
}
|
||||
}
|
||||
|
||||
var LavaBucketTest0: LavaBucketTest = unsafeNull()
|
@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2020-2022 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
|
||||
*/
|
||||
|
||||
package de.bixilon.minosoft.data.registries.items
|
||||
|
||||
import de.bixilon.kutil.cast.CastUtil.unsafeNull
|
||||
import de.bixilon.minosoft.data.registries.fluid.water.WaterFluid
|
||||
import de.bixilon.minosoft.data.registries.item.MinecraftItems
|
||||
import de.bixilon.minosoft.data.registries.item.items.bucket.BucketItem
|
||||
import org.testng.Assert.assertTrue
|
||||
import org.testng.annotations.Test
|
||||
|
||||
@Test(groups = ["item"])
|
||||
class WaterBucketTest : ItemTest<BucketItem>() {
|
||||
|
||||
init {
|
||||
WaterBucketTest0 = this
|
||||
assertTrue(item.fluid is WaterFluid)
|
||||
}
|
||||
|
||||
fun getTorch() {
|
||||
super.retrieveBlock(MinecraftItems.WATER_BUCKET)
|
||||
}
|
||||
}
|
||||
|
||||
var WaterBucketTest0: WaterBucketTest = unsafeNull()
|
@ -15,8 +15,6 @@ package de.bixilon.minosoft.data.container.slots
|
||||
|
||||
import de.bixilon.minosoft.data.container.Container
|
||||
import de.bixilon.minosoft.data.container.stack.ItemStack
|
||||
import de.bixilon.minosoft.data.registries.fluid.DefaultFluids
|
||||
import de.bixilon.minosoft.data.registries.item.items.bucket.BucketItem
|
||||
|
||||
@Deprecated("ToDo")
|
||||
object EnchantableSlotType : SlotType {
|
||||
@ -24,10 +22,6 @@ object EnchantableSlotType : SlotType {
|
||||
override fun canPut(container: Container, slot: Int, stack: ItemStack): Boolean {
|
||||
val item = stack.item.item
|
||||
|
||||
if (item is BucketItem && item.fluid.resourceLocation == DefaultFluids.LAVA) {
|
||||
return true
|
||||
}
|
||||
// ToDo: get from registries (misc/fuel_time)
|
||||
return super.canPut(container, slot, stack)
|
||||
}
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ package de.bixilon.minosoft.data.container.slots
|
||||
|
||||
import de.bixilon.minosoft.data.container.Container
|
||||
import de.bixilon.minosoft.data.container.stack.ItemStack
|
||||
import de.bixilon.minosoft.data.registries.fluid.DefaultFluids
|
||||
import de.bixilon.minosoft.data.registries.fluid.lava.LavaFluid
|
||||
import de.bixilon.minosoft.data.registries.item.items.bucket.BucketItem
|
||||
|
||||
@Deprecated("ToDo")
|
||||
@ -24,7 +24,7 @@ object FuelSlotType : SlotType {
|
||||
override fun canPut(container: Container, slot: Int, stack: ItemStack): Boolean {
|
||||
val item = stack.item.item
|
||||
|
||||
if (item is BucketItem && item.fluid.resourceLocation == DefaultFluids.LAVA) {
|
||||
if (item is BucketItem && item.fluid is LavaFluid) {
|
||||
return true
|
||||
}
|
||||
// ToDo: get from registries (misc/fuel_time)
|
||||
|
@ -20,4 +20,7 @@ object MinecraftItems {
|
||||
val LAPISLAZULI = "minecraft:lapis_lazuli".toResourceLocation()
|
||||
val APPLE = "minecraft:apple".toResourceLocation()
|
||||
val EGG = "minecraft:egg".toResourceLocation()
|
||||
val LAVA_BUCKET = "minecraft:lava_bucket".toResourceLocation()
|
||||
val WATER_BUCKET = "minecraft:water_bucket".toResourceLocation()
|
||||
val COAL = "minecraft:coal".toResourceLocation()
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user