1
0
mirror of https://github.com/chylex/Hardcore-Ender-Expansion-2.git synced 2025-04-11 03:15:44 +02:00

Add Ender Goo Cauldron (w/ Purified variation)

This commit is contained in:
chylex 2019-08-05 20:27:40 +02:00
parent bb35f183a4
commit 33e924c2b6
7 changed files with 93 additions and 5 deletions

View File

@ -45,7 +45,7 @@ abstract class BlockAbstractGoo(private val fluid: FluidBase, material: Material
private var lastCollidingEntity = ThreadLocal<Pair<Long, UUID>?>()
protected abstract val filledBucket: Item
abstract val filledBucket: Item
protected abstract val tickTrackingKey: String
init{

View File

@ -0,0 +1,53 @@
package chylex.hee.game.block
import chylex.hee.game.mechanics.potion.brewing.PotionItems
import chylex.hee.system.util.get
import chylex.hee.system.util.playUniversal
import net.minecraft.block.state.IBlockState
import net.minecraft.entity.Entity
import net.minecraft.entity.player.EntityPlayer
import net.minecraft.init.Items
import net.minecraft.init.PotionTypes
import net.minecraft.init.SoundEvents
import net.minecraft.item.Item
import net.minecraft.item.ItemStack
import net.minecraft.stats.StatList
import net.minecraft.util.EnumHand
import net.minecraft.util.SoundCategory
import net.minecraft.util.math.BlockPos
import net.minecraft.world.World
class BlockCauldronWithGoo(private val goo: BlockAbstractGoo) : BlockAbstractCauldron(){
init{
setHardness(2F)
}
override fun createFilledBucket(): ItemStack{
return ItemStack(goo.filledBucket)
}
override fun onRightClickedWithItem(world: World, pos: BlockPos, state: IBlockState, player: EntityPlayer, hand: EnumHand, item: Item): Boolean{
if (item === Items.GLASS_BOTTLE){
val level = state[LEVEL]
if (level > 0){
if (!world.isRemote){
player.addStat(StatList.CAULDRON_USED)
useAndUpdateHeldItem(player, hand, PotionItems.getBottle(Items.POTIONITEM, PotionTypes.THICK))
setWaterLevel(world, pos, state, level - 1)
}
SoundEvents.ITEM_BOTTLE_FILL.playUniversal(player, pos, SoundCategory.BLOCKS)
}
return true
}
return super.onRightClickedWithItem(world, pos, state, player, hand, item)
}
override fun onEntityCollision(world: World, pos: BlockPos, state: IBlockState, entity: Entity){
goo.onInsideGoo(entity)
}
override fun fillWithRain(world: World, pos: BlockPos){}
}

View File

@ -4,11 +4,10 @@ import chylex.hee.game.fx.FxBlockData
import chylex.hee.init.ModBlocks
import chylex.hee.network.client.PacketClientFX
import net.minecraft.entity.player.EntityPlayer
import net.minecraft.item.ItemBucket
import net.minecraft.util.math.BlockPos
import net.minecraft.world.World
class ItemPurifiedEnderGooBucket : ItemBucket(ModBlocks.PURIFIED_ENDER_GOO){
class ItemPurifiedEnderGooBucket : ItemBucketWithCauldron(ModBlocks.PURIFIED_ENDER_GOO, ModBlocks.CAULDRON_PURIFIED_ENDER_GOO){
override fun tryPlaceContainedLiquid(player: EntityPlayer?, world: World, pos: BlockPos): Boolean{
if (super.tryPlaceContainedLiquid(player, world, pos)){
PacketClientFX(BlockEnderGooPurified.FX_PLACE, FxBlockData(pos)).sendToAllAround(world, pos, 16.0)

View File

@ -2,6 +2,7 @@ package chylex.hee.init
import chylex.hee.HEE
import chylex.hee.game.block.BlockAncientCobweb
import chylex.hee.game.block.BlockBrewingStandOverride
import chylex.hee.game.block.BlockCauldronWithGoo
import chylex.hee.game.block.BlockChorusPlantOverride
import chylex.hee.game.block.BlockCorruptedEnergy
import chylex.hee.game.block.BlockDarkChest
@ -213,6 +214,9 @@ object ModBlocks{
@JvmField val ENDER_GOO = BlockEnderGoo().apply { setup("ender_goo") }
@JvmField val PURIFIED_ENDER_GOO = BlockEnderGooPurified().apply { setup("purified_ender_goo") }
@JvmField val CAULDRON_ENDER_GOO = BlockCauldronWithGoo(ENDER_GOO).apply { setup("cauldron_ender_goo", inCreativeTab = false) }
@JvmField val CAULDRON_PURIFIED_ENDER_GOO = BlockCauldronWithGoo(PURIFIED_ENDER_GOO).apply { setup("cauldron_purified_ender_goo", inCreativeTab = false) }
// Blocks: Interactive (Storage)
@JvmField val JAR_O_DUST = BlockJarODust(buildJarODust).apply { setup("jar_o_dust") }
@ -360,6 +364,8 @@ object ModBlocks{
register(ENDER_GOO)
register(PURIFIED_ENDER_GOO)
register(CAULDRON_ENDER_GOO)
register(CAULDRON_PURIFIED_ENDER_GOO)
register(JAR_O_DUST with basicItemBlock)
register(DARK_CHEST with basicItemBlock)

View File

@ -2,6 +2,7 @@ package chylex.hee.init
import chylex.hee.HEE
import chylex.hee.game.item.ItemAmuletOfRecovery
import chylex.hee.game.item.ItemBindingEssence
import chylex.hee.game.item.ItemBucketWithCauldron
import chylex.hee.game.item.ItemChorusBerry
import chylex.hee.game.item.ItemCompost
import chylex.hee.game.item.ItemElytraOverride
@ -39,7 +40,6 @@ import chylex.hee.system.util.useVanillaName
import net.minecraft.creativetab.CreativeTabs
import net.minecraft.init.Items
import net.minecraft.item.Item
import net.minecraft.item.ItemBucket
import net.minecraftforge.event.RegistryEvent
import net.minecraftforge.fml.common.Mod.EventBusSubscriber
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
@ -96,7 +96,7 @@ object ModItems{
// Items: Fluids
@JvmField val ENDER_GOO_BUCKET = ItemBucket(ModBlocks.ENDER_GOO).apply { setup("ender_goo_bucket"); containerItem = Items.BUCKET }
@JvmField val ENDER_GOO_BUCKET = ItemBucketWithCauldron(ModBlocks.ENDER_GOO, ModBlocks.CAULDRON_ENDER_GOO).apply { setup("ender_goo_bucket"); containerItem = Items.BUCKET }
@JvmField val PURIFIED_ENDER_GOO_BUCKET = ItemPurifiedEnderGooBucket().apply { setup("purified_ender_goo_bucket"); containerItem = Items.BUCKET }
// Items: Energy

View File

@ -0,0 +1,15 @@
{
"forge_marker": 1,
"defaults": {
"smooth_lighting": false,
"textures": {
"water": "hee:block/ender_goo_still"
}
},
"variants": {
"level=0": { "model": "cauldron_empty" },
"level=1": { "model": "cauldron_level1" },
"level=2": { "model": "cauldron_level2" },
"level=3": { "model": "cauldron_level3" }
}
}

View File

@ -0,0 +1,15 @@
{
"forge_marker": 1,
"defaults": {
"smooth_lighting": false,
"textures": {
"water": "hee:block/purified_ender_goo_still"
}
},
"variants": {
"level=0": { "model": "cauldron_empty" },
"level=1": { "model": "cauldron_level1" },
"level=2": { "model": "cauldron_level2" },
"level=3": { "model": "cauldron_level3" }
}
}