new heater fuel and fueling system

This commit is contained in:
LordGrimmauld 2020-07-14 15:54:02 +02:00
parent 7404972cf6
commit 0580318b38
18 changed files with 104 additions and 45 deletions

View file

@ -338,17 +338,17 @@ c60c3115fd6eeaa3a696428a87a74d184ab7d62d assets/create/blockstates/weathered_lim
c77b46d8b459e5c7cc495393546f3fcca8a1fa1d assets/create/blockstates/weathered_limestone_pillar.json c77b46d8b459e5c7cc495393546f3fcca8a1fa1d assets/create/blockstates/weathered_limestone_pillar.json
7f39521b211441f5c3e06d60c5978cebe16cacfb assets/create/blockstates/zinc_block.json 7f39521b211441f5c3e06d60c5978cebe16cacfb assets/create/blockstates/zinc_block.json
b7181bcd8182b2f17088e5aa881f374c9c65470c assets/create/blockstates/zinc_ore.json b7181bcd8182b2f17088e5aa881f374c9c65470c assets/create/blockstates/zinc_ore.json
00edba8c69557058bf9fbbc4d389dc455f24b0fc assets/create/lang/en_ud.json 31c4433a60168ccd2cfcb0e6f7e495684d0d160e assets/create/lang/en_ud.json
d145a27694c4c6b257f35a8fb254991cbd1fe10d assets/create/lang/en_us.json f6b3c31a6c3313e089e657c02832a201518d0dbe assets/create/lang/en_us.json
7fb20de7ceb40ecde8a75f079af71b5b219140a6 assets/create/lang/unfinished/de_de.json 0cf3147b81b1d2103e79b3018c543faba63769a1 assets/create/lang/unfinished/de_de.json
0f451eea12911e4510ee1ef7a9d805c6fc2c8ae2 assets/create/lang/unfinished/fr_fr.json d72b420a82e296afab9807d0183d9e8b6f8544ea assets/create/lang/unfinished/fr_fr.json
3c423bdc944433eb2cf4e53d8259ef5c848b5787 assets/create/lang/unfinished/it_it.json 30472e049ef4d0fb92c67a2d16aa86f0face99cc assets/create/lang/unfinished/it_it.json
21edea7b23948e7438b6e77c2d074a908ac5d821 assets/create/lang/unfinished/ja_jp.json 20db786d3ec10bc5e2f097ae31dab75c54a6ab24 assets/create/lang/unfinished/ja_jp.json
88c9add37b8b7cb6ca6fb95efa3ec58dbe1adc34 assets/create/lang/unfinished/ko_kr.json ef5dd51b525fbb21b9d9fe6ab9962f619d74aafb assets/create/lang/unfinished/ko_kr.json
e5587d2e9fe77a07b3309a9d78679db10aa04458 assets/create/lang/unfinished/nl_nl.json f45247c1a75e90a91e798c3869dd633c7476a296 assets/create/lang/unfinished/nl_nl.json
2882dc769c7d4d21eae1c7c8064a0e4a5a8e11b0 assets/create/lang/unfinished/pt_br.json 6bf5fd3af396fdb0471c9f5f91d50c98c14eb04d assets/create/lang/unfinished/pt_br.json
81dd7190bb2e5a796d194b1b8a8eba5c0563c3f3 assets/create/lang/unfinished/ru_ru.json 1ce817630aefef48c73180965ea8ceb9c91be503 assets/create/lang/unfinished/ru_ru.json
b58bf143eef4c6b76debfff2af290bc65a5db324 assets/create/lang/unfinished/zh_cn.json 1a8e7e8937270e74726d0d436aacf4fb7cae6b12 assets/create/lang/unfinished/zh_cn.json
846200eb548d3bfa2e77b41039de159b4b6cfb45 assets/create/models/block/acacia_window.json 846200eb548d3bfa2e77b41039de159b4b6cfb45 assets/create/models/block/acacia_window.json
1930fa3a3c98d53dd19e4ee7f55bc27fd47aa281 assets/create/models/block/acacia_window_pane_noside.json 1930fa3a3c98d53dd19e4ee7f55bc27fd47aa281 assets/create/models/block/acacia_window_pane_noside.json
1763ea2c9b981d187f5031ba608f3d5d3be3986a assets/create/models/block/acacia_window_pane_noside_alt.json 1763ea2c9b981d187f5031ba608f3d5d3be3986a assets/create/models/block/acacia_window_pane_noside_alt.json
@ -1118,6 +1118,7 @@ e5e6fb6eb182b85b977e1025a7fe84d46de59320 assets/create/models/item/fluid_pipe.js
8707332c0cb6ee123e7962d08536a60725c64ce8 assets/create/models/item/flywheel.json 8707332c0cb6ee123e7962d08536a60725c64ce8 assets/create/models/item/flywheel.json
d62b93d3c274d280f3eec22a28b5175943411d25 assets/create/models/item/framed_glass.json d62b93d3c274d280f3eec22a28b5175943411d25 assets/create/models/item/framed_glass.json
1041d462c6e856f7f3f2365c299c0599703d1ed7 assets/create/models/item/framed_glass_pane.json 1041d462c6e856f7f3f2365c299c0599703d1ed7 assets/create/models/item/framed_glass_pane.json
2465cc82ca324ecc146faf97177cea3d3073fc7f assets/create/models/item/fuel_pellet.json
0bee2855dc9bad52e941153b87e9c35797c246ee assets/create/models/item/furnace_engine.json 0bee2855dc9bad52e941153b87e9c35797c246ee assets/create/models/item/furnace_engine.json
090edb6a728fc3803e870d647c7c4e826faadca0 assets/create/models/item/furnace_minecart_contraption.json 090edb6a728fc3803e870d647c7c4e826faadca0 assets/create/models/item/furnace_minecart_contraption.json
2c1608c114ccc285a84e936dc3f1233c535e1a26 assets/create/models/item/gabbro.json 2c1608c114ccc285a84e936dc3f1233c535e1a26 assets/create/models/item/gabbro.json

