2021-10-25 01:55:17 +02:00
/ *
* Copyright ( c ) 2021 TeamMoeg
*
* This file is part of Steam Powered .
*
* Steam Powered is free software : you can redistribute it and / or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation , version 3 .
*
* Steam Powered is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
* GNU General Public License for more details .
*
* You should have received a copy of the GNU General Public License
* along with Steam Powered . If not , see < https : //www.gnu.org/licenses/>.
* /
2021-08-29 08:47:39 +02:00
package com.teammoeg.steampowered.ponder ;
2021-08-28 17:46:19 +02:00
2022-02-01 21:00:40 +01:00
import com.simibubi.create.foundation.ponder.PonderPalette ;
2021-08-28 17:46:19 +02:00
import com.simibubi.create.foundation.ponder.SceneBuilder ;
import com.simibubi.create.foundation.ponder.SceneBuildingUtil ;
import com.simibubi.create.foundation.ponder.Selection ;
2022-02-01 21:00:40 +01:00
import com.simibubi.create.foundation.ponder.element.InputWindowElement ;
2021-10-24 11:26:16 +02:00
import com.simibubi.create.foundation.utility.Pointing ;
2022-01-19 18:49:09 +01:00
import com.teammoeg.steampowered.SPConfig ;
2021-10-26 11:25:46 +02:00
import com.teammoeg.steampowered.content.alternator.DynamoBlock ;
2021-10-24 11:26:16 +02:00
import com.teammoeg.steampowered.content.burner.BurnerBlock ;
2021-10-24 08:51:44 +02:00
import com.teammoeg.steampowered.content.engine.SteamEngineBlock ;
2023-12-04 16:08:50 +01:00
import com.teammoeg.steampowered.create.flywheel.legacy.FlywheelBlock ;
import com.teammoeg.steampowered.create.flywheel.legacy.FlywheelBlock.ConnectionState ;
2021-08-29 10:56:44 +02:00
import com.teammoeg.steampowered.registrate.SPBlocks ;
2021-12-03 17:34:27 +01:00
2022-02-01 21:00:40 +01:00
import net.minecraft.world.level.block.LeverBlock ;
import net.minecraft.world.level.block.RedStoneWireBlock ;
import net.minecraft.world.item.ItemStack ;
import net.minecraft.world.item.Items ;
import net.minecraft.core.Direction ;
import net.minecraft.core.BlockPos ;
2021-08-28 17:46:19 +02:00
public class SPScenes {
public static void steamEngine ( SceneBuilder scene , SceneBuildingUtil util ) {
steamEngine ( scene , util , false ) ;
}
2021-09-01 15:57:53 +02:00
public static void steamFlywheel ( SceneBuilder scene , SceneBuildingUtil util ) {
steamEngine ( scene , util , true ) ;
}
2021-10-24 11:26:16 +02:00
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 ) ;
}
2021-08-28 17:46:19 +02:00
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 ) ;
scene . world . showSection ( util . select . layer ( 0 ) , Direction . UP ) ;
BlockPos cogPos = util . grid . at ( 1 , 1 , 2 ) ;
2021-09-03 15:44:43 +02:00
BlockPos wheelPos = util . grid . at ( 1 , 1 , 3 ) ;
2021-08-28 17:46:19 +02:00
BlockPos gaugePos = util . grid . at ( 1 , 1 , 1 ) ;
BlockPos enginePos = util . grid . at ( 3 , 1 , 3 ) ;
scene . idle ( 5 ) ;
2022-01-19 18:49:09 +01:00
Selection f2Select = util . select . fromTo ( 1 , 1 , 3 , 3 , 1 , 3 ) ;
Selection b2Select = util . select . fromTo ( 5 , 1 , 3 , 5 , 2 , 3 ) ;
scene . world . showSection ( util . select . position ( enginePos ) , Direction . DOWN ) ;
//scene.idle(10);
//scene.world.showSection(util.select.position(enginePos.west()), Direction.DOWN);
scene . idle ( 20 ) ;
scene . world . showSection ( util . select . position ( wheelPos ) , Direction . EAST ) ;
2021-08-28 17:46:19 +02:00
scene . idle ( 10 ) ;
2022-01-19 18:49:09 +01:00
scene . world . showSection ( util . select . fromTo ( 3 , 2 , 3 , 4 , 3 , 4 ) , Direction . WEST ) ;
scene . world . setKineticSpeed ( util . select . position ( 4 , 2 , 3 ) , 64F ) ;
scene . world . setKineticSpeed ( util . select . fromTo ( 3 , 3 , 4 , 4 , 3 , 4 ) , 32F ) ;
2021-09-03 15:44:43 +02:00
scene . idle ( 10 ) ;
2022-01-19 18:49:09 +01:00
scene . world . showSection ( b2Select , Direction . UP ) ;
scene . world . modifyBlock ( util . grid . at ( 5 , 1 , 3 ) , state - > state . setValue ( BurnerBlock . LIT , true ) , false ) ;
2021-10-24 13:20:26 +02:00
scene . idle ( 10 ) ;
2021-08-28 17:46:19 +02:00
String text = flywheel ? " Flywheels are required for generating rotational force with the Steam Engine " : " Steam Engines generate Rotational Force while Steam is provided " ;
scene . overlay . showText ( 80 ) . attachKeyFrame ( ) . placeNearTarget ( ) . pointAt ( util . vector . topOf ( enginePos . west ( flywheel ? 3 : 1 ) ) ) . text ( text ) ;
scene . idle ( 7 ) ;
scene . world . cycleBlockProperty ( enginePos , SteamEngineBlock . LIT ) ;
scene . idle ( 90 ) ;
2021-09-03 15:44:43 +02:00
scene . world . setKineticSpeed ( util . select . fromTo ( 1 , 1 , 3 , 1 , 1 , 1 ) , 32 . 0F ) ;
2021-08-28 17:46:19 +02:00
scene . idle ( 40 ) ;
scene . world . showSection ( util . select . position ( cogPos ) , Direction . SOUTH ) ;
scene . idle ( 15 ) ;
scene . effects . rotationSpeedIndicator ( cogPos ) ;
scene . world . showSection ( util . select . position ( gaugePos ) , Direction . SOUTH ) ;
scene . idle ( 15 ) ;
scene . overlay . showText ( 80 ) . attachKeyFrame ( ) . placeNearTarget ( ) . colored ( PonderPalette . GREEN ) . pointAt ( util . vector . blockSurface ( gaugePos , Direction . WEST ) ) . text ( " The provided Rotational Force has a very large stress capacity " ) ;
scene . idle ( 90 ) ;
2021-09-03 15:44:43 +02:00
2022-01-19 18:49:09 +01:00
scene . world . hideSection ( f2Select , Direction . DOWN ) ;
scene . world . hideSection ( b2Select , Direction . DOWN ) ;
2021-08-28 17:46:19 +02:00
scene . idle ( 15 ) ;
2022-01-19 18:49:09 +01:00
scene . world . setBlock ( util . grid . at ( 5 , 1 , 3 ) , SPBlocks . CAST_IRON_BURNER . getDefaultState ( ) . setValue ( BurnerBlock . LIT , true ) , false ) ;
scene . world . setBlock ( util . grid . at ( 5 , 2 , 3 ) , SPBlocks . CAST_IRON_BOILER . getDefaultState ( ) , false ) ;
scene . world . setBlock ( enginePos , SPBlocks . CAST_IRON_STEAM_ENGINE . getDefaultState ( ) . setValue ( SteamEngineBlock . FACING , Direction . WEST ) . setValue ( SteamEngineBlock . LIT , true ) , false ) ;
scene . world . setBlock ( wheelPos , SPBlocks . CAST_IRON_FLYWHEEL . getDefaultState ( ) . setValue ( SteamEngineBlock . FACING , Direction . SOUTH ) . setValue ( FlywheelBlock . CONNECTION , ConnectionState . LEFT ) , false ) ;
scene . world . showSection ( f2Select , Direction . DOWN ) ;
scene . world . showSection ( b2Select , Direction . DOWN ) ;
2021-09-03 15:44:43 +02:00
scene . idle ( 30 ) ;
2022-01-19 18:49:09 +01:00
scene . world . setKineticSpeed ( util . select . fromTo ( 1 , 1 , 3 , 1 , 1 , 1 ) , SPConfig . COMMON . castIronFlywheelSpeed . get ( ) ) ;
2021-09-03 15:44:43 +02:00
scene . idle ( 50 ) ;
2022-01-19 18:49:09 +01:00
scene . world . hideSection ( f2Select , Direction . DOWN ) ;
scene . world . hideSection ( b2Select , Direction . DOWN ) ;
2021-09-03 15:44:43 +02:00
scene . idle ( 15 ) ;
2022-01-19 18:49:09 +01:00
scene . world . setBlock ( util . grid . at ( 5 , 1 , 3 ) , SPBlocks . STEEL_BURNER . getDefaultState ( ) . setValue ( BurnerBlock . LIT , true ) , false ) ;
scene . world . setBlock ( util . grid . at ( 5 , 2 , 3 ) , SPBlocks . STEEL_BOILER . getDefaultState ( ) , false ) ;
scene . world . setBlock ( enginePos , SPBlocks . STEEL_STEAM_ENGINE . get ( ) . defaultBlockState ( ) . setValue ( SteamEngineBlock . FACING , Direction . WEST ) . setValue ( SteamEngineBlock . LIT , true ) , false ) ;
scene . world . setBlock ( wheelPos , SPBlocks . STEEL_FLYWHEEL . get ( ) . defaultBlockState ( ) . setValue ( SteamEngineBlock . FACING , Direction . SOUTH ) . setValue ( FlywheelBlock . CONNECTION , ConnectionState . LEFT ) , false ) ;
scene . world . showSection ( f2Select , Direction . DOWN ) ;
scene . world . showSection ( b2Select , Direction . DOWN ) ;
2021-09-03 15:44:43 +02:00
scene . idle ( 30 ) ;
2022-01-19 18:49:09 +01:00
scene . world . setKineticSpeed ( util . select . fromTo ( 1 , 1 , 3 , 1 , 1 , 1 ) , SPConfig . COMMON . steelFlywheelSpeed . get ( ) ) ;
2021-09-03 15:44:43 +02:00
2021-08-28 17:46:19 +02:00
scene . idle ( 5 ) ;
scene . effects . rotationSpeedIndicator ( cogPos ) ;
scene . idle ( 5 ) ;
2021-09-03 15:44:43 +02:00
String text3 = flywheel ? " Using Flywheels made of Steel or Cast Iron will increase efficiency and generated capacity of the Flywheel " : " Using Steam Engines made of Steel or Cast Iron will increase efficiency and generated capacity of the Flywheel " ;
2022-01-19 18:49:09 +01:00
scene . overlay . showOutline ( PonderPalette . MEDIUM , new Object ( ) , f2Select , 80 ) ;
2021-09-03 15:44:43 +02:00
scene . overlay . showText ( 80 ) . placeNearTarget ( ) . colored ( PonderPalette . MEDIUM ) . pointAt ( util . vector . topOf ( enginePos . west ( ) ) ) . text ( text3 ) ;
2022-01-19 18:49:09 +01:00
scene . idle ( 80 ) ;
String text4 = " However, power up higher level of " + ( flywheel ? " flywheel " : " engine " ) + " require higher amount of steam, boiler and burner should match the level. " ;
scene . overlay . showText ( 80 ) . placeNearTarget ( ) . colored ( PonderPalette . RED ) . text ( text4 ) . pointAt ( util . vector . topOf ( 5 , 2 , 3 ) ) ;
scene . idle ( 80 ) ;
2021-08-28 17:46:19 +02:00
}
2021-08-29 10:55:48 +02:00
2021-10-26 09:00:12 +02:00
public static void dynamo ( SceneBuilder scene , SceneBuildingUtil util ) {
scene . title ( " dynamo " , " Generating Electric energy using a Dynamo " ) ;
2021-08-29 10:55:48 +02:00
scene . configureBasePlate ( 1 , 0 , 4 ) ;
scene . world . showSection ( util . select . layer ( 0 ) , Direction . UP ) ;
2021-10-26 11:25:46 +02:00
scene . idle ( 10 ) ;
scene . world . showSection ( util . select . layer ( 1 ) , Direction . UP ) ;
scene . idle ( 10 ) ;
scene . world . showSection ( util . select . layer ( 2 ) , Direction . UP ) ;
scene . idle ( 10 ) ;
2021-08-29 10:55:48 +02:00
BlockPos generator = util . grid . at ( 3 , 1 , 2 ) ;
2021-10-26 11:25:46 +02:00
BlockPos shaft = util . grid . at ( 2 , 1 , 2 ) ;
BlockPos gauge = util . grid . at ( 1 , 1 , 2 ) ;
BlockPos cogwheel = util . grid . at ( 0 , 1 , 2 ) ;
BlockPos largecog = util . grid . at ( 0 , 2 , 3 ) ;
BlockPos redstone = util . grid . at ( 3 , 1 , 1 ) ;
BlockPos lever = util . grid . at ( 3 , 1 , 0 ) ;
2021-08-29 10:55:48 +02:00
2021-10-26 11:25:46 +02:00
scene . world . setKineticSpeed ( util . select . position ( largecog ) , 16 . 0F ) ;
scene . idle ( 5 ) ;
scene . world . setKineticSpeed ( util . select . position ( cogwheel ) , 32 . 0F ) ;
scene . idle ( 5 ) ;
scene . world . setKineticSpeed ( util . select . position ( shaft ) , 32 . 0F ) ;
scene . idle ( 5 ) ;
scene . world . setKineticSpeed ( util . select . position ( generator ) , 32 . 0F ) ;
scene . idle ( 5 ) ;
2021-08-29 10:55:48 +02:00
scene . overlay . showText ( 50 )
2021-10-26 11:25:46 +02:00
. attachKeyFrame ( )
2021-10-26 09:00:12 +02:00
. text ( " The Dynamo generates electric energy (fe) from rotational force " )
2021-08-29 10:55:48 +02:00
. placeNearTarget ( )
. pointAt ( util . vector . topOf ( generator ) ) ;
scene . idle ( 60 ) ;
2021-10-26 11:25:46 +02:00
scene . effects . rotationSpeedIndicator ( cogwheel ) ;
scene . idle ( 60 ) ;
2021-08-29 10:55:48 +02:00
scene . overlay . showText ( 50 )
2021-10-26 11:25:46 +02:00
. text ( " It requires at least 32 RPM to operate " )
2021-08-29 10:55:48 +02:00
. placeNearTarget ( )
2021-10-26 11:25:46 +02:00
. pointAt ( util . vector . topOf ( cogwheel ) ) ;
2021-08-29 10:55:48 +02:00
scene . idle ( 60 ) ;
scene . overlay . showText ( 50 )
2021-10-26 09:00:12 +02:00
. text ( " The Dynamos energy production is determined by the input RPM " )
2021-08-29 10:55:48 +02:00
. placeNearTarget ( )
. pointAt ( util . vector . topOf ( generator ) ) ;
scene . idle ( 60 ) ;
2021-10-26 11:25:46 +02:00
scene . overlay . showText ( 50 )
. text ( " It has conversion efficiency of 75 Percent " )
. placeNearTarget ( )
. pointAt ( util . vector . topOf ( generator ) ) ;
scene . idle ( 60 ) ;
scene . overlay . showText ( 50 )
. attachKeyFrame ( )
. text ( " You can lock the Dynamo with redstone signal so it will not apply stress to the network " )
. placeNearTarget ( )
. pointAt ( util . vector . centerOf ( lever ) ) ;
scene . idle ( 60 ) ;
scene . world . modifyBlock ( lever , s - > s . setValue ( LeverBlock . POWERED , true ) , false ) ;
2022-02-01 21:00:40 +01:00
scene . world . modifyBlock ( redstone , s - > s . setValue ( RedStoneWireBlock . POWER , 15 ) , false ) ;
2021-10-26 11:25:46 +02:00
scene . world . modifyBlock ( generator , s - > s . setValue ( DynamoBlock . REDSTONE_LOCKED , true ) , false ) ;
scene . idle ( 60 ) ;
2021-08-29 10:55:48 +02:00
}
2021-08-28 17:46:19 +02:00
}