From 0580318b3818ed061c0a48588c5f1796d559a9d9 Mon Sep 17 00:00:00 2001 From: LordGrimmauld Date: Tue, 14 Jul 2020 15:54:02 +0200 Subject: [PATCH] new heater fuel and fueling system --- src/generated/resources/.cache/cache | 23 +++++----- .../resources/assets/create/lang/en_ud.json | 1 + .../resources/assets/create/lang/en_us.json | 1 + .../assets/create/lang/unfinished/de_de.json | 3 +- .../assets/create/lang/unfinished/fr_fr.json | 3 +- .../assets/create/lang/unfinished/it_it.json | 3 +- .../assets/create/lang/unfinished/ja_jp.json | 3 +- .../assets/create/lang/unfinished/ko_kr.json | 3 +- .../assets/create/lang/unfinished/nl_nl.json | 3 +- .../assets/create/lang/unfinished/pt_br.json | 3 +- .../assets/create/lang/unfinished/ru_ru.json | 3 +- .../assets/create/lang/unfinished/zh_cn.json | 3 +- .../create/models/item/fuel_pellet.json | 6 +++ .../java/com/simibubi/create/AllItems.java | 14 +++--- .../contraptions/processing/HeaterBlock.java | 13 +++++- .../processing/HeaterTileEntity.java | 43 ++++++++++-------- .../content/curiosities/CombustibleItem.java | 21 +++++++++ .../create/textures/item/fuel_pellet.png | Bin 0 -> 431 bytes 18 files changed, 104 insertions(+), 45 deletions(-) create mode 100644 src/generated/resources/assets/create/models/item/fuel_pellet.json create mode 100644 src/main/java/com/simibubi/create/content/curiosities/CombustibleItem.java create mode 100644 src/main/resources/assets/create/textures/item/fuel_pellet.png diff --git a/src/generated/resources/.cache/cache b/src/generated/resources/.cache/cache index dc09e9419..c9cb199dc 100644 --- a/src/generated/resources/.cache/cache +++ b/src/generated/resources/.cache/cache @@ -338,17 +338,17 @@ c60c3115fd6eeaa3a696428a87a74d184ab7d62d assets/create/blockstates/weathered_lim c77b46d8b459e5c7cc495393546f3fcca8a1fa1d assets/create/blockstates/weathered_limestone_pillar.json 7f39521b211441f5c3e06d60c5978cebe16cacfb assets/create/blockstates/zinc_block.json b7181bcd8182b2f17088e5aa881f374c9c65470c assets/create/blockstates/zinc_ore.json -00edba8c69557058bf9fbbc4d389dc455f24b0fc assets/create/lang/en_ud.json -d145a27694c4c6b257f35a8fb254991cbd1fe10d assets/create/lang/en_us.json -7fb20de7ceb40ecde8a75f079af71b5b219140a6 assets/create/lang/unfinished/de_de.json -0f451eea12911e4510ee1ef7a9d805c6fc2c8ae2 assets/create/lang/unfinished/fr_fr.json -3c423bdc944433eb2cf4e53d8259ef5c848b5787 assets/create/lang/unfinished/it_it.json -21edea7b23948e7438b6e77c2d074a908ac5d821 assets/create/lang/unfinished/ja_jp.json -88c9add37b8b7cb6ca6fb95efa3ec58dbe1adc34 assets/create/lang/unfinished/ko_kr.json -e5587d2e9fe77a07b3309a9d78679db10aa04458 assets/create/lang/unfinished/nl_nl.json -2882dc769c7d4d21eae1c7c8064a0e4a5a8e11b0 assets/create/lang/unfinished/pt_br.json -81dd7190bb2e5a796d194b1b8a8eba5c0563c3f3 assets/create/lang/unfinished/ru_ru.json -b58bf143eef4c6b76debfff2af290bc65a5db324 assets/create/lang/unfinished/zh_cn.json +31c4433a60168ccd2cfcb0e6f7e495684d0d160e assets/create/lang/en_ud.json +f6b3c31a6c3313e089e657c02832a201518d0dbe assets/create/lang/en_us.json +0cf3147b81b1d2103e79b3018c543faba63769a1 assets/create/lang/unfinished/de_de.json +d72b420a82e296afab9807d0183d9e8b6f8544ea assets/create/lang/unfinished/fr_fr.json +30472e049ef4d0fb92c67a2d16aa86f0face99cc assets/create/lang/unfinished/it_it.json +20db786d3ec10bc5e2f097ae31dab75c54a6ab24 assets/create/lang/unfinished/ja_jp.json +ef5dd51b525fbb21b9d9fe6ab9962f619d74aafb assets/create/lang/unfinished/ko_kr.json +f45247c1a75e90a91e798c3869dd633c7476a296 assets/create/lang/unfinished/nl_nl.json +6bf5fd3af396fdb0471c9f5f91d50c98c14eb04d assets/create/lang/unfinished/pt_br.json +1ce817630aefef48c73180965ea8ceb9c91be503 assets/create/lang/unfinished/ru_ru.json +1a8e7e8937270e74726d0d436aacf4fb7cae6b12 assets/create/lang/unfinished/zh_cn.json 846200eb548d3bfa2e77b41039de159b4b6cfb45 assets/create/models/block/acacia_window.json 1930fa3a3c98d53dd19e4ee7f55bc27fd47aa281 assets/create/models/block/acacia_window_pane_noside.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 d62b93d3c274d280f3eec22a28b5175943411d25 assets/create/models/item/framed_glass.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 090edb6a728fc3803e870d647c7c4e826faadca0 assets/create/models/item/furnace_minecart_contraption.json 2c1608c114ccc285a84e936dc3f1233c535e1a26 assets/create/models/item/gabbro.json diff --git a/src/generated/resources/assets/create/lang/en_ud.json b/src/generated/resources/assets/create/lang/en_ud.json index 72e9325f0..0b043b21d 100644 --- a/src/generated/resources/assets/create/lang/en_ud.json +++ b/src/generated/resources/assets/create/lang/en_ud.json @@ -365,6 +365,7 @@ "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.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.goggles": "s\u01DD\u05DFbbo\u2141 s,\u0279\u01DD\u01DDu\u0131bu\u018E", "item.create.golden_sheet": "\u0287\u01DD\u01DD\u0265S u\u01DDp\u05DFo\u2141", diff --git a/src/generated/resources/assets/create/lang/en_us.json b/src/generated/resources/assets/create/lang/en_us.json index eb2ca5189..b4536e458 100644 --- a/src/generated/resources/assets/create/lang/en_us.json +++ b/src/generated/resources/assets/create/lang/en_us.json @@ -370,6 +370,7 @@ "item.create.empty_schematic": "Empty Schematic", "item.create.extendo_grip": "Extendo Grip", "item.create.filter": "Filter", + "item.create.fuel_pellet": "Fuel Pellet", "item.create.furnace_minecart_contraption": "Furnace Minecart Contraption", "item.create.goggles": "Engineer's Goggles", "item.create.golden_sheet": "Golden Sheet", diff --git a/src/generated/resources/assets/create/lang/unfinished/de_de.json b/src/generated/resources/assets/create/lang/unfinished/de_de.json index 721cbe213..dd02f9915 100644 --- a/src/generated/resources/assets/create/lang/unfinished/de_de.json +++ b/src/generated/resources/assets/create/lang/unfinished/de_de.json @@ -1,5 +1,5 @@ { - "_": "Missing Localizations: 790", + "_": "Missing Localizations: 791", "_": "->------------------------] Game Elements [------------------------<-", @@ -371,6 +371,7 @@ "item.create.empty_schematic": "Leerer Bauplan", "item.create.extendo_grip": "UNLOCALIZED: Extendo Grip", "item.create.filter": "Filter", + "item.create.fuel_pellet": "UNLOCALIZED: Fuel Pellet", "item.create.furnace_minecart_contraption": "UNLOCALIZED: Furnace Minecart Contraption", "item.create.goggles": "UNLOCALIZED: Engineer's Goggles", "item.create.golden_sheet": "UNLOCALIZED: Golden Sheet", diff --git a/src/generated/resources/assets/create/lang/unfinished/fr_fr.json b/src/generated/resources/assets/create/lang/unfinished/fr_fr.json index b160070e3..b56668ac7 100644 --- a/src/generated/resources/assets/create/lang/unfinished/fr_fr.json +++ b/src/generated/resources/assets/create/lang/unfinished/fr_fr.json @@ -1,5 +1,5 @@ { - "_": "Missing Localizations: 393", + "_": "Missing Localizations: 394", "_": "->------------------------] Game Elements [------------------------<-", @@ -371,6 +371,7 @@ "item.create.empty_schematic": "Schéma vide", "item.create.extendo_grip": "UNLOCALIZED: Extendo Grip", "item.create.filter": "Filtre", + "item.create.fuel_pellet": "UNLOCALIZED: Fuel Pellet", "item.create.furnace_minecart_contraption": "UNLOCALIZED: Furnace Minecart Contraption", "item.create.goggles": "Lunettes d'ingénieur", "item.create.golden_sheet": "UNLOCALIZED: Golden Sheet", diff --git a/src/generated/resources/assets/create/lang/unfinished/it_it.json b/src/generated/resources/assets/create/lang/unfinished/it_it.json index 1a033561f..d977b69d8 100644 --- a/src/generated/resources/assets/create/lang/unfinished/it_it.json +++ b/src/generated/resources/assets/create/lang/unfinished/it_it.json @@ -1,5 +1,5 @@ { - "_": "Missing Localizations: 377", + "_": "Missing Localizations: 378", "_": "->------------------------] Game Elements [------------------------<-", @@ -371,6 +371,7 @@ "item.create.empty_schematic": "Schematica Vuota", "item.create.extendo_grip": "UNLOCALIZED: Extendo Grip", "item.create.filter": "Filtro", + "item.create.fuel_pellet": "UNLOCALIZED: Fuel Pellet", "item.create.furnace_minecart_contraption": "UNLOCALIZED: Furnace Minecart Contraption", "item.create.goggles": "Occhiali da Ingegnere", "item.create.golden_sheet": "UNLOCALIZED: Golden Sheet", diff --git a/src/generated/resources/assets/create/lang/unfinished/ja_jp.json b/src/generated/resources/assets/create/lang/unfinished/ja_jp.json index cbc26fcbf..b26982bc7 100644 --- a/src/generated/resources/assets/create/lang/unfinished/ja_jp.json +++ b/src/generated/resources/assets/create/lang/unfinished/ja_jp.json @@ -1,5 +1,5 @@ { - "_": "Missing Localizations: 372", + "_": "Missing Localizations: 373", "_": "->------------------------] Game Elements [------------------------<-", @@ -371,6 +371,7 @@ "item.create.empty_schematic": "空の概略図", "item.create.extendo_grip": "UNLOCALIZED: Extendo Grip", "item.create.filter": "フィルター", + "item.create.fuel_pellet": "UNLOCALIZED: Fuel Pellet", "item.create.furnace_minecart_contraption": "UNLOCALIZED: Furnace Minecart Contraption", "item.create.goggles": "エンジニアのゴーグル", "item.create.golden_sheet": "UNLOCALIZED: Golden Sheet", diff --git a/src/generated/resources/assets/create/lang/unfinished/ko_kr.json b/src/generated/resources/assets/create/lang/unfinished/ko_kr.json index d6bfa5283..94f32c357 100644 --- a/src/generated/resources/assets/create/lang/unfinished/ko_kr.json +++ b/src/generated/resources/assets/create/lang/unfinished/ko_kr.json @@ -1,5 +1,5 @@ { - "_": "Missing Localizations: 377", + "_": "Missing Localizations: 378", "_": "->------------------------] Game Elements [------------------------<-", @@ -371,6 +371,7 @@ "item.create.empty_schematic": "빈 청사진", "item.create.extendo_grip": "UNLOCALIZED: Extendo Grip", "item.create.filter": "필터 틀", + "item.create.fuel_pellet": "UNLOCALIZED: Fuel Pellet", "item.create.furnace_minecart_contraption": "UNLOCALIZED: Furnace Minecart Contraption", "item.create.goggles": "엔지니어의 고글", "item.create.golden_sheet": "UNLOCALIZED: Golden Sheet", diff --git a/src/generated/resources/assets/create/lang/unfinished/nl_nl.json b/src/generated/resources/assets/create/lang/unfinished/nl_nl.json index 1f0c8ae54..41697cd34 100644 --- a/src/generated/resources/assets/create/lang/unfinished/nl_nl.json +++ b/src/generated/resources/assets/create/lang/unfinished/nl_nl.json @@ -1,5 +1,5 @@ { - "_": "Missing Localizations: 727", + "_": "Missing Localizations: 728", "_": "->------------------------] Game Elements [------------------------<-", @@ -371,6 +371,7 @@ "item.create.empty_schematic": "Lege bouwtekening", "item.create.extendo_grip": "UNLOCALIZED: Extendo Grip", "item.create.filter": "Filter", + "item.create.fuel_pellet": "UNLOCALIZED: Fuel Pellet", "item.create.furnace_minecart_contraption": "UNLOCALIZED: Furnace Minecart Contraption", "item.create.goggles": "Ingenieur's Bril", "item.create.golden_sheet": "UNLOCALIZED: Golden Sheet", diff --git a/src/generated/resources/assets/create/lang/unfinished/pt_br.json b/src/generated/resources/assets/create/lang/unfinished/pt_br.json index ff00b1cc4..920fb06d6 100644 --- a/src/generated/resources/assets/create/lang/unfinished/pt_br.json +++ b/src/generated/resources/assets/create/lang/unfinished/pt_br.json @@ -1,5 +1,5 @@ { - "_": "Missing Localizations: 797", + "_": "Missing Localizations: 798", "_": "->------------------------] Game Elements [------------------------<-", @@ -371,6 +371,7 @@ "item.create.empty_schematic": "Esquema vazio", "item.create.extendo_grip": "UNLOCALIZED: Extendo Grip", "item.create.filter": "Filtro", + "item.create.fuel_pellet": "UNLOCALIZED: Fuel Pellet", "item.create.furnace_minecart_contraption": "UNLOCALIZED: Furnace Minecart Contraption", "item.create.goggles": "UNLOCALIZED: Engineer's Goggles", "item.create.golden_sheet": "UNLOCALIZED: Golden Sheet", diff --git a/src/generated/resources/assets/create/lang/unfinished/ru_ru.json b/src/generated/resources/assets/create/lang/unfinished/ru_ru.json index 396446136..9f9001c05 100644 --- a/src/generated/resources/assets/create/lang/unfinished/ru_ru.json +++ b/src/generated/resources/assets/create/lang/unfinished/ru_ru.json @@ -1,5 +1,5 @@ { - "_": "Missing Localizations: 791", + "_": "Missing Localizations: 792", "_": "->------------------------] Game Elements [------------------------<-", @@ -371,6 +371,7 @@ "item.create.empty_schematic": "Пустая схема", "item.create.extendo_grip": "UNLOCALIZED: Extendo Grip", "item.create.filter": "Фильтр", + "item.create.fuel_pellet": "UNLOCALIZED: Fuel Pellet", "item.create.furnace_minecart_contraption": "UNLOCALIZED: Furnace Minecart Contraption", "item.create.goggles": "UNLOCALIZED: Engineer's Goggles", "item.create.golden_sheet": "UNLOCALIZED: Golden Sheet", diff --git a/src/generated/resources/assets/create/lang/unfinished/zh_cn.json b/src/generated/resources/assets/create/lang/unfinished/zh_cn.json index fff817163..a8e80eb88 100644 --- a/src/generated/resources/assets/create/lang/unfinished/zh_cn.json +++ b/src/generated/resources/assets/create/lang/unfinished/zh_cn.json @@ -1,5 +1,5 @@ { - "_": "Missing Localizations: 53", + "_": "Missing Localizations: 54", "_": "->------------------------] Game Elements [------------------------<-", @@ -371,6 +371,7 @@ "item.create.empty_schematic": "空白蓝图", "item.create.extendo_grip": "伸缩机械手", "item.create.filter": "过滤器", + "item.create.fuel_pellet": "UNLOCALIZED: Fuel Pellet", "item.create.furnace_minecart_contraption": "装配过的动力矿车", "item.create.goggles": "工程师护目镜", "item.create.golden_sheet": "金板", diff --git a/src/generated/resources/assets/create/models/item/fuel_pellet.json b/src/generated/resources/assets/create/models/item/fuel_pellet.json new file mode 100644 index 000000000..4b15ea930 --- /dev/null +++ b/src/generated/resources/assets/create/models/item/fuel_pellet.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "create:item/fuel_pellet" + } +} \ No newline at end of file diff --git a/src/main/java/com/simibubi/create/AllItems.java b/src/main/java/com/simibubi/create/AllItems.java index 33482516b..74fe66cda 100644 --- a/src/main/java/com/simibubi/create/AllItems.java +++ b/src/main/java/com/simibubi/create/AllItems.java @@ -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.wrench.WrenchItem; import com.simibubi.create.content.contraptions.wrench.WrenchModel; -import com.simibubi.create.content.curiosities.ChromaticCompoundColor; -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.*; import com.simibubi.create.content.curiosities.symmetry.SymmetryWandItem; import com.simibubi.create.content.curiosities.symmetry.client.SymmetryWandModel; 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 net.minecraft.item.Item; +import net.minecraft.item.Items; import net.minecraft.item.Rarity; import net.minecraft.tags.Tag; +@SuppressWarnings("unused") public class AllItems { private static final CreateRegistrate REGISTRATE = Create.registrate() @@ -118,7 +116,7 @@ public class AllItems { public static final ItemEntry VERTICAL_GEARBOX = REGISTRATE.item("vertical_gearbox", VerticalGearboxItem::new) - .model(AssetLookup.customItemModel("gearbox", "item_vertical")) + .model(AssetLookup.customItemModel("gearbox", "item_vertical")) .register(); public static final ItemEntry SUPER_GLUE = REGISTRATE.item("super_glue", SuperGlueItem::new) @@ -175,6 +173,10 @@ public class AllItems { REGISTRATE.item("tree_fertilizer", TreeFertilizerItem::new) .register(); + public static final ItemEntry FUEL_PELLET = REGISTRATE.item("fuel_pellet", CombustibleItem::new) + // .onRegister(item -> item.setBurnTime(2048)) + .register(); + public static final ItemEntry BLOCKZAPPER = REGISTRATE.item("handheld_blockzapper", BlockzapperItem::new) .transform(CreateRegistrate.customRenderedItem(() -> BlockzapperModel::new)) diff --git a/src/main/java/com/simibubi/create/content/contraptions/processing/HeaterBlock.java b/src/main/java/com/simibubi/create/content/contraptions/processing/HeaterBlock.java index 6f359e7d0..2e49a92f0 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/processing/HeaterBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/processing/HeaterBlock.java @@ -65,7 +65,7 @@ public class HeaterBlock extends Block implements ITE { if (!hasTileEntity(state)) return ActionResultType.PASS; 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()) player.getHeldItem(hand) .shrink(1); @@ -88,4 +88,15 @@ public class HeaterBlock extends Block implements ITE { public VoxelShape getShape(BlockState state, IBlockReader reader, BlockPos pos, ISelectionContext context) { 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; + } + } } diff --git a/src/main/java/com/simibubi/create/content/contraptions/processing/HeaterTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/processing/HeaterTileEntity.java index 582cb1581..3c645b56a 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/processing/HeaterTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/processing/HeaterTileEntity.java @@ -2,27 +2,31 @@ package com.simibubi.create.content.contraptions.processing; 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.TileEntityBehaviour; -import net.minecraft.block.Block; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; import net.minecraft.item.Items; import net.minecraft.nbt.CompoundNBT; import net.minecraft.tileentity.TileEntityType; +import net.minecraft.util.math.MathHelper; import net.minecraftforge.common.ForgeHooks; public class HeaterTileEntity extends SmartTileEntity { - - int fuelLevel; + private int fuelLevel; private int burnTimeRemaining; private int bufferedHeatLevel; + private static final int maxHeatCapacity = 5000; public HeaterTileEntity(TileEntityType tileEntityTypeIn) { super(tileEntityTypeIn); fuelLevel = 0; burnTimeRemaining = 0; bufferedHeatLevel = 1; + setLazyTickRate(40); } @Override @@ -30,9 +34,10 @@ public class HeaterTileEntity extends SmartTileEntity { super.tick(); if (burnTimeRemaining > 0) { burnTimeRemaining--; - if (burnTimeRemaining == 0 && fuelLevel > 0) { + if (burnTimeRemaining <= 0 && fuelLevel > 0) { fuelLevel--; - sendData(); + burnTimeRemaining = maxHeatCapacity / 2; + updateHeatLevel(); } markDirty(); } @@ -64,20 +69,21 @@ public class HeaterTileEntity extends SmartTileEntity { updateHeatLevel(); } - boolean tryUpdateFuel(ItemStack itemStack) { - int burnTime = itemStack.getItem() == Items.EGG ? 150 : itemStack.getItem() - .getBurnTime(itemStack); - if (burnTime == -1) - burnTime = ForgeHooks.getBurnTime(itemStack); - if (burnTime <= 0) - return false; - - int newFuelLevel = 1; // todo: + (itemStack.getItem() == AllItems.SUPER_SPECIAL_FUEL.get() ? 1 : 0); - if (newFuelLevel < fuelLevel ^ burnTime <= burnTimeRemaining) { + boolean tryUpdateFuel(ItemStack itemStack, PlayerEntity player) { + boolean specialFuelUsed = itemStack.getItem() == AllItems.FUEL_PELLET.get(); + int burnTime = + itemStack.getItem() == Items.EGG ? 150 : (specialFuelUsed ? 1000 : ForgeHooks.getBurnTime(itemStack)); + int newFuelLevel = (specialFuelUsed ? 3 : 2); + if (burnTime <= 0 || newFuelLevel < fuelLevel) return false; + if (newFuelLevel > this.fuelLevel) { + fuelLevel = newFuelLevel; + burnTimeRemaining = burnTime; + } else { + if (burnTimeRemaining + burnTime > maxHeatCapacity && player instanceof DeployerFakePlayer) + return false; + burnTimeRemaining = MathHelper.clamp(burnTimeRemaining + burnTime, 0, maxHeatCapacity); } - burnTimeRemaining = burnTime; - fuelLevel = newFuelLevel; updateHeatLevel(); return true; } @@ -91,8 +97,9 @@ public class HeaterTileEntity extends SmartTileEntity { if (newHeatLevel != bufferedHeatLevel) { bufferedHeatLevel = newHeatLevel; markDirty(); - if(world != null) + if (world != null) { sendData(); + } } } } diff --git a/src/main/java/com/simibubi/create/content/curiosities/CombustibleItem.java b/src/main/java/com/simibubi/create/content/curiosities/CombustibleItem.java new file mode 100644 index 000000000..a92cb727d --- /dev/null +++ b/src/main/java/com/simibubi/create/content/curiosities/CombustibleItem.java @@ -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; + } +} \ No newline at end of file diff --git a/src/main/resources/assets/create/textures/item/fuel_pellet.png b/src/main/resources/assets/create/textures/item/fuel_pellet.png new file mode 100644 index 0000000000000000000000000000000000000000..01aaf3919ac5aa554137e24cf4808708d3a0df05 GIT binary patch literal 431 zcmV;g0Z{&lP)e zSad^gZEa<4bO1wgWnpw>WFU8GbZ8()Nlj2!fese{009?CL_t(I%dL~KZo)7ShJO7rlc~Ht#jg_RO&6Z z&i8-+on2%P7ju82BaD0j~!f}y0yY% z@mmE9+Z_A6z_85?kS$#9=)E3cpBKieJ0gzMxdKpK*jDA}a;E}O0G6CjSRH?AyHP@y zI|zip`mkdZAj3f)!Rrf>^T}{8&m9P1ydO^Iof83dCqe*V>%*@4lxMw>BsppOcvSdr ZaRY`3fAPZz$6Npa002ovPDHLkV1glhsnP%d literal 0 HcmV?d00001