Skip to content
This repository has been archived by the owner on Nov 21, 2024. It is now read-only.

Commit

Permalink
Add the Combustion Generator
Browse files Browse the repository at this point in the history
You may now generate power using this mod!
Runtime tests now load with Mekanism for integration testing.
  • Loading branch information
MartinTheDragon committed Jul 10, 2021
1 parent 06556ee commit bfdd27a
Show file tree
Hide file tree
Showing 32 changed files with 798 additions and 20 deletions.
6 changes: 6 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,11 @@ dependencies {
compileOnly fg.deobf("mezz.jei:jei-1.16.5:${jei_version}:api")
// at runtime, use the full JEI jar
runtimeOnly fg.deobf("mezz.jei:jei-1.16.5:${jei_version}")

runtimeOnly fg.deobf("mekanism:Mekanism:${mekanism_version}")// core
runtimeOnly fg.deobf("mekanism:Mekanism:${mekanism_version}:additions")// Mekanism: Additions
runtimeOnly fg.deobf("mekanism:Mekanism:${mekanism_version}:generators")// Mekanism: Generators
runtimeOnly fg.deobf("mekanism:Mekanism:${mekanism_version}:tools")// Mekanism: Tools
}

jar {
Expand Down Expand Up @@ -199,6 +204,7 @@ repositories {
name = "ModMaven"
url = "https://modmaven.k-4u.nl"
}
maven { url 'https://modmaven.dev/' }
mavenCentral()
}