View file

@ -365,6 +365,7 @@
"item.create.empty_schematic": "\u0254\u0131\u0287\u0250\u026F\u01DD\u0265\u0254S \u028E\u0287d\u026F\u018E", "item.create.empty_schematic": "\u0254\u0131\u0287\u0250\u026F\u01DD\u0265\u0254S \u028E\u0287d\u026F\u018E",
"item.create.extendo_grip": "d\u0131\u0279\u2141 opu\u01DD\u0287x\u018E", "item.create.extendo_grip": "d\u0131\u0279\u2141 opu\u01DD\u0287x\u018E",
"item.create.filter": "\u0279\u01DD\u0287\u05DF\u0131\u2132", "item.create.filter": "\u0279\u01DD\u0287\u05DF\u0131\u2132",
"item.create.fuel_pellet": "\u0287\u01DD\u05DF\u05DF\u01DD\u0500 \u05DF\u01DDn\u2132",
"item.create.furnace_minecart_contraption": "uo\u0131\u0287d\u0250\u0279\u0287uo\u0186 \u0287\u0279\u0250\u0254\u01DDu\u0131W \u01DD\u0254\u0250u\u0279n\u2132", "item.create.furnace_minecart_contraption": "uo\u0131\u0287d\u0250\u0279\u0287uo\u0186 \u0287\u0279\u0250\u0254\u01DDu\u0131W \u01DD\u0254\u0250u\u0279n\u2132",
"item.create.goggles": "s\u01DD\u05DFbbo\u2141 s,\u0279\u01DD\u01DDu\u0131bu\u018E", "item.create.goggles": "s\u01DD\u05DFbbo\u2141 s,\u0279\u01DD\u01DDu\u0131bu\u018E",
"item.create.golden_sheet": "\u0287\u01DD\u01DD\u0265S u\u01DDp\u05DFo\u2141", "item.create.golden_sheet": "\u0287\u01DD\u01DD\u0265S u\u01DDp\u05DFo\u2141",

View file

@ -370,6 +370,7 @@
"item.create.empty_schematic": "Empty Schematic", "item.create.empty_schematic": "Empty Schematic",
"item.create.extendo_grip": "Extendo Grip", "item.create.extendo_grip": "Extendo Grip",
"item.create.filter": "Filter", "item.create.filter": "Filter",
"item.create.fuel_pellet": "Fuel Pellet",
"item.create.furnace_minecart_contraption": "Furnace Minecart Contraption", "item.create.furnace_minecart_contraption": "Furnace Minecart Contraption",
"item.create.goggles": "Engineer's Goggles", "item.create.goggles": "Engineer's Goggles",
"item.create.golden_sheet": "Golden Sheet", "item.create.golden_sheet": "Golden Sheet",

