ponder and rest boilers

This commit is contained in:
yuesha-yc 2021-10-24 02:26:16 -07:00
parent b3a2316db9
commit 0c151f864e
No known key found for this signature in database
GPG key ID: 009D79A802D4ED01
16 changed files with 307 additions and 1 deletions

View file

@ -0,0 +1,17 @@
package com.teammoeg.steampowered.content.boiler;
import com.teammoeg.steampowered.registrate.SPTiles;
import net.minecraft.block.BlockState;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader;
public class CastIronBoilerBlock extends BoilerBlock {
public CastIronBoilerBlock(Properties properties) {
super(properties);
}
@Override
public TileEntity createTileEntity(BlockState state, IBlockReader world) {
return SPTiles.CAST_IRON_BOILER.create();
}
}

View file

@ -0,0 +1,15 @@
package com.teammoeg.steampowered.content.boiler;
import net.minecraft.tileentity.TileEntityType;
public class CastIronBoilerTileEntity extends BoilerTileEntity {
public CastIronBoilerTileEntity(TileEntityType<?> type) {
super(type);
}
protected int getHUPerTick() {
return 240;
}
}

View file

@ -0,0 +1,17 @@
package com.teammoeg.steampowered.content.boiler;
import com.teammoeg.steampowered.registrate.SPTiles;
import net.minecraft.block.BlockState;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader;
public class SteelBoilerBlock extends BoilerBlock {
public SteelBoilerBlock(Properties properties) {
super(properties);
}
@Override
public TileEntity createTileEntity(BlockState state, IBlockReader world) {
return SPTiles.STEEL_BOILER.create();
}
}

View file

@ -0,0 +1,15 @@
package com.teammoeg.steampowered.content.boiler;
import net.minecraft.tileentity.TileEntityType;
public class SteelBoilerTileEntity extends BoilerTileEntity {
public SteelBoilerTileEntity(TileEntityType<?> type) {
super(type);
}
protected int getHUPerTick() {
return 480;
}
}

View file

