diff --git a/src/generated/resources/.cache/cache b/src/generated/resources/.cache/cache index 045150eed..8d7d1c8ad 100644 --- a/src/generated/resources/.cache/cache +++ b/src/generated/resources/.cache/cache @@ -2479,6 +2479,7 @@ d3fdb8ece6cb072a93ddb64a0baad5ac952117a4 data\create\recipes\weathered_limestone 11667414f73bc2d00bda7c5c1a7d2934bf6e9165 data\create\recipes\weathered_limestone_pillar_from_weathered_limestone_stonecutting.json 266f08e604d229a9d2b46f7272c0b06ec270bf3d data\create\recipes\zinc_block.json 403576ae5710d4fe731144fe623b1673093076ea data\create\tags\blocks\brittle.json +06d3931993d4f61713390416f1e6fe1a0b5aaf43 data\create\tags\blocks\fan_heaters.json 081f5aa35602fc27af2ca01ea9f2fd5e7eb284dc data\create\tags\items\create_ingots.json d2dc4ff179ef7b2aa9276455c196e15d44aa95a8 data\create\tags\items\crushed_ores.json 16bcb8fcbe9170c2c11f1ca8d99d8b36cd812bbd data\forge\tags\blocks\glass\colorless.json diff --git a/src/generated/resources/data/create/tags/blocks/fan_heaters.json b/src/generated/resources/data/create/tags/blocks/fan_heaters.json new file mode 100644 index 000000000..2cf03ca08 --- /dev/null +++ b/src/generated/resources/data/create/tags/blocks/fan_heaters.json @@ -0,0 +1,6 @@ +{ + "replace": false, + "values": [ + "create:blaze_heater" + ] +} \ No newline at end of file diff --git a/src/main/java/com/simibubi/create/AllBlockPartials.java b/src/main/java/com/simibubi/create/AllBlockPartials.java index b2ad31f85..8494fd77f 100644 --- a/src/main/java/com/simibubi/create/AllBlockPartials.java +++ b/src/main/java/com/simibubi/create/AllBlockPartials.java @@ -27,78 +27,54 @@ import net.minecraftforge.client.model.ModelLoader; public class AllBlockPartials { private static List all = new ArrayList<>(); - - public static final AllBlockPartials - SCHEMATICANNON_CONNECTOR = get("schematicannon/connector"), + + public static final AllBlockPartials SCHEMATICANNON_CONNECTOR = get("schematicannon/connector"), SCHEMATICANNON_PIPE = get("schematicannon/pipe"), - SHAFTLESS_COGWHEEL = get("cogwheel_shaftless"), - BELT_PULLEY = get("belt_pulley"), + SHAFTLESS_COGWHEEL = get("cogwheel_shaftless"), BELT_PULLEY = get("belt_pulley"), SHAFT_HALF = get("shaft_half"), - ENCASED_FAN_INNER = get("encased_fan/propeller"), - HAND_CRANK_HANDLE = get("hand_crank/handle"), - MECHANICAL_PRESS_HEAD = get("mechanical_press/head"), - MECHANICAL_MIXER_POLE = get("mechanical_mixer/pole"), - MECHANICAL_MIXER_HEAD = get("mechanical_mixer/head"), + ENCASED_FAN_INNER = get("encased_fan/propeller"), HAND_CRANK_HANDLE = get("hand_crank/handle"), + MECHANICAL_PRESS_HEAD = get("mechanical_press/head"), MECHANICAL_MIXER_POLE = get("mechanical_mixer/pole"), + MECHANICAL_MIXER_HEAD = get("mechanical_mixer/head"), BLAZE_HEATER_BLAZE_ONE = get("blaze_heater/blaze/one"), + BLAZE_HEATER_BLAZE_TWO = get("blaze_heater/blaze/two"), + BLAZE_HEATER_BLAZE_THREE = get("blaze_heater/blaze/three"), + BLAZE_HEATER_BLAZE_FOUR = get("blaze_heater/blaze/four"), MECHANICAL_CRAFTER_LID = get("mechanical_crafter/lid"), MECHANICAL_CRAFTER_ARROW = get("mechanical_crafter/arrow"), MECHANICAL_CRAFTER_BELT_FRAME = get("mechanical_crafter/belt"), - MECHANICAL_CRAFTER_BELT = get("mechanical_crafter/belt_animated"), - GAUGE_DIAL = get("gauge/dial"), - GAUGE_INDICATOR = get("gauge/indicator"), - GAUGE_HEAD_SPEED = get("gauge/speedometer/head"), - GAUGE_HEAD_STRESS = get("gauge/stressometer/head"), - BEARING_TOP = get("bearing/top"), - DRILL_HEAD = get("mechanical_drill/head"), - HARVESTER_BLADE = get("mechanical_harvester/blade"), - DEPLOYER_POLE = get("deployer/pole"), - DEPLOYER_HAND_POINTING = get("deployer/hand_pointing"), - DEPLOYER_HAND_PUNCHING = get("deployer/hand_punching"), - DEPLOYER_HAND_HOLDING = get("deployer/hand_holding"), - ANALOG_LEVER_HANDLE = get("analog_lever/handle"), - ANALOG_LEVER_INDICATOR = get("analog_lever/indicator"), - BELT_FUNNEL_FLAP = get("belt_funnel/flap"), - BELT_TUNNEL_FLAP = get("belt_tunnel/flap"), - BELT_TUNNEL_INDICATOR = get("belt_tunnel/indicator"), - FLEXPEATER_INDICATOR = get("diodes/indicator"), - FLYWHEEL = get("flywheel/wheel"), - FLYWHEEL_UPPER_ROTATING = get("flywheel/upper_rotating_connector"), + MECHANICAL_CRAFTER_BELT = get("mechanical_crafter/belt_animated"), GAUGE_DIAL = get("gauge/dial"), + GAUGE_INDICATOR = get("gauge/indicator"), GAUGE_HEAD_SPEED = get("gauge/speedometer/head"), + GAUGE_HEAD_STRESS = get("gauge/stressometer/head"), BEARING_TOP = get("bearing/top"), + DRILL_HEAD = get("mechanical_drill/head"), HARVESTER_BLADE = get("mechanical_harvester/blade"), + DEPLOYER_POLE = get("deployer/pole"), DEPLOYER_HAND_POINTING = get("deployer/hand_pointing"), + DEPLOYER_HAND_PUNCHING = get("deployer/hand_punching"), DEPLOYER_HAND_HOLDING = get("deployer/hand_holding"), + ANALOG_LEVER_HANDLE = get("analog_lever/handle"), ANALOG_LEVER_INDICATOR = get("analog_lever/indicator"), + BELT_FUNNEL_FLAP = get("belt_funnel/flap"), BELT_TUNNEL_FLAP = get("belt_tunnel/flap"), + BELT_TUNNEL_INDICATOR = get("belt_tunnel/indicator"), FLEXPEATER_INDICATOR = get("diodes/indicator"), + FLYWHEEL = get("flywheel/wheel"), FLYWHEEL_UPPER_ROTATING = get("flywheel/upper_rotating_connector"), FLYWHEEL_LOWER_ROTATING = get("flywheel/lower_rotating_connector"), FLYWHEEL_UPPER_SLIDING = get("flywheel/upper_sliding_connector"), FLYWHEEL_LOWER_SLIDING = get("flywheel/lower_sliding_connector"), - FURNACE_GENERATOR_FRAME = get("furnace_engine/frame"), - CUCKOO_MINUTE_HAND = get("cuckoo_clock/minute_hand"), - CUCKOO_HOUR_HAND = get("cuckoo_clock/hour_hand"), - CUCKOO_LEFT_DOOR = get("cuckoo_clock/left_door"), - CUCKOO_RIGHT_DOOR = get("cuckoo_clock/right_door"), - CUCKOO_PIG = get("cuckoo_clock/pig"), - CUCKOO_CREEPER = get("cuckoo_clock/creeper"), - ROPE_COIL = get("rope_pulley/rope_coil"), - ROPE_HALF = get("rope_pulley/rope_half"), - ROPE_HALF_MAGNET = get("rope_pulley/rope_half_magnet"), - MILLSTONE_COG = get("millstone/inner"), - PACKAGER_SEALER = get("packager/sealer"), + FURNACE_GENERATOR_FRAME = get("furnace_engine/frame"), CUCKOO_MINUTE_HAND = get("cuckoo_clock/minute_hand"), + CUCKOO_HOUR_HAND = get("cuckoo_clock/hour_hand"), CUCKOO_LEFT_DOOR = get("cuckoo_clock/left_door"), + CUCKOO_RIGHT_DOOR = get("cuckoo_clock/right_door"), CUCKOO_PIG = get("cuckoo_clock/pig"), + CUCKOO_CREEPER = get("cuckoo_clock/creeper"), ROPE_COIL = get("rope_pulley/rope_coil"), + ROPE_HALF = get("rope_pulley/rope_half"), ROPE_HALF_MAGNET = get("rope_pulley/rope_half_magnet"), + MILLSTONE_COG = get("millstone/inner"), PACKAGER_SEALER = get("packager/sealer"), - SYMMETRY_PLANE = get("symmetry_effect/plane"), - SYMMETRY_CROSSPLANE = get("symmetry_effect/crossplane"), + SYMMETRY_PLANE = get("symmetry_effect/plane"), SYMMETRY_CROSSPLANE = get("symmetry_effect/crossplane"), SYMMETRY_TRIPLEPLANE = get("symmetry_effect/tripleplane"), - ARM_COG = get("mechanical_arm/cog"), - ARM_BASE = get("mechanical_arm/base"), - ARM_LOWER_BODY = get("mechanical_arm/lower_body"), - ARM_UPPER_BODY = get("mechanical_arm/upper_body"), - ARM_HEAD = get("mechanical_arm/head"), - ARM_CLAW_BASE = get("mechanical_arm/claw_base"), - ARM_CLAW_GRIP = get("mechanical_arm/claw_grip"), - - FLAG_SHORT_IN = get("mechanical_arm/flag/short_in"), - FLAG_SHORT_OUT = get("mechanical_arm/flag/short_out"), - FLAG_LONG_IN = get("mechanical_arm/flag/long_in"), - FLAG_LONG_OUT = get("mechanical_arm/flag/long_out"), - - MECHANICAL_PUMP_ARROW = get("mechanical_pump/arrow"), - MECHANICAL_PUMP_COG = get("mechanical_pump/cog"), + ARM_COG = get("mechanical_arm/cog"), ARM_BASE = get("mechanical_arm/base"), + ARM_LOWER_BODY = get("mechanical_arm/lower_body"), ARM_UPPER_BODY = get("mechanical_arm/upper_body"), + ARM_HEAD = get("mechanical_arm/head"), ARM_CLAW_BASE = get("mechanical_arm/claw_base"), + ARM_CLAW_GRIP = get("mechanical_arm/claw_grip"), + + FLAG_SHORT_IN = get("mechanical_arm/flag/short_in"), FLAG_SHORT_OUT = get("mechanical_arm/flag/short_out"), + FLAG_LONG_IN = get("mechanical_arm/flag/long_in"), FLAG_LONG_OUT = get("mechanical_arm/flag/long_out"), + + MECHANICAL_PUMP_ARROW = get("mechanical_pump/arrow"), MECHANICAL_PUMP_COG = get("mechanical_pump/cog"), FLUID_PIPE_CASING = get("fluid_pipe/casing"); public static final Map PIPE_RIMS = map(); @@ -114,8 +90,7 @@ public class AllBlockPartials { private ResourceLocation modelLocation; private IBakedModel bakedModel; - private AllBlockPartials() { - } + private AllBlockPartials() {} private static void populateMaps() { for (Direction d : Iterate.directions) { diff --git a/src/main/java/com/simibubi/create/AllBlocks.java b/src/main/java/com/simibubi/create/AllBlocks.java index 83446624d..2cd162aa4 100644 --- a/src/main/java/com/simibubi/create/AllBlocks.java +++ b/src/main/java/com/simibubi/create/AllBlocks.java @@ -398,12 +398,13 @@ public class AllBlocks { .register(); public static final BlockEntry HEATER = REGISTRATE.block("blaze_heater", HeaterBlock::new) - .initialProperties(SharedProperties::softMetal) - .properties(p -> p.lightValue(12)) - .addLayer(() -> RenderType::getCutoutMipped) - .blockstate((c, p) -> p.simpleBlock(c.getEntry(), AssetLookup.partialBaseModel(c, p))) - .simpleItem() - .register(); + .initialProperties(SharedProperties::softMetal) + .properties(p -> p.lightValue(12)) + .tag(AllBlockTags.FAN_HEATERS.tag) + .addLayer(() -> RenderType::getCutoutMipped) + .blockstate((c, p) -> p.simpleBlock(c.getEntry(), AssetLookup.partialBaseModel(c, p))) + .simpleItem() + .register(); public static final BlockEntry DEPOT = REGISTRATE.block("depot", DepotBlock::new) .initialProperties(SharedProperties::stone) diff --git a/src/main/java/com/simibubi/create/AllTileEntities.java b/src/main/java/com/simibubi/create/AllTileEntities.java index f7b0b865f..5ff95476b 100644 --- a/src/main/java/com/simibubi/create/AllTileEntities.java +++ b/src/main/java/com/simibubi/create/AllTileEntities.java @@ -49,8 +49,7 @@ import com.simibubi.create.content.contraptions.fluids.FluidTankRenderer; import com.simibubi.create.content.contraptions.fluids.FluidTankTileEntity; import com.simibubi.create.content.contraptions.fluids.PumpRenderer; import com.simibubi.create.content.contraptions.fluids.PumpTileEntity; -import com.simibubi.create.content.contraptions.processing.BasinRenderer; -import com.simibubi.create.content.contraptions.processing.BasinTileEntity; +import com.simibubi.create.content.contraptions.processing.*; import com.simibubi.create.content.contraptions.relays.advanced.SpeedControllerRenderer; import com.simibubi.create.content.contraptions.relays.advanced.SpeedControllerTileEntity; import com.simibubi.create.content.contraptions.relays.advanced.sequencer.SequencedGearshiftTileEntity; @@ -198,6 +197,8 @@ public class AllTileEntities { register("deployer", DeployerTileEntity::new, AllBlocks.DEPLOYER); public static final TileEntityEntry BASIN = register("basin", BasinTileEntity::new, AllBlocks.BASIN); + public static final TileEntityEntry HEATER = + register("blaze_heater", HeaterTileEntity::new, AllBlocks.HEATER); public static final TileEntityEntry MECHANICAL_CRAFTER = register("mechanical_crafter", MechanicalCrafterTileEntity::new, AllBlocks.MECHANICAL_CRAFTER); public static final TileEntityEntry SEQUENCED_GEARSHIFT = @@ -227,9 +228,9 @@ public class AllTileEntities { public static final TileEntityEntry DEPOT = register("depot", DepotTileEntity::new, AllBlocks.DEPOT); - public static final TileEntityEntry FUNNEL = register("funnel", - FunnelTileEntity::new, AllBlocks.BRASS_FUNNEL, AllBlocks.BRASS_BELT_FUNNEL, AllBlocks.BRASS_CHUTE_FUNNEL, - AllBlocks.ANDESITE_FUNNEL, AllBlocks.ANDESITE_BELT_FUNNEL, AllBlocks.ANDESITE_CHUTE_FUNNEL); + public static final TileEntityEntry FUNNEL = register("funnel", FunnelTileEntity::new, + AllBlocks.BRASS_FUNNEL, AllBlocks.BRASS_BELT_FUNNEL, AllBlocks.BRASS_CHUTE_FUNNEL, AllBlocks.ANDESITE_FUNNEL, + AllBlocks.ANDESITE_BELT_FUNNEL, AllBlocks.ANDESITE_CHUTE_FUNNEL); public static final TileEntityEntry PACKAGER = register("packager", PackagerTileEntity::new, AllBlocks.PACKAGER); @@ -297,6 +298,7 @@ public class AllTileEntities { bind(SPEEDOMETER, GaugeRenderer::speed); bind(STRESSOMETER, GaugeRenderer::stress); bind(BASIN, BasinRenderer::new); + bind(HEATER, HeaterRenderer::new); bind(DEPLOYER, DeployerRenderer::new); bind(FLYWHEEL, FlywheelRenderer::new); bind(FURNACE_ENGINE, EngineRenderer::new); diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/mixer/MechanicalMixerTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/mixer/MechanicalMixerTileEntity.java index af4bd4f79..f74220a28 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/mixer/MechanicalMixerTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/mixer/MechanicalMixerTileEntity.java @@ -5,11 +5,13 @@ import java.util.LinkedList; import java.util.List; import com.simibubi.create.AllRecipeTypes; +import com.simibubi.create.AllTags; import com.simibubi.create.content.contraptions.components.press.MechanicalPressTileEntity; import com.simibubi.create.content.contraptions.fluids.CombinedFluidHandler; import com.simibubi.create.content.contraptions.processing.BasinOperatingTileEntity; import com.simibubi.create.content.contraptions.processing.BasinTileEntity.BasinInventory; import com.simibubi.create.content.contraptions.processing.CombinedItemFluidList; +import com.simibubi.create.content.contraptions.processing.HeaterTileEntity; import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour; import com.simibubi.create.foundation.tileEntity.behaviour.CenteredSideValueBoxTransform; import com.simibubi.create.foundation.tileEntity.behaviour.scrollvalue.ScrollValueBehaviour; @@ -24,6 +26,7 @@ import net.minecraft.item.crafting.Ingredient; import net.minecraft.nbt.CompoundNBT; import net.minecraft.particles.ItemParticleData; import net.minecraft.particles.ParticleTypes; +import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntityType; import net.minecraft.util.Direction.Axis; import net.minecraft.util.NonNullList; @@ -236,7 +239,7 @@ public class MechanicalMixerTileEntity extends BasinOperatingTileEntity { if (!(recipe instanceof MixingRecipe)) return true; - return true; + return ((MixingRecipe) recipe).getHeatLevelRequired() <= getHeatLevelApplied(); } @Override @@ -273,4 +276,13 @@ public class MechanicalMixerTileEntity extends BasinOperatingTileEntity { return running; } + private int getHeatLevelApplied() { + if (world == null) + return 0; + TileEntity te = world.getTileEntity(pos.down(3)); + if (!(te instanceof HeaterTileEntity)) + return AllTags.AllBlockTags.FAN_HEATERS.matches(world.getBlockState(pos.down(3))) ? 1 : 0; + return ((HeaterTileEntity) te).getHeatLevel(); + } + } diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/mixer/MixingRecipe.java b/src/main/java/com/simibubi/create/content/contraptions/components/mixer/MixingRecipe.java index 5b5e2d081..80aa7b53b 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/mixer/MixingRecipe.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/mixer/MixingRecipe.java @@ -94,4 +94,8 @@ public class MixingRecipe extends ProcessingRecipe { protected boolean requiresHeating() { return this.requiredHeat > 0; } + + public int getHeatLevelRequired() { + return requiredHeat; + } } 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 781b6fd99..b4ffbfdac 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 @@ -1,11 +1,56 @@ package com.simibubi.create.content.contraptions.processing; - +import com.simibubi.create.AllTileEntities; +import com.simibubi.create.foundation.block.ITE; +import mcp.MethodsReturnNonnullByDefault; import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.ActionResultType; +import net.minecraft.util.Hand; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.BlockRayTraceResult; +import net.minecraft.world.IBlockReader; +import net.minecraft.world.World; -public class HeaterBlock extends Block { +import javax.annotation.Nullable; +import javax.annotation.ParametersAreNonnullByDefault; - public HeaterBlock(Properties properties) { - super(properties); - } +@MethodsReturnNonnullByDefault +@ParametersAreNonnullByDefault +public class HeaterBlock extends Block implements ITE { + + public HeaterBlock(Properties properties) { + super(properties); + } + + @Override + public boolean hasTileEntity(BlockState state) { + return true; + } + + @Nullable + @Override + public TileEntity createTileEntity(BlockState state, IBlockReader world) { + return AllTileEntities.HEATER.create(); + } + + @Override + public Class getTileEntityClass() { + return HeaterTileEntity.class; + } + + @Override + public ActionResultType onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, + BlockRayTraceResult blockRayTraceResult) { + TileEntity te = world.getTileEntity(pos); + if (te instanceof HeaterTileEntity && ((HeaterTileEntity) te).tryUpdateFuel(player.getHeldItem(hand))) { + if (!player.isCreative()) + player.getHeldItem(hand) + .shrink(1); + return ActionResultType.SUCCESS; + } + return ActionResultType.PASS; + } } diff --git a/src/main/java/com/simibubi/create/content/contraptions/processing/HeaterRenderer.java b/src/main/java/com/simibubi/create/content/contraptions/processing/HeaterRenderer.java new file mode 100644 index 000000000..b3bf13311 --- /dev/null +++ b/src/main/java/com/simibubi/create/content/contraptions/processing/HeaterRenderer.java @@ -0,0 +1,53 @@ +package com.simibubi.create.content.contraptions.processing; + +import com.mojang.blaze3d.matrix.MatrixStack; +import com.simibubi.create.AllBlockPartials; +import com.simibubi.create.foundation.tileEntity.renderer.SafeTileEntityRenderer; +import com.simibubi.create.foundation.utility.SuperByteBuffer; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.IRenderTypeBuffer; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.Vector3f; +import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; +import net.minecraft.util.Direction; + +public class HeaterRenderer extends SafeTileEntityRenderer { + private static final Minecraft INSTANCE = Minecraft.getInstance(); + + public HeaterRenderer(TileEntityRendererDispatcher dispatcher) { + super(dispatcher); + } + + @Override + protected void renderSafe(HeaterTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer, + int light, int overlay) { + AllBlockPartials blazeModel; + switch (te.getHeatLevel()) { + case 2: + blazeModel = AllBlockPartials.BLAZE_HEATER_BLAZE_TWO; + break; + case 3: + blazeModel = AllBlockPartials.BLAZE_HEATER_BLAZE_THREE; + break; + case 4: + blazeModel = AllBlockPartials.BLAZE_HEATER_BLAZE_FOUR; + break; + default: + blazeModel = AllBlockPartials.BLAZE_HEATER_BLAZE_ONE; + } + Vector3f difference = new Vector3f(INSTANCE.player.getPositionVector() + .subtract(te.getPos() + .getX() + 0.5, 0, + te.getPos() + .getZ() + 0.5) + .mul(1, 0, 1)); + difference.normalize(); + + SuperByteBuffer blazeBuffer = blazeModel.renderOn(te.getBlockState()); + blazeBuffer.rotateCentered(Direction.UP, + (float) ((difference.getX() < 0 ? 1 : -1) * Math.acos(Direction.NORTH.getUnitVector() + .dot(difference)))); + blazeBuffer.renderInto(ms, buffer.getBuffer(RenderType.getSolid())); + } +} 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 new file mode 100644 index 000000000..8cc05bae8 --- /dev/null +++ b/src/main/java/com/simibubi/create/content/contraptions/processing/HeaterTileEntity.java @@ -0,0 +1,91 @@ +package com.simibubi.create.content.contraptions.processing; + +import java.util.List; + +import com.simibubi.create.AllItems; +import com.simibubi.create.foundation.tileEntity.SmartTileEntity; +import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour; + +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.CompoundNBT; +import net.minecraft.tileentity.TileEntityType; +import net.minecraftforge.common.ForgeHooks; + +public class HeaterTileEntity extends SmartTileEntity { + + int fuelLevel; + private int burnTimeRemaining; + private int bufferedHeatLevel; + + public HeaterTileEntity(TileEntityType tileEntityTypeIn) { + super(tileEntityTypeIn); + fuelLevel = 0; + burnTimeRemaining = 0; + bufferedHeatLevel = 1; + } + + @Override + public void tick() { + super.tick(); + if (burnTimeRemaining > 0) { + burnTimeRemaining--; + if (burnTimeRemaining == 0 && fuelLevel > 0) { + fuelLevel--; + sendData(); + } + markDirty(); + } + } + + @Override + public void lazyTick() { + super.lazyTick(); + updateHeatLevel(); + } + + @Override + public void addBehaviours(List behaviours) {} + + @Override + public CompoundNBT write(CompoundNBT compound) { + compound.putInt("fuelLevel", fuelLevel); + compound.putInt("burnTimeRemaining", burnTimeRemaining); + return super.write(compound); + } + + @Override + public void read(CompoundNBT compound) { + fuelLevel = compound.getInt("fuelLevel"); + burnTimeRemaining = compound.getInt("burnTimeRemaining"); + super.read(compound); + if (fuelLevel == 0) { + burnTimeRemaining = 0; + markDirty(); + } + } + + boolean tryUpdateFuel(ItemStack itemStack) { + int burnTime = itemStack.getItem() + .getBurnTime(itemStack); + int newFuelLevel = 1; // todo: int newFuelLevel = itemStack.getItem() == AllItems.SUPER_SPECIAL_FUEL.get() ? 2 : 1; + if (burnTime == -1) + burnTime = ForgeHooks.getBurnTime(itemStack); + if (burnTime < burnTimeRemaining && newFuelLevel <= fuelLevel) + return false; + burnTimeRemaining = burnTime; + fuelLevel = newFuelLevel; + updateHeatLevel(); + return true; + } + + public int getHeatLevel() { + return bufferedHeatLevel; + } + + private void updateHeatLevel() { + bufferedHeatLevel = 1 + fuelLevel; + // todo: check for fan + markDirty(); + sendData(); + } +} diff --git a/src/main/resources/assets/create/models/block/blaze_heater/blaze/four.json b/src/main/resources/assets/create/models/block/blaze_heater/blaze/four.json new file mode 100644 index 000000000..cc0f8c54f --- /dev/null +++ b/src/main/resources/assets/create/models/block/blaze_heater/blaze/four.json @@ -0,0 +1,29 @@ +{ + "credit": "Made with Blockbench", + "textures": { + "1": "create:block/tamed_blaze" + }, + "elements": [ + { + "name": "Blaze 4", + "from": [4, 6, 4], + "to": [12, 14, 12], + "rotation": {"angle": 0, "axis": "y", "origin": [6, 6, 6]}, + "faces": { + "north": {"uv": [12, 0, 16, 4], "texture": "#1"}, + "east": {"uv": [8, 0, 12, 4], "texture": "#1"}, + "south": {"uv": [8, 0, 12, 4], "texture": "#1"}, + "west": {"uv": [8, 0, 12, 4], "texture": "#1"}, + "up": {"uv": [8, 4, 12, 8], "texture": "#1"}, + "down": {"uv": [12, 4, 16, 8], "texture": "#1"} + } + } + ], + "groups": [ + { + "name": "Blazes", + "origin": [8, 8, 8], + "children": [15, 16, 17, 18] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/blaze_heater/blaze/one.json b/src/main/resources/assets/create/models/block/blaze_heater/blaze/one.json new file mode 100644 index 000000000..b0b318ff6 --- /dev/null +++ b/src/main/resources/assets/create/models/block/blaze_heater/blaze/one.json @@ -0,0 +1,28 @@ +{ + "credit": "Made with Blockbench", + "textures": { + "1": "create:block/tamed_blaze" + }, + "elements": [ + { + "name": "Blaze 1", + "from": [6, 6, 6], + "to": [10, 10, 10], + "faces": { + "north": {"uv": [8, 8, 10, 10], "texture": "#1"}, + "east": {"uv": [6, 8, 8, 10], "texture": "#1"}, + "south": {"uv": [6, 8, 8, 10], "texture": "#1"}, + "west": {"uv": [6, 8, 8, 10], "texture": "#1"}, + "up": {"uv": [6, 10, 8, 12], "texture": "#1"}, + "down": {"uv": [8, 10, 10, 12], "texture": "#1"} + } + } + ], + "groups": [ + { + "name": "Blazes", + "origin": [8, 8, 8], + "children": [15, 16, 17, 18] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/blaze_heater/blaze/three.json b/src/main/resources/assets/create/models/block/blaze_heater/blaze/three.json new file mode 100644 index 000000000..a9d78104f --- /dev/null +++ b/src/main/resources/assets/create/models/block/blaze_heater/blaze/three.json @@ -0,0 +1,29 @@ +{ + "credit": "Made with Blockbench", + "textures": { + "1": "create:block/tamed_blaze" + }, + "elements": [ + { + "name": "Blaze 3", + "from": [4, 6, 4], + "to": [12, 14, 12], + "rotation": {"angle": 0, "axis": "y", "origin": [6, 6, 6]}, + "faces": { + "north": {"uv": [4, 0, 8, 4], "texture": "#1"}, + "east": {"uv": [0, 0, 4, 4], "texture": "#1"}, + "south": {"uv": [0, 0, 4, 4], "texture": "#1"}, + "west": {"uv": [0, 0, 4, 4], "texture": "#1"}, + "up": {"uv": [0, 4, 4, 8], "texture": "#1"}, + "down": {"uv": [4, 4, 8, 8], "texture": "#1"} + } + } + ], + "groups": [ + { + "name": "Blazes", + "origin": [8, 8, 8], + "children": [15, 16, 17, 18] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/blaze_heater/blaze/two.json b/src/main/resources/assets/create/models/block/blaze_heater/blaze/two.json new file mode 100644 index 000000000..ab5e5aea4 --- /dev/null +++ b/src/main/resources/assets/create/models/block/blaze_heater/blaze/two.json @@ -0,0 +1,29 @@ +{ + "credit": "Made with Blockbench", + "textures": { + "1": "create:block/tamed_blaze" + }, + "elements": [ + { + "name": "Blaze 2", + "from": [5, 6, 5], + "to": [11, 12, 11], + "rotation": {"angle": 0, "axis": "y", "origin": [7, 7, 7]}, + "faces": { + "north": {"uv": [3, 8, 6, 11], "texture": "#1"}, + "east": {"uv": [0, 8, 3, 11], "texture": "#1"}, + "south": {"uv": [0, 8, 3, 11], "texture": "#1"}, + "west": {"uv": [0, 8, 3, 11], "texture": "#1"}, + "up": {"uv": [0, 11, 3, 14], "texture": "#1"}, + "down": {"uv": [3, 11, 6, 14], "texture": "#1"} + } + } + ], + "groups": [ + { + "name": "Blazes", + "origin": [8, 8, 8], + "children": [15, 16, 17, 18] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/create/textures/block/tamed_blaze.png b/src/main/resources/assets/create/textures/block/tamed_blaze.png new file mode 100644 index 000000000..ba3918be1 Binary files /dev/null and b/src/main/resources/assets/create/textures/block/tamed_blaze.png differ diff --git a/src/main/resources/data/create/recipes/mixing/brass_ingot.json b/src/main/resources/data/create/recipes/mixing/brass_ingot.json index cf03e301b..6b06a9e03 100644 --- a/src/main/resources/data/create/recipes/mixing/brass_ingot.json +++ b/src/main/resources/data/create/recipes/mixing/brass_ingot.json @@ -16,5 +16,6 @@ "item": "create:brass_ingot", "count": 2 } - ] + ], + "requiredHeat": 1 } \ No newline at end of file