Skip to content

Commit

Permalink
Early Access Version
Browse files Browse the repository at this point in the history
  • Loading branch information
Takakura-Anri committed Mar 23, 2020
1 parent 517c053 commit ff3ba70
Show file tree
Hide file tree
Showing 131 changed files with 625 additions and 106 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Add more foods to your Minecraft!

You can read [a brief propuse of this Mod here](/docs/PURPOSE.md)

> 一个过时的项目,一个过气的老玩家,一个永远无法完成的坑
> 一个过时的项目,一个过气的老玩家,一个~~永远无法~~**当然可以**完成的坑
>
> 拿出一些时间看看吧,看看你身边的人,看看那些曾陪你欢笑,与你分享,与你争吵,一起聊天的人。
>
Expand Down
20 changes: 20 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# 食物工艺 文档

[~~_没有人会喜欢的 Purpose_~~](PURPOSE.md)

食物工艺增加了很多中外菜品, 以及他们 _略微科学_ 的制作方法. 从分类来看, 本 Mod 添加了水果, 蔬菜, 调味料, 各种饮料, 小吃与大餐.

## 主要内容

- [播种与收获](Planting.md)
- [热量系统](Heating.md)

## 旧版食物工艺与新版食物工艺的异同

同: 材质, 机制, 基础设定

异:

- 跨 Mod 兼容性新版更好, 兼容了了基本所有的矿物辞典(基于**潘马斯农场**), 增加了大量 JEI 支持, Patchouli 手册以及 TOP 支持.
- 可配置的机器, JSON 合成
- 旧版一些未实现的内容(如酸奶,蛋糕)正在考虑以一种全新的方法添加回来.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ org.gradle.jvmargs=-Xmx3G

# FoodCraft Reloaded Mod Properties
mod_id = foodcraftreloaded
mod_version = 1.0.0-SNAPSHOT
mod_version = 1.0.0-EA
mod_group = com.projecturanus.foodcraft

# Minecraft & Forge
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ object FoodCraftReloaded {
RegisterHandler.mirrorOres("listAlloil", "foodOliveoil")
}

RegisterHandler.mirrorOres("circuitIngredient", "cropRice")
RegisterHandler.mirrorOres("circuitIngredient", "cropWheat")
RegisterHandler.mirrorOres("circuitIngredient", "cropSoybean")
RegisterHandler.mirrorOres("circuitIngredient", "cropPeanut")