Expand Down
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ org.gradle.daemon=false
mod_version=0.0.6.0
kotlin_version=1.5.20
jei_version=7.7.0.106
mekanism_version=1.16.5-10.0.21.448
9 changes: 7 additions & 2 deletions src/generated/resources/.cache/cache
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ dadfe9e7d452bb73c62088710d4071802ec1a031 assets/nucleartech/blockstates/blast_fu
4fb1757b63756c781e346cb51ef7cd7653df5248 assets/nucleartech/blockstates/brightblende_ore.json
77b03a272a12b2f3e88d089e601fe975bbf21020 assets/nucleartech/blockstates/cobalt_block.json
b715a4d8ace5dbf7badbe915b849624a47758e37 assets/nucleartech/blockstates/combine_steel_block.json
d225a4a8998d12aea75ddb1d1ef2c97e0bfe9a20 assets/nucleartech/blockstates/combustion_generator.json
08c4bcc1fe0b09a9a81696de47050f2d3c33061f assets/nucleartech/blockstates/copper_block.json
d767ab27539b2ce8c3a91862c64355dd70e09b7b assets/nucleartech/blockstates/copper_ore.json
5a241c06f3fea148281c6836af86c8327e42081d assets/nucleartech/blockstates/daffergon_block.json
Expand Down Expand Up @@ -125,6 +126,8 @@ f60cfd8f55e6f16b672d06301352b552f6c16eb9 assets/nucleartech/models/block/blast_f
2fdd055ef29c7f1ea5a75a733e122a8a51fef866 assets/nucleartech/models/block/brightblende_ore.json
8c1e2177bc99889134f37296a01ddf2c9618e48b assets/nucleartech/models/block/cobalt_block.json
fbf9f374d563086e8de04da8ea4f75cfe6004f66 assets/nucleartech/models/block/combine_steel_block.json
0dd775a77724ef195c8508e8d8ab468de98c3b04 assets/nucleartech/models/block/combustion_generator.json
568cf4ec256962531d656ecfaadf3a967f480c0c assets/nucleartech/models/block/combustion_generator_on.json
416fcf1260cbee66b2b7780a153b4498bda92d5b assets/nucleartech/models/block/copper_block.json
3b965e36d653fec20b89b0b52b8f7f4095c90e4b assets/nucleartech/models/block/copper_ore.json
98a5e728d608beb8d6190036a5d945d769424145 assets/nucleartech/models/block/daffergon_block.json
Expand Down Expand Up @@ -299,6 +302,7 @@ dd86cbf1c647c503af6fe9f7138fee2286b857d0 assets/nucleartech/models/item/combine_
2832b85308f7e75cea95bec72a53b61a384000e8 assets/nucleartech/models/item/combine_steel_ingot.json
49ecd5304c477045bed290849d81837331f3a823 assets/nucleartech/models/item/combine_steel_plate.json
15743238ebca1d2d4e512c70c7e6456f60d50606 assets/nucleartech/models/item/combine_steel_powder.json
c7e9a690801d941729614115a60c9ae1d8ac05f8 assets/nucleartech/models/item/combustion_generator.json
e0bf8b0c95acdd0131c45f6062ef92aeb7e2659b assets/nucleartech/models/item/compressed_biomass.json
9db95baad5bca8302c67e82a78627e47e52eb99b assets/nucleartech/models/item/conspiracy_theory.json
6867524b00c6b74742de721e7180c2d43b627b9e assets/nucleartech/models/item/copper_block.json
Expand Down Expand Up @@ -1088,7 +1092,7 @@ c5020d0390c566f3e363969f62fc8957069bacf1 data/nucleartech/advancements/recipes/n
890ef9c11e657778970b26659583c61f11512257 data/nucleartech/advancements/recipes/nucleartech_parts/aluminium_ingot_from_powder.json
aae0df1400f01a653094417a70308b8a916cb9e9 data/nucleartech/advancements/recipes/nucleartech_parts/aluminium_plate_from_pressing_aluminium_ingot.json
8ac57e96eb3fb33d45e4e1b55a238715049c397e data/nucleartech/advancements/recipes/nucleartech_parts/aluminium_wire_from_pressing_aluminium_ingot.json
6da1f0057a1a807ee35d69751d9f803b9f06bac9 data/nucleartech/advancements/recipes/nucleartech_parts/asbestos_sheet_from_asbestos_block.json
4c52f73de99cbd02fa54471ff67970f93edd4732 data/nucleartech/advancements/recipes/nucleartech_parts/asbestos_sheet_from_asbestos_block.json
d6dbfae7bc8d3a7a51f2a9940202761ffa03dde4 data/nucleartech/advancements/recipes/nucleartech_parts/australium_ingot_from_australian_ore.json
ea4203674f4f70f072934672eb0846be645572e5 data/nucleartech/advancements/recipes/nucleartech_parts/australium_ingot_from_australium_block.json
9c2011089ef83c764eb257cd74c1916439e0c4b7 data/nucleartech/advancements/recipes/nucleartech_parts/australium_ingot_from_blasting_australian_ore.json
Expand Down Expand Up @@ -1316,6 +1320,7 @@ c03fc69a9459e3503320d11ba3cd2f020c427ea1 data/nucleartech/loot_tables/blocks/bla
ec0e0a9ed04ad41fe3d0f406af965ae2bdc87f6d data/nucleartech/loot_tables/blocks/brightblende_ore.json
dac458197fa0c32dbaa7ce7cb897c2e6c294120e data/nucleartech/loot_tables/blocks/cobalt_block.json
fd413757c54fb31632b7d0022f045fbe17181755 data/nucleartech/loot_tables/blocks/combine_steel_block.json
14124cc50197c5046ab30a11a4314ddd5d458a68 data/nucleartech/loot_tables/blocks/combustion_generator.json
0e3245410608b9e6c872380e458311b9de08a6f6 data/nucleartech/loot_tables/blocks/copper_block.json
2c05a4be7f6b60a017b2286db7f4ac76ab94a6aa data/nucleartech/loot_tables/blocks/copper_ore.json
0ac75811d39a7434f750db81f1a261809e74d218 data/nucleartech/loot_tables/blocks/daffergon_block.json
Expand Down Expand Up @@ -1425,7 +1430,7 @@ a14ec50ec522f51d939f3fea5e155cd4f77e62a8 data/nucleartech/recipes/aluminium_ingo
2fb2ba255580b5528a3529759918b150e86b8650 data/nucleartech/recipes/aluminium_ingot_from_powder.json
07fd2accbe302605bdc72fb9230401ef32925a1e data/nucleartech/recipes/aluminium_plate_from_pressing_aluminium_ingot.json
e0ea360da648edbc9507d50792d4968fad28088d data/nucleartech/recipes/aluminium_wire_from_pressing_aluminium_ingot.json
0d2ace1cf1b4a8cbcc65074f221eb82ca0940294 data/nucleartech/recipes/asbestos_sheet_from_asbestos_block.json
f0a935e3df68f3b4f2eadf4d83f49d93fa6a6144 data/nucleartech/recipes/asbestos_sheet_from_asbestos_block.json
d30674bedead53ed373f9a8d5824437ceff3c574 data/nucleartech/recipes/australium_block_from_australium_ingot.json
413b5d1181948aacec5a8f200c2046dcae45ddad data/nucleartech/recipes/australium_ingot_from_australian_ore.json
2d58fde67057378951d6b853386d641f65fad263 data/nucleartech/recipes/australium_ingot_from_australium_block.json
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"variants": {
"facing=north,lit=false": {
"model": "nucleartech:block/combustion_generator"
},
"facing=south,lit=false": {
"model": "nucleartech:block/combustion_generator",
"y": 180
},
"facing=west,lit=false": {
"model": "nucleartech:block/combustion_generator",
"y": 270
},
"facing=east,lit=false": {
"model": "nucleartech:block/combustion_generator",
"y": 90
},
"facing=north,lit=true": {
"model": "nucleartech:block/combustion_generator_on"
},
"facing=south,lit=true": {
"model": "nucleartech:block/combustion_generator_on",
"y": 180
},
"facing=west,lit=true": {
"model": "nucleartech:block/combustion_generator_on",
"y": 270
},
"facing=east,lit=true": {
"model": "nucleartech:block/combustion_generator_on",
"y": 90
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"parent": "minecraft:block/orientable",
"textures": {
"side": "nucleartech:block/combustion_generator_side",
"front": "nucleartech:block/combustion_generator_front",
"top": "nucleartech:block/combustion_generator_side"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"parent": "minecraft:block/orientable",
"textures": {
"side": "nucleartech:block/combustion_generator_side",
"front": "nucleartech:block/combustion_generator_front_on",
"top": "nucleartech:block/combustion_generator_side"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"parent": "nucleartech:block/combustion_generator"
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"conditions": {
"items": [
{
"item": "nucleartech:asbestos_block"
"tag": "forge:storage_blocks/asbestos"
}
]
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"type": "minecraft:block",
"pools": [
{
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "nucleartech:combustion_generator"
}
],
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
]
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"group": "asbestos_sheet",
"ingredients": [
{
"item": "nucleartech:asbestos_block"
"tag": "forge:storage_blocks/asbestos"
}
],
"result": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ object ClientRegistries {
ScreenManager.register(ContainerTypes.sirenContainer.get(), ::SirenScreen)
ScreenManager.register(ContainerTypes.pressContainer.get(), ::SteamPressScreen)
ScreenManager.register(ContainerTypes.blastFurnaceContainer.get(), ::BlastFurnaceScreen)
ScreenManager.register(ContainerTypes.combustionGeneratorContainer.get(), ::CombustionGeneratorScreen)
}

@SubscribeEvent @JvmStatic
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,4 +119,5 @@ object ModBlockItems {
val safe: RegistryObject<Item> = ITEMS.register("safe") { BlockItem(ModBlocks.safe.get(), Item.Properties().tab(CreativeTabs.Machines.itemGroup)) }
val steamPress: RegistryObject<Item> = ITEMS.register("steam_press") { BlockItem(ModBlocks.steamPressBase.get(), Item.Properties().tab(CreativeTabs.Machines.itemGroup)) }
val blastFurnace: RegistryObject<Item> = ITEMS.register("blast_furnace") { BlockItem(ModBlocks.blastFurnace.get(), Item.Properties().tab(CreativeTabs.Machines.itemGroup)) }
val combustionGenerator: RegistryObject<Item> = ITEMS.register("combustion_generator") { BlockItem(ModBlocks.combustionGenerator.get(), Item.Properties().tab(CreativeTabs.Machines.itemGroup)) }
}
Original file line number Diff line number Diff line change
Expand Up @@ -149,4 +149,5 @@ object ModBlocks {
// endregion

val blastFurnace: RegistryObject<BlastFurnace> = BLOCKS.register("blast_furnace") { BlastFurnace(Properties.of(METAL).strength(5F).harvestLevel(1).harvestTool(ToolType.PICKAXE).requiresCorrectToolForDrops().sound(SoundType.METAL)) }
val combustionGenerator: RegistryObject<CombustionGenerator> = BLOCKS.register("combustion_generator") { CombustionGenerator(Properties.of(METAL).strength(5F).harvestLevel(1).harvestTool(ToolType.PICKAXE).requiresCorrectToolForDrops().sound(SoundType.METAL)) }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
package at.martinthedragon.nucleartech.blocks

import at.martinthedragon.nucleartech.tileentities.CombustionGeneratorTileEntity
import net.minecraft.block.Block
import net.minecraft.block.BlockState
import net.minecraft.block.HorizontalBlock
import net.minecraft.block.material.PushReaction
import net.minecraft.entity.LivingEntity
import net.minecraft.entity.player.PlayerEntity
import net.minecraft.entity.player.ServerPlayerEntity
import net.minecraft.inventory.InventoryHelper
import net.minecraft.inventory.container.Container
import net.minecraft.item.BlockItemUseContext
import net.minecraft.item.ItemStack
import net.minecraft.particles.ParticleTypes
import net.minecraft.state.BooleanProperty
import net.minecraft.state.DirectionProperty
import net.minecraft.state.StateContainer
import net.minecraft.state.properties.BlockStateProperties
import net.minecraft.util.*
import net.minecraft.util.math.BlockPos
import net.minecraft.util.math.BlockRayTraceResult
import net.minecraft.world.IBlockReader
import net.minecraft.world.World
import net.minecraftforge.fluids.FluidUtil
import net.minecraftforge.fml.network.NetworkHooks
import java.util.*

class CombustionGenerator(properties: Properties) : Block(properties) {
init {
registerDefaultState(stateDefinition.any().setValue(LIT, false))
}

override fun getPistonPushReaction(state: BlockState) = PushReaction.BLOCK

override fun createBlockStateDefinition(builder: StateContainer.Builder<Block, BlockState>) {
builder.add(FACING, LIT)
}

override fun getStateForPlacement(context: BlockItemUseContext): BlockState =
defaultBlockState().setValue(FACING, context.horizontalDirection.opposite)

override fun setPlacedBy(world: World, pos: BlockPos, state: BlockState, entity: LivingEntity?, stack: ItemStack) {
if (stack.hasCustomHoverName()) {
val tileEntity = world.getBlockEntity(pos)
if (tileEntity is CombustionGeneratorTileEntity)
tileEntity.customName = stack.hoverName
}
}

override fun onRemove(
state: BlockState,
world: World,
pos: BlockPos,
newState: BlockState,
p_196243_5_: Boolean
) {
if (!state.`is`(newState.block)) {
val tileEntity = world.getBlockEntity(pos)
if (tileEntity is CombustionGeneratorTileEntity) InventoryHelper.dropContents(world, pos, tileEntity)
}
@Suppress("DEPRECATION")
super.onRemove(state, world, pos, newState, p_196243_5_)
}

override fun use(state: BlockState, world: World, pos: BlockPos, player: PlayerEntity, hand: Hand, hit: BlockRayTraceResult): ActionResultType {
if (!world.isClientSide) {
if (!FluidUtil.interactWithFluidHandler(player, hand, world, pos, hit.direction)) {
val tileEntity = world.getBlockEntity(pos)
if (tileEntity is CombustionGeneratorTileEntity) NetworkHooks.openGui(player as ServerPlayerEntity, tileEntity, pos)
}
}
return ActionResultType.sidedSuccess(world.isClientSide)
}

override fun animateTick(state: BlockState, world: World, pos: BlockPos, random: Random) {
if (state.getValue(LIT)) {
val posX = pos.x + 0.5
val posY = pos.y.toDouble()
val posZ = pos.z + 0.5
if (random.nextDouble() < 0.1) {
world.playLocalSound(
posX, posY, posZ,
SoundEvents.FURNACE_FIRE_CRACKLE,
SoundCategory.BLOCKS,
1.0f, 1.0f, false
)
}
val direction = state.getValue(FACING)
val axis = direction.axis
val d4 = random.nextDouble() * 0.6 - 0.3
val d5 = if (axis == Direction.Axis.X) direction.stepX.toDouble() * 0.52 else d4
val d6 = random.nextDouble() * 6.0 / 16.0
val d7 = if (axis == Direction.Axis.Z) direction.stepZ.toDouble() * 0.52 else d4
world.addParticle(ParticleTypes.SMOKE, posX + d5, posY + d6, posZ + d7, 0.0, 0.0, 0.0)
world.addParticle(ParticleTypes.FLAME, posX + d5, posY + d6, posZ + d7, 0.0, 0.0, 0.0)
}
}

override fun hasAnalogOutputSignal(state: BlockState) = true

override fun getAnalogOutputSignal(state: BlockState, world: World, pos: BlockPos) =
Container.getRedstoneSignalFromBlockEntity(world.getBlockEntity(pos))

override fun getLightValue(state: BlockState, world: IBlockReader, pos: BlockPos) =
if (state.getValue(LIT)) 13 else 0

override fun rotate(state: BlockState, direction: Rotation): BlockState =
state.setValue(FACING, direction.rotate(state.getValue(FACING)))

@Suppress("DEPRECATION")
override fun mirror(state: BlockState, mirror: Mirror): BlockState =
state.rotate(mirror.getRotation(state.getValue(FACING)))

override fun hasTileEntity(state: BlockState?) = true

override fun createTileEntity(state: BlockState?, world: IBlockReader?) = CombustionGeneratorTileEntity()

companion object {
val FACING: DirectionProperty = HorizontalBlock.FACING
val LIT: BooleanProperty = BlockStateProperties.LIT
}
}
Loading

0 comments on commit bfdd27a

Please sign in to comment.