View file

@ -1,5 +1,5 @@
{ {
"_": "Missing Localizations: 790", "_": "Missing Localizations: 791",
"_": "->------------------------] Game Elements [------------------------<-", "_": "->------------------------] Game Elements [------------------------<-",
@ -371,6 +371,7 @@
"item.create.empty_schematic": "Leerer Bauplan", "item.create.empty_schematic": "Leerer Bauplan",
"item.create.extendo_grip": "UNLOCALIZED: Extendo Grip", "item.create.extendo_grip": "UNLOCALIZED: Extendo Grip",
"item.create.filter": "Filter", "item.create.filter": "Filter",
"item.create.fuel_pellet": "UNLOCALIZED: Fuel Pellet",
"item.create.furnace_minecart_contraption": "UNLOCALIZED: Furnace Minecart Contraption", "item.create.furnace_minecart_contraption": "UNLOCALIZED: Furnace Minecart Contraption",
"item.create.goggles": "UNLOCALIZED: Engineer's Goggles", "item.create.goggles": "UNLOCALIZED: Engineer's Goggles",
"item.create.golden_sheet": "UNLOCALIZED: Golden Sheet", "item.create.golden_sheet": "UNLOCALIZED: Golden Sheet",

View file

@ -1,5 +1,5 @@
{ {
"_": "Missing Localizations: 393", "_": "Missing Localizations: 394",
"_": "->------------------------] Game Elements [------------------------<-", "_": "->------------------------] Game Elements [------------------------<-",
@ -371,6 +371,7 @@
"item.create.empty_schematic": "Schéma vide", "item.create.empty_schematic": "Schéma vide",
"item.create.extendo_grip": "UNLOCALIZED: Extendo Grip", "item.create.extendo_grip": "UNLOCALIZED: Extendo Grip",
"item.create.filter": "Filtre", "item.create.filter": "Filtre",
"item.create.fuel_pellet": "UNLOCALIZED: Fuel Pellet",
"item.create.furnace_minecart_contraption": "UNLOCALIZED: Furnace Minecart Contraption", "item.create.furnace_minecart_contraption": "UNLOCALIZED: Furnace Minecart Contraption",
"item.create.goggles": "Lunettes d'ingénieur", "item.create.goggles": "Lunettes d'ingénieur",
"item.create.golden_sheet": "UNLOCALIZED: Golden Sheet", "item.create.golden_sheet": "UNLOCALIZED: Golden Sheet",

View file

@ -1,5 +1,5 @@
{ {
"_": "Missing Localizations: 377", "_": "Missing Localizations: 378",
"_": "->------------------------] Game Elements [------------------------<-", "_": "->------------------------] Game Elements [------------------------<-",
@ -371,6 +371,7 @@
"item.create.empty_schematic": "Schematica Vuota", "item.create.empty_schematic": "Schematica Vuota",
"item.create.extendo_grip": "UNLOCALIZED: Extendo Grip", "item.create.extendo_grip": "UNLOCALIZED: Extendo Grip",
"item.create.filter": "Filtro", "item.create.filter": "Filtro",
"item.create.fuel_pellet": "UNLOCALIZED: Fuel Pellet",
"item.create.furnace_minecart_contraption": "UNLOCALIZED: Furnace Minecart Contraption", "item.create.furnace_minecart_contraption": "UNLOCALIZED: Furnace Minecart Contraption",
"item.create.goggles": "Occhiali da Ingegnere", "item.create.goggles": "Occhiali da Ingegnere",
"item.create.golden_sheet": "UNLOCALIZED: Golden Sheet", "item.create.golden_sheet": "UNLOCALIZED: Golden Sheet",

View file

@ -1,5 +1,5 @@
{ {
"_": "Missing Localizations: 372", "_": "Missing Localizations: 373",
"_": "->------------------------] Game Elements [------------------------<-", "_": "->------------------------] Game Elements [------------------------<-",
@ -371,6 +371,7 @@
"item.create.empty_schematic": "空の概略図", "item.create.empty_schematic": "空の概略図",
"item.create.extendo_grip": "UNLOCALIZED: Extendo Grip", "item.create.extendo_grip": "UNLOCALIZED: Extendo Grip",
"item.create.filter": "フィルター", "item.create.filter": "フィルター",
"item.create.fuel_pellet": "UNLOCALIZED: Fuel Pellet",
"item.create.furnace_minecart_contraption": "UNLOCALIZED: Furnace Minecart Contraption", "item.create.furnace_minecart_contraption": "UNLOCALIZED: Furnace Minecart Contraption",
"item.create.goggles": "エンジニアのゴーグル", "item.create.goggles": "エンジニアのゴーグル",
"item.create.golden_sheet": "UNLOCALIZED: Golden Sheet", "item.create.golden_sheet": "UNLOCALIZED: Golden Sheet",

View file

@ -1,5 +1,5 @@
{ {
"_": "Missing Localizations: 377", "_": "Missing Localizations: 378",
"_": "->------------------------] Game Elements [------------------------<-", "_": "->------------------------] Game Elements [------------------------<-",
@ -371,6 +371,7 @@
"item.create.empty_schematic": "빈 청사진", "item.create.empty_schematic": "빈 청사진",
"item.create.extendo_grip": "UNLOCALIZED: Extendo Grip", "item.create.extendo_grip": "UNLOCALIZED: Extendo Grip",
"item.create.filter": "필터 틀", "item.create.filter": "필터 틀",
"item.create.fuel_pellet": "UNLOCALIZED: Fuel Pellet",
"item.create.furnace_minecart_contraption": "UNLOCALIZED: Furnace Minecart Contraption", "item.create.furnace_minecart_contraption": "UNLOCALIZED: Furnace Minecart Contraption",
"item.create.goggles": "엔지니어의 고글", "item.create.goggles": "엔지니어의 고글",
"item.create.golden_sheet": "UNLOCALIZED: Golden Sheet", "item.create.golden_sheet": "UNLOCALIZED: Golden Sheet",

View file

@ -1,5 +1,5 @@
{ {
"_": "Missing Localizations: 727", "_": "Missing Localizations: 728",
"_": "->------------------------] Game Elements [------------------------<-", "_": "->------------------------] Game Elements [------------------------<-",
@ -371,6 +371,7 @@
"item.create.empty_schematic": "Lege bouwtekening", "item.create.empty_schematic": "Lege bouwtekening",
"item.create.extendo_grip": "UNLOCALIZED: Extendo Grip", "item.create.extendo_grip": "UNLOCALIZED: Extendo Grip",
"item.create.filter": "Filter", "item.create.filter": "Filter",
"item.create.fuel_pellet": "UNLOCALIZED: Fuel Pellet",
"item.create.furnace_minecart_contraption": "UNLOCALIZED: Furnace Minecart Contraption", "item.create.furnace_minecart_contraption": "UNLOCALIZED: Furnace Minecart Contraption",
"item.create.goggles": "Ingenieur's Bril", "item.create.goggles": "Ingenieur's Bril",
"item.create.golden_sheet": "UNLOCALIZED: Golden Sheet", "item.create.golden_sheet": "UNLOCALIZED: Golden Sheet",

View file

@ -1,5 +1,5 @@
{ {
"_": "Missing Localizations: 797", "_": "Missing Localizations: 798",
"_": "->------------------------] Game Elements [------------------------<-", "_": "->------------------------] Game Elements [------------------------<-",
@ -371,6 +371,7 @@
"item.create.empty_schematic": "Esquema vazio", "item.create.empty_schematic": "Esquema vazio",
"item.create.extendo_grip": "UNLOCALIZED: Extendo Grip", "item.create.extendo_grip": "UNLOCALIZED: Extendo Grip",
"item.create.filter": "Filtro", "item.create.filter": "Filtro",
"item.create.fuel_pellet": "UNLOCALIZED: Fuel Pellet",
"item.create.furnace_minecart_contraption": "UNLOCALIZED: Furnace Minecart Contraption", "item.create.furnace_minecart_contraption": "UNLOCALIZED: Furnace Minecart Contraption",
"item.create.goggles": "UNLOCALIZED: Engineer's Goggles", "item.create.goggles": "UNLOCALIZED: Engineer's Goggles",
"item.create.golden_sheet": "UNLOCALIZED: Golden Sheet", "item.create.golden_sheet": "UNLOCALIZED: Golden Sheet",

View file

@ -1,5 +1,5 @@
{ {
"_": "Missing Localizations: 791", "_": "Missing Localizations: 792",
"_": "->------------------------] Game Elements [------------------------<-", "_": "->------------------------] Game Elements [------------------------<-",
@ -371,6 +371,7 @@
"item.create.empty_schematic": "Пустая схема", "item.create.empty_schematic": "Пустая схема",
"item.create.extendo_grip": "UNLOCALIZED: Extendo Grip", "item.create.extendo_grip": "UNLOCALIZED: Extendo Grip",
"item.create.filter": "Фильтр", "item.create.filter": "Фильтр",
"item.create.fuel_pellet": "UNLOCALIZED: Fuel Pellet",
"item.create.furnace_minecart_contraption": "UNLOCALIZED: Furnace Minecart Contraption", "item.create.furnace_minecart_contraption": "UNLOCALIZED: Furnace Minecart Contraption",
"item.create.goggles": "UNLOCALIZED: Engineer's Goggles", "item.create.goggles": "UNLOCALIZED: Engineer's Goggles",
"item.create.golden_sheet": "UNLOCALIZED: Golden Sheet", "item.create.golden_sheet": "UNLOCALIZED: Golden Sheet",

View file

@ -1,5 +1,5 @@
{ {
"_": "Missing Localizations: 53", "_": "Missing Localizations: 54",
"_": "->------------------------] Game Elements [------------------------<-", "_": "->------------------------] Game Elements [------------------------<-",
@ -371,6 +371,7 @@
"item.create.empty_schematic": "空白蓝图", "item.create.empty_schematic": "空白蓝图",
"item.create.extendo_grip": "伸缩机械手", "item.create.extendo_grip": "伸缩机械手",
"item.create.filter": "过滤器", "item.create.filter": "过滤器",
"item.create.fuel_pellet": "UNLOCALIZED: Fuel Pellet",
"item.create.furnace_minecart_contraption": "装配过的动力矿车", "item.create.furnace_minecart_contraption": "装配过的动力矿车",
"item.create.goggles": "工程师护目镜", "item.create.goggles": "工程师护目镜",
"item.create.golden_sheet": "金板", "item.create.golden_sheet": "金板",

View file

@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "create:item/fuel_pellet"
}
}

View file

@ -18,11 +18,7 @@ import com.simibubi.create.content.contraptions.relays.belt.item.BeltConnectorIt
import com.simibubi.create.content.contraptions.relays.gearbox.VerticalGearboxItem; import com.simibubi.create.content.contraptions.relays.gearbox.VerticalGearboxItem;
import com.simibubi.create.content.contraptions.wrench.WrenchItem; import com.simibubi.create.content.contraptions.wrench.WrenchItem;
import com.simibubi.create.content.contraptions.wrench.WrenchModel; import com.simibubi.create.content.contraptions.wrench.WrenchModel;
import com.simibubi.create.content.curiosities.ChromaticCompoundColor; import com.simibubi.create.content.curiosities.*;
import com.simibubi.create.content.curiosities.ChromaticCompoundItem;
import com.simibubi.create.content.curiosities.RefinedRadianceItem;
import com.simibubi.create.content.curiosities.ShadowSteelItem;
import com.simibubi.create.content.curiosities.TreeFertilizerItem;
import com.simibubi.create.content.curiosities.symmetry.SymmetryWandItem; import com.simibubi.create.content.curiosities.symmetry.SymmetryWandItem;
import com.simibubi.create.content.curiosities.symmetry.client.SymmetryWandModel; import com.simibubi.create.content.curiosities.symmetry.client.SymmetryWandModel;
import com.simibubi.create.content.curiosities.tools.DeforesterItem; import com.simibubi.create.content.curiosities.tools.DeforesterItem;
@ -43,9 +39,11 @@ import com.simibubi.create.foundation.data.CreateRegistrate;
import com.tterrag.registrate.util.entry.ItemEntry; import com.tterrag.registrate.util.entry.ItemEntry;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.Items;
import net.minecraft.item.Rarity; import net.minecraft.item.Rarity;
import net.minecraft.tags.Tag; import net.minecraft.tags.Tag;
@SuppressWarnings("unused")
public class AllItems { public class AllItems {
private static final CreateRegistrate REGISTRATE = Create.registrate() private static final CreateRegistrate REGISTRATE = Create.registrate()
@ -118,7 +116,7 @@ public class AllItems {
public static final ItemEntry<VerticalGearboxItem> VERTICAL_GEARBOX = public static final ItemEntry<VerticalGearboxItem> VERTICAL_GEARBOX =
REGISTRATE.item("vertical_gearbox", VerticalGearboxItem::new) REGISTRATE.item("vertical_gearbox", VerticalGearboxItem::new)
.model(AssetLookup.<VerticalGearboxItem>customItemModel("gearbox", "item_vertical")) .model(AssetLookup.customItemModel("gearbox", "item_vertical"))
.register(); .register();
public static final ItemEntry<SuperGlueItem> SUPER_GLUE = REGISTRATE.item("super_glue", SuperGlueItem::new) public static final ItemEntry<SuperGlueItem> SUPER_GLUE = REGISTRATE.item("super_glue", SuperGlueItem::new)
@ -175,6 +173,10 @@ public class AllItems {
REGISTRATE.item("tree_fertilizer", TreeFertilizerItem::new) REGISTRATE.item("tree_fertilizer", TreeFertilizerItem::new)
.register(); .register();
public static final ItemEntry<CombustibleItem> FUEL_PELLET = REGISTRATE.item("fuel_pellet", CombustibleItem::new)
// .onRegister(item -> item.setBurnTime(2048))
.register();
public static final ItemEntry<BlockzapperItem> BLOCKZAPPER = public static final ItemEntry<BlockzapperItem> BLOCKZAPPER =
REGISTRATE.item("handheld_blockzapper", BlockzapperItem::new) REGISTRATE.item("handheld_blockzapper", BlockzapperItem::new)
.transform(CreateRegistrate.customRenderedItem(() -> BlockzapperModel::new)) .transform(CreateRegistrate.customRenderedItem(() -> BlockzapperModel::new))

View file

@ -65,7 +65,7 @@ public class HeaterBlock extends Block implements ITE<HeaterTileEntity> {
if (!hasTileEntity(state)) if (!hasTileEntity(state))
return ActionResultType.PASS; return ActionResultType.PASS;
TileEntity te = world.getTileEntity(pos); TileEntity te = world.getTileEntity(pos);
if (te instanceof HeaterTileEntity && ((HeaterTileEntity) te).tryUpdateFuel(player.getHeldItem(hand))) { if (te instanceof HeaterTileEntity && ((HeaterTileEntity) te).tryUpdateFuel(player.getHeldItem(hand), player)) {
if (!player.isCreative()) if (!player.isCreative())
player.getHeldItem(hand) player.getHeldItem(hand)
.shrink(1); .shrink(1);
@ -88,4 +88,15 @@ public class HeaterBlock extends Block implements ITE<HeaterTileEntity> {
public VoxelShape getShape(BlockState state, IBlockReader reader, BlockPos pos, ISelectionContext context) { public VoxelShape getShape(BlockState state, IBlockReader reader, BlockPos pos, ISelectionContext context) {
return AllShapes.HEATER_BLOCK_SHAPE; return AllShapes.HEATER_BLOCK_SHAPE;
} }
@Override
public int getLightValue(BlockState state, IBlockReader world, BlockPos pos) {
// System.out.println("light " + pos);
// return 15;
try {
return getTileEntity(world, pos).getHeatLevel() * 4 - 1;
} catch (TileEntityException e) {
return 0;
}
}
} }

View file

@ -2,27 +2,31 @@ package com.simibubi.create.content.contraptions.processing;
import java.util.List; import java.util.List;
import com.simibubi.create.AllItems;
import com.simibubi.create.content.contraptions.components.deployer.DeployerFakePlayer;
import com.simibubi.create.foundation.tileEntity.SmartTileEntity; import com.simibubi.create.foundation.tileEntity.SmartTileEntity;
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour; import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
import net.minecraft.block.Block; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.Items; import net.minecraft.item.Items;
import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.CompoundNBT;
import net.minecraft.tileentity.TileEntityType; import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.math.MathHelper;
import net.minecraftforge.common.ForgeHooks; import net.minecraftforge.common.ForgeHooks;
public class HeaterTileEntity extends SmartTileEntity { public class HeaterTileEntity extends SmartTileEntity {
private int fuelLevel;
int fuelLevel;
private int burnTimeRemaining; private int burnTimeRemaining;
private int bufferedHeatLevel; private int bufferedHeatLevel;
private static final int maxHeatCapacity = 5000;
public HeaterTileEntity(TileEntityType<? extends HeaterTileEntity> tileEntityTypeIn) { public HeaterTileEntity(TileEntityType<? extends HeaterTileEntity> tileEntityTypeIn) {
super(tileEntityTypeIn); super(tileEntityTypeIn);
fuelLevel = 0; fuelLevel = 0;
burnTimeRemaining = 0; burnTimeRemaining = 0;
bufferedHeatLevel = 1; bufferedHeatLevel = 1;
setLazyTickRate(40);
} }
@Override @Override
@ -30,9 +34,10 @@ public class HeaterTileEntity extends SmartTileEntity {
super.tick(); super.tick();
if (burnTimeRemaining > 0) { if (burnTimeRemaining > 0) {
burnTimeRemaining--; burnTimeRemaining--;
if (burnTimeRemaining == 0 && fuelLevel > 0) { if (burnTimeRemaining <= 0 && fuelLevel > 0) {
fuelLevel--; fuelLevel--;
sendData(); burnTimeRemaining = maxHeatCapacity / 2;
updateHeatLevel();
} }
markDirty(); markDirty();
} }
@ -64,20 +69,21 @@ public class HeaterTileEntity extends SmartTileEntity {
updateHeatLevel(); updateHeatLevel();
} }
boolean tryUpdateFuel(ItemStack itemStack) { boolean tryUpdateFuel(ItemStack itemStack, PlayerEntity player) {
int burnTime = itemStack.getItem() == Items.EGG ? 150 : itemStack.getItem() boolean specialFuelUsed = itemStack.getItem() == AllItems.FUEL_PELLET.get();
.getBurnTime(itemStack); int burnTime =
if (burnTime == -1) itemStack.getItem() == Items.EGG ? 150 : (specialFuelUsed ? 1000 : ForgeHooks.getBurnTime(itemStack));
burnTime = ForgeHooks.getBurnTime(itemStack); int newFuelLevel = (specialFuelUsed ? 3 : 2);
if (burnTime <= 0) if (burnTime <= 0 || newFuelLevel < fuelLevel)
return false; return false;
if (newFuelLevel > this.fuelLevel) {
int newFuelLevel = 1; // todo: + (itemStack.getItem() == AllItems.SUPER_SPECIAL_FUEL.get() ? 1 : 0);
if (newFuelLevel < fuelLevel ^ burnTime <= burnTimeRemaining) {
return false;
}
burnTimeRemaining = burnTime;
fuelLevel = newFuelLevel; fuelLevel = newFuelLevel;
burnTimeRemaining = burnTime;
} else {
if (burnTimeRemaining + burnTime > maxHeatCapacity && player instanceof DeployerFakePlayer)
return false;
burnTimeRemaining = MathHelper.clamp(burnTimeRemaining + burnTime, 0, maxHeatCapacity);
}
updateHeatLevel(); updateHeatLevel();
return true; return true;
} }
@ -91,8 +97,9 @@ public class HeaterTileEntity extends SmartTileEntity {
if (newHeatLevel != bufferedHeatLevel) { if (newHeatLevel != bufferedHeatLevel) {
bufferedHeatLevel = newHeatLevel; bufferedHeatLevel = newHeatLevel;
markDirty(); markDirty();
if(world != null) if (world != null) {
sendData(); sendData();
} }
} }
}
} }

View file

@ -0,0 +1,21 @@
package com.simibubi.create.content.curiosities;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
public class CombustibleItem extends Item {
private int burnTime = -1;
public CombustibleItem(Properties properties) {
super(properties);
}
public void setBurnTime(int burnTime) {
this.burnTime = burnTime;
}
@Override
public int getBurnTime(ItemStack itemStack) {
return this.burnTime;
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 431 B