Heater functionality:

- Heated Mixing: Mixing can now require the player to heat the basin (with either the usual fan heaters for a heat level of 1 or the blaze heater for higher heat levels)
- Made mixing brass ingots from copper and zinc ingots require heating (as example)
- added the blaze heater to valid fan heaters
- added TE renderer for fan heater to display a blaze head always facing the player
- added fueling of blaze heater with furnace fuel (onUse event, not with inventory to challenge the automation. To be discussed.)

todo:
- add heat requirement display to JEI
- better item model for blaze heater
- new special fuel for higher heat levels
- fan stoking
This commit is contained in:
LordGrimmauld 2020-07-12 13:13:43 +02:00
parent ae785b5a66
commit 12595490c7
16 changed files with 385 additions and 79 deletions

View file

@ -2479,6 +2479,7 @@ d3fdb8ece6cb072a93ddb64a0baad5ac952117a4 data\create\recipes\weathered_limestone
11667414f73bc2d00bda7c5c1a7d2934bf6e9165 data\create\recipes\weathered_limestone_pillar_from_weathered_limestone_stonecutting.json 11667414f73bc2d00bda7c5c1a7d2934bf6e9165 data\create\recipes\weathered_limestone_pillar_from_weathered_limestone_stonecutting.json
266f08e604d229a9d2b46f7272c0b06ec270bf3d data\create\recipes\zinc_block.json 266f08e604d229a9d2b46f7272c0b06ec270bf3d data\create\recipes\zinc_block.json
403576ae5710d4fe731144fe623b1673093076ea data\create\tags\blocks\brittle.json 403576ae5710d4fe731144fe623b1673093076ea data\create\tags\blocks\brittle.json
06d3931993d4f61713390416f1e6fe1a0b5aaf43 data\create\tags\blocks\fan_heaters.json
081f5aa35602fc27af2ca01ea9f2fd5e7eb284dc data\create\tags\items\create_ingots.json 081f5aa35602fc27af2ca01ea9f2fd5e7eb284dc data\create\tags\items\create_ingots.json
d2dc4ff179ef7b2aa9276455c196e15d44aa95a8 data\create\tags\items\crushed_ores.json d2dc4ff179ef7b2aa9276455c196e15d44aa95a8 data\create\tags\items\crushed_ores.json
16bcb8fcbe9170c2c11f1ca8d99d8b36cd812bbd data\forge\tags\blocks\glass\colorless.json 16bcb8fcbe9170c2c11f1ca8d99d8b36cd812bbd data\forge\tags\blocks\glass\colorless.json

View file

@ -0,0 +1,6 @@
{
"replace": false,
"values": [
"create:blaze_heater"
]
}

View file