if (!Loader.isModLoaded("commoncapabilities")) {
DefaultCapabilities.registerDefaultCapabilities()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class WidgetCookBar(val x: Int, val y: Int, val progress: KProperty0.Getter<Doub
val l: Int = (progress.invoke() * WIDTH).toInt()
this.drawTexturedModalRect(x, y, this.x, this.y, l, HEIGHT)
if (isMouseIn(x, y, mouseX, mouseY) && l >= 0 && FcConfig.clientConfig.enableHoverInfo) {
this.drawHoveringText(listOf("Overcooked progress: ${progress.invoke()}"), x, y, fontRenderer)
this.drawHoveringText(listOf(String.format("Overcooked progress: %.2f%%", progress.invoke() * 100.0)), x, y, fontRenderer)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,27 @@ import com.projecturanus.foodcraft.FoodCraftReloaded
import com.projecturanus.foodcraft.common.CHOPPING_BOARD
import com.projecturanus.foodcraft.common.block.entity.TileEntityChoppingBoard
import net.minecraft.block.state.IBlockState
import net.minecraft.entity.Entity
import net.minecraft.entity.player.EntityPlayer
import net.minecraft.tileentity.TileEntity
import net.minecraft.util.EnumFacing
import net.minecraft.util.EnumHand
import net.minecraft.util.math.AxisAlignedBB
import net.minecraft.util.math.BlockPos
import net.minecraft.world.IBlockAccess
import net.minecraft.world.World

class BlockChoppingBoard : BlockMachine() {
val collisionBox = AxisAlignedBB(0.0, 0.0, 2.5, 16.0, 0.8, 13.5)

override fun getCollisionBoundingBox(blockState: IBlockState, worldIn: IBlockAccess, pos: BlockPos): AxisAlignedBB? {
return collisionBox
}

override fun addCollisionBoxToList(state: IBlockState, worldIn: World, pos: BlockPos, entityBox: AxisAlignedBB, collidingBoxes: MutableList<AxisAlignedBB>, entityIn: Entity?, isActualState: Boolean) {
collidingBoxes += collisionBox
}

override fun createNewTileEntity(worldIn: World, meta: Int): TileEntity = TileEntityChoppingBoard()

override fun onBlockActivated(worldIn: World, pos: BlockPos, state: IBlockState, playerIn: EntityPlayer, hand: EnumHand, facing: EnumFacing, hitX: Float, hitY: Float, hitZ: Float): Boolean {
Expand Down
13 changes: 13 additions & 0 deletions src/main/java/com/projecturanus/foodcraft/common/block/BlockPan.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,27 @@ import com.projecturanus.foodcraft.FoodCraftReloaded
import com.projecturanus.foodcraft.common.PAN
import com.projecturanus.foodcraft.common.block.entity.TileEntityPan
import net.minecraft.block.state.IBlockState
import net.minecraft.entity.Entity
import net.minecraft.entity.player.EntityPlayer
import net.minecraft.tileentity.TileEntity
import net.minecraft.util.EnumFacing
import net.minecraft.util.EnumHand
import net.minecraft.util.math.AxisAlignedBB
import net.minecraft.util.math.BlockPos
import net.minecraft.world.IBlockAccess
import net.minecraft.world.World

class BlockPan : BlockMachine() {
val collisionBox = AxisAlignedBB(3.0, 1.0, 2.5, 13.0, 0.8, 13.5)

override fun getCollisionBoundingBox(blockState: IBlockState, worldIn: IBlockAccess, pos: BlockPos): AxisAlignedBB? {
return collisionBox
}

override fun addCollisionBoxToList(state: IBlockState, worldIn: World, pos: BlockPos, entityBox: AxisAlignedBB, collidingBoxes: MutableList<AxisAlignedBB>, entityIn: Entity?, isActualState: Boolean) {
collidingBoxes += collisionBox
}

override fun createNewTileEntity(worldIn: World, meta: Int): TileEntity = TileEntityPan()

override fun setDefaultTemperature(worldIn: World, pos: BlockPos, temperature: Double) {
Expand Down
13 changes: 13 additions & 0 deletions src/main/java/com/projecturanus/foodcraft/common/block/BlockPot.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,27 @@ import com.projecturanus.foodcraft.FoodCraftReloaded
import com.projecturanus.foodcraft.common.POT
import com.projecturanus.foodcraft.common.block.entity.TileEntityPot
import net.minecraft.block.state.IBlockState
import net.minecraft.entity.Entity
import net.minecraft.entity.player.EntityPlayer
import net.minecraft.tileentity.TileEntity
import net.minecraft.util.EnumFacing
import net.minecraft.util.EnumHand
import net.minecraft.util.math.AxisAlignedBB
import net.minecraft.util.math.BlockPos
import net.minecraft.world.IBlockAccess
import net.minecraft.world.World

class BlockPot : BlockMachine() {
val collisionBox = AxisAlignedBB(0.0, 0.0, 2.5, 16.0, 0.8, 13.5)

override fun getCollisionBoundingBox(blockState: IBlockState, worldIn: IBlockAccess, pos: BlockPos): AxisAlignedBB? {
return collisionBox
}

override fun addCollisionBoxToList(state: IBlockState, worldIn: World, pos: BlockPos, entityBox: AxisAlignedBB, collidingBoxes: MutableList<AxisAlignedBB>, entityIn: Entity?, isActualState: Boolean) {
collidingBoxes += collisionBox
}

override fun createNewTileEntity(worldIn: World, meta: Int): TileEntity = TileEntityPot()

override fun setDefaultTemperature(worldIn: World, pos: BlockPos, temperature: Double) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,27 @@ import com.projecturanus.foodcraft.FoodCraftReloaded
import com.projecturanus.foodcraft.common.PRESSURE_COOKER
import com.projecturanus.foodcraft.common.block.entity.TileEntityPressureCooker
import net.minecraft.block.state.IBlockState
import net.minecraft.entity.Entity
import net.minecraft.entity.player.EntityPlayer
import net.minecraft.tileentity.TileEntity
import net.minecraft.util.EnumFacing
import net.minecraft.util.EnumHand
import net.minecraft.util.math.AxisAlignedBB
import net.minecraft.util.math.BlockPos
import net.minecraft.world.IBlockAccess
import net.minecraft.world.World

class BlockPressureCooker : BlockMachine() {
val collisionBox = AxisAlignedBB(0.0, 0.0, 2.5, 16.0, 0.8, 13.5)

override fun getCollisionBoundingBox(blockState: IBlockState, worldIn: IBlockAccess, pos: BlockPos): AxisAlignedBB? {
return collisionBox
}

override fun addCollisionBoxToList(state: IBlockState, worldIn: World, pos: BlockPos, entityBox: AxisAlignedBB, collidingBoxes: MutableList<AxisAlignedBB>, entityIn: Entity?, isActualState: Boolean) {
collidingBoxes += collisionBox
}

override fun createNewTileEntity(worldIn: World, meta: Int): TileEntity = TileEntityPressureCooker()

override fun setDefaultTemperature(worldIn: World, pos: BlockPos, temperature: Double) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,21 @@ package com.projecturanus.foodcraft.common.block
import com.projecturanus.foodcraft.FoodCraftReloaded
import com.projecturanus.foodcraft.common.STOVE
import com.projecturanus.foodcraft.common.block.entity.TileEntityStove
import net.minecraft.block.BlockFurnace
import net.minecraft.block.state.IBlockState
import net.minecraft.entity.player.EntityPlayer
import net.minecraft.init.SoundEvents
import net.minecraft.tileentity.TileEntity
import net.minecraft.tileentity.TileEntityFurnace
import net.minecraft.util.EnumFacing
import net.minecraft.util.EnumHand
import net.minecraft.util.EnumParticleTypes
import net.minecraft.util.SoundCategory
import net.minecraft.util.math.BlockPos
import net.minecraft.world.World
import net.minecraftforge.fml.relauncher.Side
import net.minecraftforge.fml.relauncher.SideOnly
import java.util.*

class BlockStove : BlockMachine() {
override fun createNewTileEntity(worldIn: World, meta: Int): TileEntity = TileEntityStove()
Expand All @@ -29,4 +36,41 @@ class BlockStove : BlockMachine() {
}
return true
}

/**
* Called periodically clientside on blocks near the player to show effects (like furnace fire particles). Note that
* this method is unrelated to [randomTick] and [.needsRandomTick], and will always be called regardless
* of whether the block can receive random update ticks
* @see BlockFurnace
*/
@SideOnly(Side.CLIENT)
override fun randomDisplayTick(stateIn: IBlockState, worldIn: World, pos: BlockPos, rand: Random) {
val enumfacing = stateIn.getValue(BlockFurnace.FACING) as EnumFacing
val d0 = pos.x.toDouble() + 0.5
val d1 = pos.y.toDouble() + rand.nextDouble() * 6.0 / 16.0
val d2 = pos.z.toDouble() + 0.5
val d3 = 0.52
val d4 = rand.nextDouble() * 0.6 - 0.3
if (rand.nextDouble() < 0.1) {
worldIn.playSound(pos.x.toDouble() + 0.5, pos.y.toDouble(), pos.z.toDouble() + 0.5, SoundEvents.BLOCK_FURNACE_FIRE_CRACKLE, SoundCategory.BLOCKS, 1.0f, 1.0f, false)
}
when (enumfacing) {
EnumFacing.WEST -> {
worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0 - 0.52, d1, d2 + d4, 0.0, 0.0, 0.0)
worldIn.spawnParticle(EnumParticleTypes.FLAME, d0 - 0.52, d1, d2 + d4, 0.0, 0.0, 0.0)
}
EnumFacing.EAST -> {
worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0 + 0.52, d1, d2 + d4, 0.0, 0.0, 0.0)
worldIn.spawnParticle(EnumParticleTypes.FLAME, d0 + 0.52, d1, d2 + d4, 0.0, 0.0, 0.0)
}
EnumFacing.NORTH -> {
worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0 + d4, d1, d2 - 0.52, 0.0, 0.0, 0.0)
worldIn.spawnParticle(EnumParticleTypes.FLAME, d0 + d4, d1, d2 - 0.52, 0.0, 0.0, 0.0)
}
EnumFacing.SOUTH -> {
worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0 + d4, d1, d2 + 0.52, 0.0, 0.0, 0.0)
worldIn.spawnParticle(EnumParticleTypes.FLAME, d0 + d4, d1, d2 + 0.52, 0.0, 0.0, 0.0)
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,18 @@ import net.minecraft.item.ItemStack
import net.minecraft.util.math.BlockPos
import net.minecraft.world.World
import net.minecraftforge.common.ForgeHooks
import net.minecraftforge.fml.common.registry.ForgeRegistries
import java.util.*

class BlockSugarLike : BlockReed() {
val item by lazy { ForgeRegistries.ITEMS.getValue(this.registryName)!! }

override fun getItem(worldIn: World, pos: BlockPos, state: IBlockState): ItemStack {
return ItemStack(this)
return ItemStack(item)
}

override fun getItemDropped(state: IBlockState?, rand: Random?, fortune: Int): Item? {
return Item.getItemFromBlock(this)
return item
}

override fun updateTick(worldIn: World, pos: BlockPos, state: IBlockState, rand: Random) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,27 @@
package com.projecturanus.foodcraft.common.config;

import com.projecturanus.foodcraft.FoodCraftReloadedKt;
import com.projecturanus.foodcraft.worldgen.FruitTreeWorldGen;
import net.minecraftforge.common.config.Config;
import net.minecraftforge.common.config.ConfigManager;
import net.minecraftforge.fml.client.event.ConfigChangedEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

@Config(modid = FoodCraftReloadedKt.MODID)
@Mod.EventBusSubscriber(modid = FoodCraftReloadedKt.MODID, value = Side.CLIENT)
public class FcConfig {
@Config.Name("Fruit Tree Generate Chance")
@Config.Comment({"Generate chance for fruit tree, default to 0.07(7%)", "This will replace vanilla tree generation by event"})
@Config.Comment({"Generate chance for fruit tree, default to 0.08 (lower to be more rare)", "This will replace vanilla tree generation by event"})
@Config.RangeDouble(min = 0.0, max = 1.0)
@Config.SlidingOption
public static double fruitTreeChance = 0.07;
public static double fruitTreeChance = 0.08;

@Config.Name("Fruit Tree Biomes Whitelist")
@Config.Comment("Use ; to split, requires full ResourceLocation name")
public static String fruitTreeBiomes = "minecraft:jungle;minecraft:forest;minecraft:forest_hills;minecraft:birch_forest;minecraft:birch_forest_hills;minecraft:mutated_jungle;minecraft:mutated_jungle_edge";

@Config.Name("Machine Settings")
public static MachineConfig machineConfig = new MachineConfig();
Expand Down Expand Up @@ -119,9 +125,11 @@ public static class ClientConfig {
}

@SideOnly(Side.CLIENT)
@SubscribeEvent
public static void onReloadConfig(ConfigChangedEvent event) {
if (event.getModID().equals(FoodCraftReloadedKt.MODID)) {
ConfigManager.sync(FoodCraftReloadedKt.MODID, Config.Type.INSTANCE);
FruitTreeWorldGen.INSTANCE.setBiomeIds(fruitTreeBiomes);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ class FuelHeatHandler : HeatHandler, FuelHandler, INBTSerializable<NBTTagCompoun
Item.getItemFromBlock(Blocks.ICE) to 400,
Item.getItemFromBlock(Blocks.FROSTED_ICE) to 800,
Item.getItemFromBlock(Blocks.PACKED_ICE) to 900,
Items.SNOWBALL to 100
Items.SNOWBALL to 100,
Item.getItemFromBlock(Blocks.SNOW) to 400
)
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.projecturanus.foodcraft.common.init

import com.projecturanus.foodcraft.MODID
import net.minecraft.util.ResourceLocation
import net.minecraftforge.event.LootTableLoadEvent
import net.minecraftforge.fml.common.Mod
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent

@Mod.EventBusSubscriber(modid = MODID)
object LootTableInjectionHandler {
@JvmStatic
@SubscribeEvent
fun injectSnacks(event: LootTableLoadEvent) {
if (event.name.namespace == "minecraft" && (event.name.path.startsWith("chests")))
event.table.addPool(event.lootTableManager.getLootTableFromLocation(ResourceLocation(MODID, "snacks")).getPool("snacks_pool"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ object RegisterHandler {
translationKey = "$MODID.$it"
CROPS += this@crop
blockCrop.cropItem = this
MinecraftForge.addGrassSeed(ItemStack(this), 2)
} to arrayOf("crop$capitalized", "food$capitalized", "seed$capitalized", "listAllveggie")
}
plantFruits.forEach {
Expand All @@ -154,7 +153,6 @@ object RegisterHandler {
translationKey = "$MODID.$it"
CROPS += this@crop
blockCrop.cropItem = this
MinecraftForge.addGrassSeed(ItemStack(this), 2)
} to arrayOf("crop$capitalized", "food$capitalized", "seed$capitalized", "listAllfruit")
}
saplingFruits.forEach {
Expand Down Expand Up @@ -390,6 +388,7 @@ object RegisterHandler {
item("pixian_watercress")
item("starches")
item("zongye")
item("curry", "foodCurry")
item("sticky_rice_flour", "foodFloursticky", "foodFlour")
item("sticky_rice_dough", "foodDough", "foodStickyricedough")
item("peanut_tangyuan_stuffing", "listAlltangyuanstuffing")
Expand Down Expand Up @@ -622,6 +621,6 @@ object RegisterHandler {

fun registerSeeds() {
// TODO 1.13+ Loot Tables
CROPS.forEach { MinecraftForge.addGrassSeed(ItemStack(it), 4) }
CROPS.forEach { MinecraftForge.addGrassSeed(ItemStack(it), 3) }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ package com.projecturanus.foodcraft.common.item

import net.minecraft.advancements.CriteriaTriggers
import net.minecraft.block.Block
import net.minecraft.block.BlockSnow
import net.minecraft.block.state.IBlockState
import net.minecraft.entity.player.EntityPlayer
import net.minecraft.entity.player.EntityPlayerMP
import net.minecraft.init.Blocks
import net.minecraft.item.ItemBlock
import net.minecraft.util.EnumActionResult
import net.minecraft.util.EnumFacing
Expand All @@ -24,9 +26,19 @@ class ItemSugarLike(val block: Block) : FCRItemFood(), IPlantable {
/**
* Called when a Block is right-clicked with this Item
*/
override fun onItemUse(player: EntityPlayer, worldIn: World, pos: BlockPos, hand: EnumHand?, facing: EnumFacing?, hitX: Float, hitY: Float, hitZ: Float): EnumActionResult? {
override fun onItemUse(player: EntityPlayer, worldIn: World, pos: BlockPos, hand: EnumHand, facing: EnumFacing, hitX: Float, hitY: Float, hitZ: Float): EnumActionResult? {
val iblockstate = worldIn.getBlockState(pos)
val itemstack = player.getHeldItem(hand)

var facing = facing
var pos = pos

if (iblockstate.block === Blocks.SNOW_LAYER && (iblockstate.getValue(BlockSnow.LAYERS) as Int).toInt() < 1) {
facing = EnumFacing.UP
} else if (!iblockstate.block.isReplaceable(worldIn, pos)) {
pos = pos.offset(facing)
}

return if (!itemstack.isEmpty && player.canPlayerEdit(pos, facing, itemstack) && worldIn.mayPlace(block, pos, false, facing, player)) {
var state = block.getStateForPlacement(worldIn, pos, facing, hitX, hitY, hitZ, 0, player, hand)
if (!worldIn.setBlockState(pos, state, 11)) {
Expand Down
Loading

0 comments on commit ff3ba70

Please sign in to comment.