@ -7,10 +7,13 @@ import net.minecraft.item.crafting.IRecipeType;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.network.NetworkManager;
import net.minecraft.network.play.server.SUpdateTileEntityPacket;
import net.minecraft.particles.ParticleTypes;
import net.minecraft.tileentity.ITickableTileEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.Direction;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.SoundEvents;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.util.text.TranslationTextComponent;
@ -102,6 +105,27 @@ public abstract class BurnerTileEntity extends TileEntity implements ITickableTi
@Override
public void tick() {
if (level != null && level.isClientSide) {
BlockState state = this.level.getBlockState(this.worldPosition);
if (state.getValue(BurnerBlock.LIT)) {
double d0 = (double)getBlockPos().getX() + 0.5D;
double d1 = (double)getBlockPos().getY();
double d2 = (double)getBlockPos().getZ() + 0.5D;
if (this.level.getRandom().nextDouble() < 0.1D) {
this.level.playLocalSound(d0, d1, d2, SoundEvents.FURNACE_FIRE_CRACKLE, SoundCategory.BLOCKS, 1.0F, 1.0F, false);
}
Direction direction = state.getValue(BurnerBlock.FACING);
Direction.Axis direction$axis = direction.getAxis();
double d3 = 0.52D;
double d4 = this.level.getRandom().nextDouble() * 0.6D - 0.3D;
double d5 = direction$axis == Direction.Axis.X ? (double)direction.getStepX() * 0.52D : d4;
double d6 = this.level.getRandom().nextDouble() * 6.0D / 16.0D;
double d7 = direction$axis == Direction.Axis.Z ? (double)direction.getStepZ() * 0.52D : d4;
this.level.addParticle(ParticleTypes.SMOKE, d0 + d5, d1 + d6, d2 + d7, 0.0D, 0.0D, 0.0D);
this.level.addParticle(ParticleTypes.FLAME, d0 + d5, d1 + d6, d2 + d7, 0.0D, 0.0D, 0.0D);
}
}
if (level != null && !level.isClientSide) {
BlockState state = this.level.getBlockState(this.worldPosition);
int emit = getHuPerTick();

View file

@ -0,0 +1,17 @@
package com.teammoeg.steampowered.content.burner;
import com.teammoeg.steampowered.registrate.SPTiles;
import net.minecraft.block.BlockState;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader;
public class CastIronBurnerBlock extends BurnerBlock {
public CastIronBurnerBlock(Properties properties) {
super(properties);
}
@Override
public TileEntity createTileEntity(BlockState state, IBlockReader world) {
return SPTiles.CAST_IRON_BURNER.create();
}
}

View file

@ -0,0 +1,15 @@
package com.teammoeg.steampowered.content.burner;
import net.minecraft.tileentity.TileEntityType;
public class CastIronBurnerTileEntity extends BurnerTileEntity {
public CastIronBurnerTileEntity(TileEntityType<?> type) {
super(type);
}
@Override
protected int getHuPerTick() {
return 240;
}
}

View file

@ -0,0 +1,17 @@
package com.teammoeg.steampowered.content.burner;
import com.teammoeg.steampowered.registrate.SPTiles;
import net.minecraft.block.BlockState;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader;
public class SteelBurnerBlock extends BurnerBlock {
public SteelBurnerBlock(Properties properties) {
super(properties);
}
@Override
public TileEntity createTileEntity(BlockState state, IBlockReader world) {
return SPTiles.STEEL_BURNER.create();
}
}

View file

@ -0,0 +1,15 @@
package com.teammoeg.steampowered.content.burner;
import net.minecraft.tileentity.TileEntityType;
public class SteelBurnerTileEntity extends BurnerTileEntity {
public SteelBurnerTileEntity(TileEntityType<?> type) {
super(type);
}
@Override
protected int getHuPerTick() {
return 480;
}
}

View file

@ -27,6 +27,12 @@ public class SPPonderIndex {
STEAM_HELPER.forComponents(SPBlocks.BRONZE_STEAM_ENGINE, SPBlocks.CAST_IRON_STEAM_ENGINE, SPBlocks.STEEL_STEAM_ENGINE)
.addStoryBoard("steam_engine", SPScenes::steamEngine, PonderTag.KINETIC_SOURCES, STEAM);
STEAM_HELPER.forComponents(SPBlocks.BRONZE_STEAM_ENGINE, SPBlocks.CAST_IRON_STEAM_ENGINE, SPBlocks.STEEL_STEAM_ENGINE)
.addStoryBoard("boiler", SPScenes::steamBoiler, PonderTag.KINETIC_SOURCES, STEAM);
STEAM_HELPER.forComponents(SPBlocks.BRONZE_BOILER, SPBlocks.BRONZE_BURNER, SPBlocks.CAST_IRON_BURNER, SPBlocks.CAST_IRON_BOILER, SPBlocks.STEEL_BURNER, SPBlocks.STEEL_BOILER)
.addStoryBoard("boiler", SPScenes::steamBoiler, PonderTag.KINETIC_SOURCES, STEAM);
STEAM_HELPER.forComponents(SPBlocks.BRONZE_FLYWHEEL, SPBlocks.CAST_IRON_FLYWHEEL, SPBlocks.STEEL_FLYWHEEL)
.addStoryBoard("steam_engine", SPScenes::steamFlywheel, PonderTag.KINETIC_SOURCES, STEAM);

View file

@ -1,11 +1,17 @@
package com.teammoeg.steampowered.ponder;
import com.simibubi.create.content.contraptions.processing.burner.BlazeBurnerBlock;
import com.simibubi.create.foundation.ponder.SceneBuilder;
import com.simibubi.create.foundation.ponder.SceneBuildingUtil;
import com.simibubi.create.foundation.ponder.Selection;
import com.simibubi.create.foundation.ponder.content.PonderPalette;
import com.simibubi.create.foundation.ponder.elements.InputWindowElement;
import com.simibubi.create.foundation.utility.Pointing;
import com.teammoeg.steampowered.content.burner.BurnerBlock;
import com.teammoeg.steampowered.content.engine.SteamEngineBlock;
import com.teammoeg.steampowered.registrate.SPBlocks;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
@ -19,6 +25,88 @@ public class SPScenes {
steamEngine(scene, util, true);
}
public static void steamBoiler(SceneBuilder scene, SceneBuildingUtil util) {
scene.title("boiler", "Generating Steam through Boilers and Burning Chambers");
scene.configureBasePlate(0, 0, 6);
BlockPos burner = util.grid.at(2, 1, 2);
BlockPos boiler = util.grid.at(2, 2, 2);
BlockPos engine = util.grid.at(0, 2, 2);
BlockPos steamPump = util.grid.at(1, 2, 2);
BlockPos steamCog1 = util.grid.at(1, 3, 3);
BlockPos steamCog2 = util.grid.at(0, 3, 3);
BlockPos waterPump = util.grid.at(4, 3, 2);
BlockPos waterCog1 = util.grid.at(4, 2, 1);
BlockPos waterCog2 = util.grid.at(5, 2, 1);
// show the whole structure
scene.world.showSection(util.select.layer(0), Direction.UP);
scene.idle(10);
scene.world.showSection(util.select.layers(1, 3), Direction.NORTH);
scene.idle(50);
// water pumps
scene.world.setKineticSpeed(util.select.position(waterPump), 32.0F);
scene.world.setKineticSpeed(util.select.position(waterCog1), 16.0F);
scene.world.setKineticSpeed(util.select.position(waterCog2), 16.0F);
scene.idle(30);
// boiler text
scene.overlay.showText(50)
.attachKeyFrame()
.text("The Boiler needs water to produce Steam")
.placeNearTarget()
.pointAt(util.vector.centerOf(boiler));
scene.idle(100);
// burner text
scene.overlay.showText(100)
.attachKeyFrame()
.text("The Burning Chamber needs furnace fuel to heat the Boiler")
.placeNearTarget()
.pointAt(util.vector.centerOf(burner));
scene.idle(100);
scene.overlay.showText(80)
.attachKeyFrame()
.text("Right click with fuel item such as Coal or Planks to provide it with fuel")
.placeNearTarget()
.pointAt(util.vector.centerOf(burner));
scene.idle(100);
// add fuel
scene.overlay.showControls(new InputWindowElement(util.vector.centerOf(burner), Pointing.UP).rightClick()
.withItem(new ItemStack(Items.COAL)), 30);
scene.idle(40);
scene.overlay.showControls(new InputWindowElement(util.vector.centerOf(burner), Pointing.UP).rightClick()
.withItem(new ItemStack(Items.OAK_PLANKS)), 30);
scene.idle(40);
scene.world.modifyBlock(burner, s -> s.setValue(BurnerBlock.LIT, true), false);
scene.idle(20);
scene.overlay.showText(80)
.attachKeyFrame()
.text("Right click with empty hand to take out the remaining fuel")
.placeNearTarget()
.pointAt(util.vector.centerOf(burner));
scene.idle(100);
// steam pumps
scene.world.setKineticSpeed(util.select.position(steamPump), 64.0F);
scene.world.setKineticSpeed(util.select.position(steamCog1), 32.0F);
scene.world.setKineticSpeed(util.select.position(steamCog2), 32.0F);
scene.world.modifyBlock(engine, s -> s.setValue(SteamEngineBlock.LIT, true), false);
scene.idle(50);
// engine text
scene.overlay.showText(100)
.attachKeyFrame()
.text("Pump the Steam out of the boiler to power the Steam Engines")
.placeNearTarget()
.pointAt(util.vector.centerOf(engine));
scene.idle(100);
}
public static void steamEngine(SceneBuilder scene, SceneBuildingUtil util, boolean flywheel) {
scene.title(flywheel ? "flywheel" : "steam_engine", "Generating Rotational Force using the " + (flywheel ? "Flywheel" : "Steam Engine"));
scene.configureBasePlate(0, 0, 6);

View file

@ -14,6 +14,10 @@ import com.simibubi.create.repack.registrate.util.entry.BlockEntry;
import com.teammoeg.steampowered.SPConfig;
import com.teammoeg.steampowered.SteamPowered;
import com.teammoeg.steampowered.content.alternator.AlternatorBlock;
import com.teammoeg.steampowered.content.boiler.CastIronBoilerBlock;
import com.teammoeg.steampowered.content.boiler.SteelBoilerBlock;
import com.teammoeg.steampowered.content.burner.CastIronBurnerBlock;
import com.teammoeg.steampowered.content.burner.SteelBurnerBlock;
import com.teammoeg.steampowered.content.cogwheel.MetalCogwheelBlock;
import com.teammoeg.steampowered.content.boiler.BronzeBoilerBlock;
import com.teammoeg.steampowered.content.burner.BronzeBurnerBlock;
@ -42,12 +46,36 @@ public class SPBlocks {
.transform(customItemModel())
.register();
public static final BlockEntry<CastIronBurnerBlock> CAST_IRON_BURNER = REGISTRATE.block("cast_iron_burner", CastIronBurnerBlock::new)
.initialProperties(SPBlocks::hardMetal)
.item()
.transform(customItemModel())
.register();
public static final BlockEntry<SteelBurnerBlock> STEEL_BURNER = REGISTRATE.block("steel_burner", SteelBurnerBlock::new)
.initialProperties(SPBlocks::hardMetal)
.item()
.transform(customItemModel())
.register();
public static final BlockEntry<BronzeBoilerBlock> BRONZE_BOILER = REGISTRATE.block("bronze_boiler", BronzeBoilerBlock::new)
.initialProperties(SharedProperties::softMetal)
.item()
.transform(customItemModel())
.register();
public static final BlockEntry<CastIronBoilerBlock> CAST_IRON_BOILER = REGISTRATE.block("cast_iron_boiler", CastIronBoilerBlock::new)
.initialProperties(SPBlocks::hardMetal)
.item()
.transform(customItemModel())
.register();
public static final BlockEntry<SteelBoilerBlock> STEEL_BOILER = REGISTRATE.block("steel_boiler", SteelBoilerBlock::new)
.initialProperties(SPBlocks::hardMetal)
.item()
.transform(customItemModel())
.register();
public static final BlockEntry<BronzeSteamEngineBlock> BRONZE_STEAM_ENGINE = REGISTRATE.block("bronze_steam_engine", BronzeSteamEngineBlock::new)
.initialProperties(SharedProperties::softMetal)
.item()

View file

@ -15,6 +15,11 @@ import com.teammoeg.steampowered.client.render.BronzeFlywheelRenderer;
import com.teammoeg.steampowered.client.render.CastIronFlywheelRenderer;
import com.teammoeg.steampowered.client.render.SteelFlywheelRenderer;
import com.teammoeg.steampowered.content.alternator.AlternatorTileEntity;
import com.teammoeg.steampowered.content.boiler.CastIronBoilerBlock;
import com.teammoeg.steampowered.content.boiler.CastIronBoilerTileEntity;
import com.teammoeg.steampowered.content.boiler.SteelBoilerTileEntity;
import com.teammoeg.steampowered.content.burner.CastIronBurnerTileEntity;
import com.teammoeg.steampowered.content.burner.SteelBurnerTileEntity;
import com.teammoeg.steampowered.content.cogwheel.MetalCogwheelTileEntity;
import com.teammoeg.steampowered.content.boiler.BronzeBoilerTileEntity;
import com.teammoeg.steampowered.content.burner.BronzeBurnerTileEntity;
@ -31,11 +36,31 @@ public class SPTiles {
.validBlocks(SPBlocks.BRONZE_BURNER)
.register();
public static final TileEntityEntry<CastIronBurnerTileEntity> CAST_IRON_BURNER = REGISTRATE
.tileEntity("cast_iron_burner", CastIronBurnerTileEntity::new)
.validBlocks(SPBlocks.CAST_IRON_BURNER)
.register();
public static final TileEntityEntry<SteelBurnerTileEntity> STEEL_BURNER = REGISTRATE
.tileEntity("steel_burner", SteelBurnerTileEntity::new)
.validBlocks(SPBlocks.STEEL_BURNER)
.register();
public static final TileEntityEntry<BronzeBoilerTileEntity> BRONZE_BOILER = REGISTRATE
.tileEntity("bronze_boiler", BronzeBoilerTileEntity::new)
.validBlocks(SPBlocks.BRONZE_BOILER)
.register();
public static final TileEntityEntry<CastIronBoilerTileEntity> CAST_IRON_BOILER = REGISTRATE
.tileEntity("cast_iron_boiler", CastIronBoilerTileEntity::new)
.validBlocks(SPBlocks.CAST_IRON_BOILER)
.register();
public static final TileEntityEntry<SteelBoilerTileEntity> STEEL_BOILER = REGISTRATE
.tileEntity("steel_boiler", SteelBoilerTileEntity::new)
.validBlocks(SPBlocks.STEEL_BOILER)
.register();
public static final TileEntityEntry<BronzeSteamEngineTileEntity> BRONZE_STEAM_ENGINE = REGISTRATE
.tileEntity("bronze_steam_engine", BronzeSteamEngineTileEntity::new)
.validBlocks(SPBlocks.BRONZE_STEAM_ENGINE)

View file

@ -59,5 +59,12 @@
"steampowered.ponder.tag.steam.description": "Components related to steam production and usage",
"tooltip.steampowered.burner.hu": "Heat Remaining: %s HU",
"tooltip.steampowered.burner.item" : "Fuel Remaining: %s x %s"
"tooltip.steampowered.burner.item" : "Fuel Remaining: %s x %s",
"steampowered.ponder.boiler.header": "Generating Steam through Boilers and Burning Chambers",
"steampowered.ponder.boiler.text_1": "The Boiler needs water to produce Steam",
"steampowered.ponder.boiler.text_2": "The Burning Chamber needs furnace fuel to heat the Boiler",
"steampowered.ponder.boiler.text_3": "Right click with fuel item such as Coal or Planks to provide it with fuel",
"steampowered.ponder.boiler.text_4": "Right click with empty hand to take out the remaining fuel",
"steampowered.ponder.boiler.text_5": "Pump the steam out of the boiler to power the Steam Engines"
}