mirror of
https://github.com/Jozufozu/Flywheel.git
synced 2024-12-24 14:06:29 +01:00
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:
parent
ae785b5a66
commit
12595490c7
16 changed files with 385 additions and 79 deletions
|
@ -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
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"create:blaze_heater"
|
||||
]
|
||||
}
|
|
@ -28,77 +28,53 @@ public class AllBlockPartials {
|
|||
|
||||
private static List<AllBlockPartials> 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_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"),
|
||||
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"),
|
||||
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<Direction, AllBlockPartials> 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) {
|
||||
|
|
|
@ -398,12 +398,13 @@ public class AllBlocks {
|
|||
.register();
|
||||
|
||||
public static final BlockEntry<HeaterBlock> 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<DepotBlock> DEPOT = REGISTRATE.block("depot", DepotBlock::new)
|
||||
.initialProperties(SharedProperties::stone)
|
||||
|
|
|
@ -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<BasinTileEntity> 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 =
|
||||
register("mechanical_crafter", MechanicalCrafterTileEntity::new, AllBlocks.MECHANICAL_CRAFTER);
|
||||
public static final TileEntityEntry<SequencedGearshiftTileEntity> SEQUENCED_GEARSHIFT =
|
||||
|
@ -227,9 +228,9 @@ public class AllTileEntities {
|
|||
|
||||
public static final TileEntityEntry<DepotTileEntity> DEPOT =
|
||||
register("depot", DepotTileEntity::new, AllBlocks.DEPOT);
|
||||
public static final TileEntityEntry<FunnelTileEntity> 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<FunnelTileEntity> 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<PackagerTileEntity> 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);
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -94,4 +94,8 @@ public class MixingRecipe extends ProcessingRecipe<BasinInputInventory> {
|
|||
protected boolean requiresHeating() {
|
||||
return this.requiredHeat > 0;
|
||||
}
|
||||
|
||||
public int getHeatLevelRequired() {
|
||||
return requiredHeat;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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()));
|
||||
}
|
||||
}
|
|
@ -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();
|
||||
}
|
||||
}
|
|
@ -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]
|
||||
}
|
||||
]
|
||||
}
|
|
@ -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]
|
||||
}
|
||||
]
|
||||
}
|
|
@ -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]
|
||||
}
|
||||
]
|
||||
}
|
|
@ -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]
|
||||
}
|
||||
]
|
||||
}
|
BIN
src/main/resources/assets/create/textures/block/tamed_blaze.png
Normal file
BIN
src/main/resources/assets/create/textures/block/tamed_blaze.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.5 KiB |
|
@ -16,5 +16,6 @@
|
|||
"item": "create:brass_ingot",
|
||||
"count": 2
|
||||
}
|
||||
]
|
||||
],
|
||||
"requiredHeat": 1
|
||||
}
|
Loading…
Reference in a new issue