@ -28,77 +28,53 @@ public class AllBlockPartials {
private static List<AllBlockPartials> all = new ArrayList<>(); private static List<AllBlockPartials> all = new ArrayList<>();
public static final AllBlockPartials public static final AllBlockPartials SCHEMATICANNON_CONNECTOR = get("schematicannon/connector"),
SCHEMATICANNON_CONNECTOR = get("schematicannon/connector"),
SCHEMATICANNON_PIPE = get("schematicannon/pipe"), SCHEMATICANNON_PIPE = get("schematicannon/pipe"),
SHAFTLESS_COGWHEEL = get("cogwheel_shaftless"), SHAFTLESS_COGWHEEL = get("cogwheel_shaftless"), BELT_PULLEY = get("belt_pulley"),
BELT_PULLEY = get("belt_pulley"),
SHAFT_HALF = get("shaft_half"), SHAFT_HALF = get("shaft_half"),
ENCASED_FAN_INNER = get("encased_fan/propeller"), ENCASED_FAN_INNER = get("encased_fan/propeller"), HAND_CRANK_HANDLE = get("hand_crank/handle"),
HAND_CRANK_HANDLE = get("hand_crank/handle"), MECHANICAL_PRESS_HEAD = get("mechanical_press/head"), MECHANICAL_MIXER_POLE = get("mechanical_mixer/pole"),
MECHANICAL_PRESS_HEAD = get("mechanical_press/head"), MECHANICAL_MIXER_HEAD = get("mechanical_mixer/head"), BLAZE_HEATER_BLAZE_ONE = get("blaze_heater/blaze/one"),
MECHANICAL_MIXER_POLE = get("mechanical_mixer/pole"), BLAZE_HEATER_BLAZE_TWO = get("blaze_heater/blaze/two"),
MECHANICAL_MIXER_HEAD = get("mechanical_mixer/head"), 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_LID = get("mechanical_crafter/lid"),
MECHANICAL_CRAFTER_ARROW = get("mechanical_crafter/arrow"), MECHANICAL_CRAFTER_ARROW = get("mechanical_crafter/arrow"),
MECHANICAL_CRAFTER_BELT_FRAME = get("mechanical_crafter/belt"), MECHANICAL_CRAFTER_BELT_FRAME = get("mechanical_crafter/belt"),
MECHANICAL_CRAFTER_BELT = get("mechanical_crafter/belt_animated"), MECHANICAL_CRAFTER_BELT = get("mechanical_crafter/belt_animated"), GAUGE_DIAL = get("gauge/dial"),
GAUGE_DIAL = get("gauge/dial"), GAUGE_INDICATOR = get("gauge/indicator"), GAUGE_HEAD_SPEED = get("gauge/speedometer/head"),
GAUGE_INDICATOR = get("gauge/indicator"), GAUGE_HEAD_STRESS = get("gauge/stressometer/head"), BEARING_TOP = get("bearing/top"),
GAUGE_HEAD_SPEED = get("gauge/speedometer/head"), DRILL_HEAD = get("mechanical_drill/head"), HARVESTER_BLADE = get("mechanical_harvester/blade"),
GAUGE_HEAD_STRESS = get("gauge/stressometer/head"), DEPLOYER_POLE = get("deployer/pole"), DEPLOYER_HAND_POINTING = get("deployer/hand_pointing"),
BEARING_TOP = get("bearing/top"), DEPLOYER_HAND_PUNCHING = get("deployer/hand_punching"), DEPLOYER_HAND_HOLDING = get("deployer/hand_holding"),
DRILL_HEAD = get("mechanical_drill/head"), ANALOG_LEVER_HANDLE = get("analog_lever/handle"), ANALOG_LEVER_INDICATOR = get("analog_lever/indicator"),
HARVESTER_BLADE = get("mechanical_harvester/blade"), BELT_FUNNEL_FLAP = get("belt_funnel/flap"), BELT_TUNNEL_FLAP = get("belt_tunnel/flap"),
DEPLOYER_POLE = get("deployer/pole"), BELT_TUNNEL_INDICATOR = get("belt_tunnel/indicator"), FLEXPEATER_INDICATOR = get("diodes/indicator"),
DEPLOYER_HAND_POINTING = get("deployer/hand_pointing"), FLYWHEEL = get("flywheel/wheel"), FLYWHEEL_UPPER_ROTATING = get("flywheel/upper_rotating_connector"),
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_LOWER_ROTATING = get("flywheel/lower_rotating_connector"),
FLYWHEEL_UPPER_SLIDING = get("flywheel/upper_sliding_connector"), FLYWHEEL_UPPER_SLIDING = get("flywheel/upper_sliding_connector"),
FLYWHEEL_LOWER_SLIDING = get("flywheel/lower_sliding_connector"), FLYWHEEL_LOWER_SLIDING = get("flywheel/lower_sliding_connector"),
FURNACE_GENERATOR_FRAME = get("furnace_engine/frame"), FURNACE_GENERATOR_FRAME = get("furnace_engine/frame"), CUCKOO_MINUTE_HAND = get("cuckoo_clock/minute_hand"),
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_HOUR_HAND = get("cuckoo_clock/hour_hand"), CUCKOO_RIGHT_DOOR = get("cuckoo_clock/right_door"), CUCKOO_PIG = get("cuckoo_clock/pig"),
CUCKOO_LEFT_DOOR = get("cuckoo_clock/left_door"), CUCKOO_CREEPER = get("cuckoo_clock/creeper"), ROPE_COIL = get("rope_pulley/rope_coil"),
CUCKOO_RIGHT_DOOR = get("cuckoo_clock/right_door"), ROPE_HALF = get("rope_pulley/rope_half"), ROPE_HALF_MAGNET = get("rope_pulley/rope_half_magnet"),
CUCKOO_PIG = get("cuckoo_clock/pig"), MILLSTONE_COG = get("millstone/inner"), PACKAGER_SEALER = get("packager/sealer"),
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_PLANE = get("symmetry_effect/plane"), SYMMETRY_CROSSPLANE = get("symmetry_effect/crossplane"),
SYMMETRY_CROSSPLANE = get("symmetry_effect/crossplane"),
SYMMETRY_TRIPLEPLANE = get("symmetry_effect/tripleplane"), SYMMETRY_TRIPLEPLANE = get("symmetry_effect/tripleplane"),
ARM_COG = get("mechanical_arm/cog"), ARM_COG = get("mechanical_arm/cog"), ARM_BASE = get("mechanical_arm/base"),
ARM_BASE = get("mechanical_arm/base"), ARM_LOWER_BODY = get("mechanical_arm/lower_body"), ARM_UPPER_BODY = get("mechanical_arm/upper_body"),
ARM_LOWER_BODY = get("mechanical_arm/lower_body"), ARM_HEAD = get("mechanical_arm/head"), ARM_CLAW_BASE = get("mechanical_arm/claw_base"),
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"), ARM_CLAW_GRIP = get("mechanical_arm/claw_grip"),
FLAG_SHORT_IN = get("mechanical_arm/flag/short_in"), FLAG_SHORT_IN = get("mechanical_arm/flag/short_in"), FLAG_SHORT_OUT = get("mechanical_arm/flag/short_out"),
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"),
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_ARROW = get("mechanical_pump/arrow"), MECHANICAL_PUMP_COG = get("mechanical_pump/cog"),
MECHANICAL_PUMP_COG = get("mechanical_pump/cog"),
FLUID_PIPE_CASING = get("fluid_pipe/casing"); FLUID_PIPE_CASING = get("fluid_pipe/casing");
public static final Map<Direction, AllBlockPartials> PIPE_RIMS = map(); public static final Map<Direction, AllBlockPartials> PIPE_RIMS = map();
@ -114,8 +90,7 @@ public class AllBlockPartials {
private ResourceLocation modelLocation; private ResourceLocation modelLocation;
private IBakedModel bakedModel; private IBakedModel bakedModel;
private AllBlockPartials() { private AllBlockPartials() {}
}
private static void populateMaps() { private static void populateMaps() {
for (Direction d : Iterate.directions) { for (Direction d : Iterate.directions) {

View file

@ -398,12 +398,13 @@ public class AllBlocks {
.register(); .register();
public static final BlockEntry<HeaterBlock> HEATER = REGISTRATE.block("blaze_heater", HeaterBlock::new) public static final BlockEntry<HeaterBlock> HEATER = REGISTRATE.block("blaze_heater", HeaterBlock::new)
.initialProperties(SharedProperties::softMetal) .initialProperties(SharedProperties::softMetal)
.properties(p -> p.lightValue(12)) .properties(p -> p.lightValue(12))
.addLayer(() -> RenderType::getCutoutMipped) .tag(AllBlockTags.FAN_HEATERS.tag)
.blockstate((c, p) -> p.simpleBlock(c.getEntry(), AssetLookup.partialBaseModel(c, p))) .addLayer(() -> RenderType::getCutoutMipped)
.simpleItem() .blockstate((c, p) -> p.simpleBlock(c.getEntry(), AssetLookup.partialBaseModel(c, p)))
.register(); .simpleItem()
.register();
public static final BlockEntry<DepotBlock> DEPOT = REGISTRATE.block("depot", DepotBlock::new) public static final BlockEntry<DepotBlock> DEPOT = REGISTRATE.block("depot", DepotBlock::new)
.initialProperties(SharedProperties::stone) .initialProperties(SharedProperties::stone)

View file

@ -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.FluidTankTileEntity;
import com.simibubi.create.content.contraptions.fluids.PumpRenderer; import com.simibubi.create.content.contraptions.fluids.PumpRenderer;
import com.simibubi.create.content.contraptions.fluids.PumpTileEntity; import com.simibubi.create.content.contraptions.fluids.PumpTileEntity;
import com.simibubi.create.content.contraptions.processing.BasinRenderer; import com.simibubi.create.content.contraptions.processing.*;
import com.simibubi.create.content.contraptions.processing.BasinTileEntity;
import com.simibubi.create.content.contraptions.relays.advanced.SpeedControllerRenderer; 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.SpeedControllerTileEntity;
import com.simibubi.create.content.contraptions.relays.advanced.sequencer.SequencedGearshiftTileEntity; import com.simibubi.create.content.contraptions.relays.advanced.sequencer.SequencedGearshiftTileEntity;
@ -198,6 +197,8 @@ public class AllTileEntities {
register("deployer", DeployerTileEntity::new, AllBlocks.DEPLOYER); register("deployer", DeployerTileEntity::new, AllBlocks.DEPLOYER);
public static final TileEntityEntry<BasinTileEntity> BASIN = public static final TileEntityEntry<BasinTileEntity> BASIN =
register("basin", BasinTileEntity::new, AllBlocks.BASIN); register("basin", BasinTileEntity::new, AllBlocks.BASIN);
public static final TileEntityEntry<HeaterTileEntity> HEATER =
register("blaze_heater", HeaterTileEntity::new, AllBlocks.HEATER);
public static final TileEntityEntry<MechanicalCrafterTileEntity> MECHANICAL_CRAFTER = public static final TileEntityEntry<MechanicalCrafterTileEntity> MECHANICAL_CRAFTER =
register("mechanical_crafter", MechanicalCrafterTileEntity::new, AllBlocks.MECHANICAL_CRAFTER); register("mechanical_crafter", MechanicalCrafterTileEntity::new, AllBlocks.MECHANICAL_CRAFTER);
public static final TileEntityEntry<SequencedGearshiftTileEntity> SEQUENCED_GEARSHIFT = public static final TileEntityEntry<SequencedGearshiftTileEntity> SEQUENCED_GEARSHIFT =
@ -227,9 +228,9 @@ public class AllTileEntities {
public static final TileEntityEntry<DepotTileEntity> DEPOT = public static final TileEntityEntry<DepotTileEntity> DEPOT =
register("depot", DepotTileEntity::new, AllBlocks.DEPOT); register("depot", DepotTileEntity::new, AllBlocks.DEPOT);
public static final TileEntityEntry<FunnelTileEntity> FUNNEL = register("funnel", public static final TileEntityEntry<FunnelTileEntity> FUNNEL = register("funnel", FunnelTileEntity::new,
FunnelTileEntity::new, AllBlocks.BRASS_FUNNEL, AllBlocks.BRASS_BELT_FUNNEL, AllBlocks.BRASS_CHUTE_FUNNEL, AllBlocks.BRASS_FUNNEL, AllBlocks.BRASS_BELT_FUNNEL, AllBlocks.BRASS_CHUTE_FUNNEL, AllBlocks.ANDESITE_FUNNEL,
AllBlocks.ANDESITE_FUNNEL, AllBlocks.ANDESITE_BELT_FUNNEL, AllBlocks.ANDESITE_CHUTE_FUNNEL); AllBlocks.ANDESITE_BELT_FUNNEL, AllBlocks.ANDESITE_CHUTE_FUNNEL);
public static final TileEntityEntry<PackagerTileEntity> PACKAGER = public static final TileEntityEntry<PackagerTileEntity> PACKAGER =
register("packager", PackagerTileEntity::new, AllBlocks.PACKAGER); register("packager", PackagerTileEntity::new, AllBlocks.PACKAGER);
@ -297,6 +298,7 @@ public class AllTileEntities {
bind(SPEEDOMETER, GaugeRenderer::speed); bind(SPEEDOMETER, GaugeRenderer::speed);
bind(STRESSOMETER, GaugeRenderer::stress); bind(STRESSOMETER, GaugeRenderer::stress);
bind(BASIN, BasinRenderer::new); bind(BASIN, BasinRenderer::new);
bind(HEATER, HeaterRenderer::new);
bind(DEPLOYER, DeployerRenderer::new); bind(DEPLOYER, DeployerRenderer::new);
bind(FLYWHEEL, FlywheelRenderer::new); bind(FLYWHEEL, FlywheelRenderer::new);
bind(FURNACE_ENGINE, EngineRenderer::new); bind(FURNACE_ENGINE, EngineRenderer::new);

View file

@ -5,11 +5,13 @@ import java.util.LinkedList;
import java.util.List; import java.util.List;
import com.simibubi.create.AllRecipeTypes; 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.components.press.MechanicalPressTileEntity;
import com.simibubi.create.content.contraptions.fluids.CombinedFluidHandler; import com.simibubi.create.content.contraptions.fluids.CombinedFluidHandler;
import com.simibubi.create.content.contraptions.processing.BasinOperatingTileEntity; import com.simibubi.create.content.contraptions.processing.BasinOperatingTileEntity;
import com.simibubi.create.content.contraptions.processing.BasinTileEntity.BasinInventory; import com.simibubi.create.content.contraptions.processing.BasinTileEntity.BasinInventory;
import com.simibubi.create.content.contraptions.processing.CombinedItemFluidList; 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.TileEntityBehaviour;
import com.simibubi.create.foundation.tileEntity.behaviour.CenteredSideValueBoxTransform; import com.simibubi.create.foundation.tileEntity.behaviour.CenteredSideValueBoxTransform;
import com.simibubi.create.foundation.tileEntity.behaviour.scrollvalue.ScrollValueBehaviour; 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.nbt.CompoundNBT;
import net.minecraft.particles.ItemParticleData; import net.minecraft.particles.ItemParticleData;
import net.minecraft.particles.ParticleTypes; import net.minecraft.particles.ParticleTypes;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityType; import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.Direction.Axis; import net.minecraft.util.Direction.Axis;
import net.minecraft.util.NonNullList; import net.minecraft.util.NonNullList;
@ -236,7 +239,7 @@ public class MechanicalMixerTileEntity extends BasinOperatingTileEntity {
if (!(recipe instanceof MixingRecipe)) if (!(recipe instanceof MixingRecipe))
return true; return true;
return true; return ((MixingRecipe) recipe).getHeatLevelRequired() <= getHeatLevelApplied();
} }
@Override @Override
@ -273,4 +276,13 @@ public class MechanicalMixerTileEntity extends BasinOperatingTileEntity {
return running; 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();
}
} }

View file

@ -94,4 +94,8 @@ public class MixingRecipe extends ProcessingRecipe<BasinInputInventory> {
protected boolean requiresHeating() { protected boolean requiresHeating() {
return this.requiredHeat > 0; return this.requiredHeat > 0;
} }
public int getHeatLevelRequired() {
return requiredHeat;
}
} }

View file

@ -1,11 +1,56 @@
package com.simibubi.create.content.contraptions.processing; 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.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) { @MethodsReturnNonnullByDefault
super(properties); @ParametersAreNonnullByDefault
} public class HeaterBlock extends Block implements ITE<HeaterTileEntity> {
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<HeaterTileEntity> 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;
}
} }

View file

@ -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<HeaterTileEntity> {
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()));
}
}

View file

@ -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<? extends HeaterTileEntity> 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<TileEntityBehaviour> 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();
}
}

View file

@ -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]
}
]
}

View file

@ -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]
}
]
}

View file

@ -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]
}
]
}

View file

@ -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]
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View file

@ -16,5 +16,6 @@
"item": "create:brass_ingot", "item": "create:brass_ingot",
"count": 2 "count": 2
} }
] ],
"requiredHeat": 1
} }