-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
新内容 1. 添加熔炉防火设备(WIP) 2. 添加火灾检测器 3. 添加3种不同的灭火器 4. 添加抑燃炸弹 5. 添加喷淋头 调整内容 1. 调整灭火器物品贴图和其他属性 2. 修复爆燃粒子效果 3. 十万火急不再能与冰霜行者共存 4. 调整灭火合成
- Loading branch information
Showing
35 changed files
with
1,163 additions
and
111 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
package restricted.fpe | ||
|
||
import net.minecraft.core.Direction | ||
import net.minecraft.world.damagesource.DamageSource | ||
import net.minecraft.world.item.* | ||
import net.minecraft.world.item.enchantment.EnchantmentCategory | ||
import net.minecraft.world.level.block.SoundType | ||
import net.minecraft.world.level.block.state.BlockBehaviour | ||
import net.minecraft.world.level.block.state.properties.EnumProperty | ||
import net.minecraft.world.level.material.Material | ||
|
||
private typealias ItemProperties = Item.Properties | ||
private typealias BlockProperties = BlockBehaviour.Properties | ||
|
||
object FPEConst { | ||
|
||
object BlockConst { | ||
|
||
// BlockBehavior.Properties | ||
|
||
val FireHydrantProp: BlockProperties = | ||
BlockProperties.of(Material.HEAVY_METAL).strength(5.0F, 1200.0F).sound(SoundType.ANVIL).noOcclusion() | ||
|
||
val FireExtinguishingBombProp: BlockProperties = | ||
BlockProperties.of(Material.EXPLOSIVE).instabreak().sound(SoundType.GRASS) | ||
|
||
val FireDetectorProp: BlockProperties = | ||
BlockProperties.of(Material.WOOL).strength(0.8F).sound(SoundType.WOOL).noOcclusion().lightLevel { 3 } | ||
|
||
val FireSprinklerProp: BlockProperties = | ||
BlockProperties.of(Material.WOOL).strength(0.8F).sound(SoundType.WOOL).noOcclusion().lightLevel { 3 } | ||
|
||
// Property for BlockState | ||
|
||
val VERTICAL_FACING: EnumProperty<Direction> = | ||
EnumProperty.create("facing", Direction::class.java, Direction.UP, Direction.DOWN) | ||
|
||
} | ||
|
||
object ItemConst { | ||
|
||
// Item.Properties | ||
|
||
val DefaultItemProp: ItemProperties = | ||
Item.Properties().tab(FPE.Tabs.Default) | ||
|
||
val DefaultNonStackableItemProp: ItemProperties = | ||
Item.Properties().stacksTo(1).tab(FPE.Tabs.Default) | ||
|
||
val FireExtinguisherProp: ItemProperties = | ||
Item.Properties().rarity(Rarity.UNCOMMON).tab(FPE.Tabs.Default).stacksTo(1).durability(15000) | ||
} | ||
|
||
object DamageSourceConst { | ||
|
||
val SpreadingFire = DamageSource("spreading_fire") | ||
|
||
val Extinguish = DamageSource("extinguish") | ||
} | ||
|
||
object EnchantCategory { | ||
val BowAndCrossbowCategory: EnchantmentCategory = EnchantmentCategory.create("bow_and_crossbow") { it is BowItem || it is CrossbowItem } | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
package restricted.fpe.block | ||
|
||
import net.minecraft.core.BlockPos | ||
import net.minecraft.core.Direction | ||
import net.minecraft.tags.BlockTags | ||
import net.minecraft.world.item.context.BlockPlaceContext | ||
import net.minecraft.world.level.BlockGetter | ||
import net.minecraft.world.level.Level | ||
import net.minecraft.world.level.block.* | ||
import net.minecraft.world.level.block.entity.* | ||
import net.minecraft.world.level.block.state.BlockState | ||
import net.minecraft.world.level.block.state.StateDefinition | ||
import net.minecraft.world.phys.shapes.CollisionContext | ||
import net.minecraft.world.phys.shapes.VoxelShape | ||
import restricted.fpe.* | ||
import restricted.fpe.FPEConst.BlockConst.VERTICAL_FACING | ||
import restricted.fpe.block.entity.FireDetectorBlockEntity | ||
|
||
@Suppress("OVERRIDE_DEPRECATION") | ||
object FireDetectorBlock : BaseEntityBlock(FPEConst.BlockConst.FireDetectorProp) { | ||
|
||
private val bottomShape = box(5.0, 0.0, 5.0, 11.0, 2.0, 11.0) | ||
private val topShape = box(5.0, 14.0, 5.0, 11.0, 16.0, 11.0) | ||
|
||
init { | ||
registerDefaultState( | ||
this.stateDefinition.any().setValue(VERTICAL_FACING, Direction.UP) | ||
) | ||
} | ||
|
||
fun hasFireAround(level: Level, blockPos: BlockPos): Boolean { | ||
return level.getBlockStates(boundingBoxOfCenter(blockPos.below(2), 3).AABB).anyMatch { | ||
it.`is`(BlockTags.FIRE) | ||
} | ||
} | ||
|
||
override fun createBlockStateDefinition(pBuilder: StateDefinition.Builder<Block, BlockState>) { | ||
pBuilder.add(VERTICAL_FACING) | ||
} | ||
|
||
@Suppress("UNUSED_PARAMETER") | ||
fun onTick(level: Level, pos: BlockPos, state: BlockState, blockEntity: FireDetectorBlockEntity) { | ||
val hasFire = hasFireAround(level, pos) | ||
if(hasFire != blockEntity.fireDetected) { | ||
blockEntity.fireDetected = hasFire | ||
level.updateNeighborsAt(pos, this) | ||
} | ||
} | ||
|
||
override fun getRenderShape(pState: BlockState): RenderShape { | ||
return RenderShape.MODEL | ||
} | ||
|
||
override fun getStateForPlacement(pContext: BlockPlaceContext): BlockState? { | ||
val direction = if(pContext.clickedFace == Direction.UP) Direction.UP else Direction.DOWN | ||
return defaultBlockState().setValue(VERTICAL_FACING, direction) | ||
} | ||
|
||
override fun getShape( | ||
pState: BlockState, | ||
pLevel: BlockGetter, | ||
pPos: BlockPos, | ||
pContext: CollisionContext | ||
): VoxelShape { | ||
return if(pState.getValue(VERTICAL_FACING) == Direction.UP) { | ||
bottomShape | ||
} else { | ||
topShape | ||
} | ||
} | ||
|
||
override fun isSignalSource(state: BlockState): Boolean { | ||
return true | ||
} | ||
|
||
override fun getSignal(state: BlockState, level: BlockGetter, pos: BlockPos, pDirection: Direction): Int { | ||
val blockEntity = level.getBlockEntity(pos, FPE.BlockEntityTypes.FireDetector) | ||
return if(blockEntity.isPresent && blockEntity.get().fireDetected) { | ||
15 | ||
} else { | ||
0 | ||
} | ||
} | ||
|
||
override fun newBlockEntity(pPos: BlockPos, pState: BlockState): BlockEntity { | ||
return FireDetectorBlockEntity(pPos, pState) | ||
} | ||
|
||
override fun <T : BlockEntity?> getTicker( | ||
pLevel: Level, | ||
pState: BlockState, | ||
pBlockEntityType: BlockEntityType<T> | ||
): BlockEntityTicker<T>? { | ||
return createTickerHelper(pBlockEntityType, FPE.BlockEntityTypes.FireDetector, ::onTick) | ||
} | ||
} |
Oops, something went wrong.