Update 10
This commit is contained in:
parent
99c5e754ad
commit
f7a038c888
46 changed files with 903 additions and 138 deletions
10
build.gradle
10
build.gradle
|
@ -2,14 +2,17 @@ buildscript {
|
||||||
repositories {
|
repositories {
|
||||||
// These repositories are only for Gradle plugins, put any other repositories in the repository block further below
|
// These repositories are only for Gradle plugins, put any other repositories in the repository block further below
|
||||||
maven { url = 'https://maven.minecraftforge.net' }
|
maven { url = 'https://maven.minecraftforge.net' }
|
||||||
|
maven { url = 'https://repo.spongepowered.org/repository/maven-public/' }
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true
|
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true
|
||||||
|
classpath 'org.spongepowered:mixingradle:0.7-SNAPSHOT'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
apply plugin: 'net.minecraftforge.gradle'
|
apply plugin: 'net.minecraftforge.gradle'
|
||||||
|
apply plugin: 'org.spongepowered.mixin'
|
||||||
|
|
||||||
group = 'com.teammoeg'
|
group = 'com.teammoeg'
|
||||||
version = '1.16.5-0.1.0'
|
version = '1.16.5-0.1.0'
|
||||||
|
@ -41,6 +44,7 @@ minecraft {
|
||||||
client {
|
client {
|
||||||
property 'mixin.env.remapRefMap', 'true'
|
property 'mixin.env.remapRefMap', 'true'
|
||||||
property 'mixin.env.refMapRemappingFile', "${buildDir}/createSrgToMcp/output.srg"
|
property 'mixin.env.refMapRemappingFile', "${buildDir}/createSrgToMcp/output.srg"
|
||||||
|
arg "-mixin.config=" + "steampowered.mixins.json"
|
||||||
|
|
||||||
workingDirectory project.file('run')
|
workingDirectory project.file('run')
|
||||||
|
|
||||||
|
@ -66,6 +70,7 @@ minecraft {
|
||||||
server {
|
server {
|
||||||
property 'mixin.env.remapRefMap', 'true'
|
property 'mixin.env.remapRefMap', 'true'
|
||||||
property 'mixin.env.refMapRemappingFile', "${buildDir}/createSrgToMcp/output.srg"
|
property 'mixin.env.refMapRemappingFile', "${buildDir}/createSrgToMcp/output.srg"
|
||||||
|
arg "-mixin.config=" + "steampowered.mixins.json"
|
||||||
|
|
||||||
workingDirectory project.file('run')
|
workingDirectory project.file('run')
|
||||||
|
|
||||||
|
@ -163,6 +168,8 @@ dependencies {
|
||||||
compileOnly fg.deobf("mezz.jei:jei-1.16.5:7.6.4.88")
|
compileOnly fg.deobf("mezz.jei:jei-1.16.5:7.6.4.88")
|
||||||
runtimeOnly fg.deobf("mezz.jei:jei-1.16.5:7.6.4.88")
|
runtimeOnly fg.deobf("mezz.jei:jei-1.16.5:7.6.4.88")
|
||||||
|
|
||||||
|
annotationProcessor "org.spongepowered:mixin:0.8.2:processor"
|
||||||
|
testAnnotationProcessor "org.spongepowered:mixin:0.8.2:processor"
|
||||||
|
|
||||||
// Real mod deobf dependency examples - these get remapped to your current mappings
|
// Real mod deobf dependency examples - these get remapped to your current mappings
|
||||||
// compileOnly fg.deobf("mezz.jei:jei-${mc_version}:${jei_version}:api") // Adds JEI API as a compile dependency
|
// compileOnly fg.deobf("mezz.jei:jei-${mc_version}:${jei_version}:api") // Adds JEI API as a compile dependency
|
||||||
|
@ -187,7 +194,8 @@ jar {
|
||||||
"Implementation-Title" : project.name,
|
"Implementation-Title" : project.name,
|
||||||
"Implementation-Version" : project.jar.archiveVersion,
|
"Implementation-Version" : project.jar.archiveVersion,
|
||||||
"Implementation-Vendor" : "YueSha",
|
"Implementation-Vendor" : "YueSha",
|
||||||
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
|
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
|
||||||
|
"MixinConfigs": "steampowered.mixins.json"
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
31
src/main/java/com/teammoeg/steampowered/SPBlockPartials.java
Normal file
31
src/main/java/com/teammoeg/steampowered/SPBlockPartials.java
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
package com.teammoeg.steampowered;
|
||||||
|
|
||||||
|
import com.jozufozu.flywheel.core.PartialModel;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
|
public class SPBlockPartials {
|
||||||
|
public static final PartialModel BRONZE_FLYWHEEL = get("bronze_flywheel/wheel");
|
||||||
|
public static final PartialModel BRONZE_FLYWHEEL_UPPER_ROTATING = get("bronze_flywheel/upper_rotating_connector");
|
||||||
|
public static final PartialModel BRONZE_FLYWHEEL_LOWER_ROTATING = get("bronze_flywheel/lower_rotating_connector");
|
||||||
|
public static final PartialModel BRONZE_FLYWHEEL_UPPER_SLIDING = get("bronze_flywheel/upper_sliding_connector");
|
||||||
|
public static final PartialModel BRONZE_FLYWHEEL_LOWER_SLIDING = get("bronze_flywheel/lower_sliding_connector");
|
||||||
|
|
||||||
|
public static final PartialModel CAST_IRON_FLYWHEEL = get("cast_iron_flywheel/wheel");
|
||||||
|
public static final PartialModel CAST_IRON_FLYWHEEL_UPPER_ROTATING = get("cast_iron_flywheel/upper_rotating_connector");
|
||||||
|
public static final PartialModel CAST_IRON_FLYWHEEL_LOWER_ROTATING = get("cast_iron_flywheel/lower_rotating_connector");
|
||||||
|
public static final PartialModel CAST_IRON_FLYWHEEL_UPPER_SLIDING = get("cast_iron_flywheel/upper_sliding_connector");
|
||||||
|
public static final PartialModel CAST_IRON_FLYWHEEL_LOWER_SLIDING = get("cast_iron_flywheel/lower_sliding_connector");
|
||||||
|
|
||||||
|
public static final PartialModel STEEL_FLYWHEEL = get("steel_flywheel/wheel");
|
||||||
|
public static final PartialModel STEEL_FLYWHEEL_UPPER_ROTATING = get("steel_flywheel/upper_rotating_connector");
|
||||||
|
public static final PartialModel STEEL_FLYWHEEL_LOWER_ROTATING = get("steel_flywheel/lower_rotating_connector");
|
||||||
|
public static final PartialModel STEEL_FLYWHEEL_UPPER_SLIDING = get("steel_flywheel/upper_sliding_connector");
|
||||||
|
public static final PartialModel STEEL_FLYWHEEL_LOWER_SLIDING = get("steel_flywheel/lower_sliding_connector");
|
||||||
|
|
||||||
|
private static PartialModel get(String path) {
|
||||||
|
return new PartialModel(new ResourceLocation("steampowered", "block/" + path));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void clientInit() {
|
||||||
|
}
|
||||||
|
}
|
|
@ -36,7 +36,7 @@ public class SteamPowered {
|
||||||
@Override
|
@Override
|
||||||
@Nonnull
|
@Nonnull
|
||||||
public ItemStack makeIcon() {
|
public ItemStack makeIcon() {
|
||||||
return new ItemStack(SPBlocks.STEAM_ENGINE.get());
|
return new ItemStack(SPBlocks.BRONZE_STEAM_ENGINE.get());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -50,6 +50,9 @@ public class SteamPowered {
|
||||||
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::doClientStuff);
|
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::doClientStuff);
|
||||||
MinecraftForge.EVENT_BUS.register(this);
|
MinecraftForge.EVENT_BUS.register(this);
|
||||||
|
|
||||||
|
DistExecutor.unsafeRunWhenOn(Dist.CLIENT,
|
||||||
|
() -> () -> SteamPoweredClient.addClientListeners(MinecraftForge.EVENT_BUS, FMLJavaModLoadingContext.get().getModEventBus()));
|
||||||
|
|
||||||
FluidRegistry.FLUIDS.register(FMLJavaModLoadingContext.get().getModEventBus());
|
FluidRegistry.FLUIDS.register(FMLJavaModLoadingContext.get().getModEventBus());
|
||||||
BlockRegistry.BLOCKS.register(FMLJavaModLoadingContext.get().getModEventBus());
|
BlockRegistry.BLOCKS.register(FMLJavaModLoadingContext.get().getModEventBus());
|
||||||
ItemRegistry.ITEMS.register(FMLJavaModLoadingContext.get().getModEventBus());
|
ItemRegistry.ITEMS.register(FMLJavaModLoadingContext.get().getModEventBus());
|
||||||
|
@ -59,9 +62,6 @@ public class SteamPowered {
|
||||||
SPItems.register();
|
SPItems.register();
|
||||||
|
|
||||||
PacketHandler.register();
|
PacketHandler.register();
|
||||||
|
|
||||||
DistExecutor.unsafeRunWhenOn(Dist.CLIENT,
|
|
||||||
() -> () -> SteamPoweredClient.addClientListeners(MinecraftForge.EVENT_BUS, FMLJavaModLoadingContext.get().getModEventBus()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setup(final FMLCommonSetupEvent event) {
|
private void setup(final FMLCommonSetupEvent event) {
|
||||||
|
|
|
@ -0,0 +1,47 @@
|
||||||
|
package com.teammoeg.steampowered.block;
|
||||||
|
|
||||||
|
import com.jozufozu.flywheel.core.PartialModel;
|
||||||
|
import com.simibubi.create.AllBlockPartials;
|
||||||
|
import com.simibubi.create.AllShapes;
|
||||||
|
import com.simibubi.create.content.contraptions.components.flywheel.engine.EngineBlock;
|
||||||
|
import com.simibubi.create.foundation.block.ITE;
|
||||||
|
import com.teammoeg.steampowered.registrate.SPTiles;
|
||||||
|
import com.teammoeg.steampowered.tileentity.BronzeSteamEngineTileEntity;
|
||||||
|
import com.teammoeg.steampowered.tileentity.SteamEngineTileEntity;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.BlockState;
|
||||||
|
import net.minecraft.item.BlockItemUseContext;
|
||||||
|
import net.minecraft.particles.ParticleTypes;
|
||||||
|
import net.minecraft.state.BooleanProperty;
|
||||||
|
import net.minecraft.state.StateContainer;
|
||||||
|
import net.minecraft.state.properties.BlockStateProperties;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.util.Direction;
|
||||||
|
import net.minecraft.util.SoundCategory;
|
||||||
|
import net.minecraft.util.SoundEvents;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.math.shapes.ISelectionContext;
|
||||||
|
import net.minecraft.util.math.shapes.VoxelShape;
|
||||||
|
import net.minecraft.world.IBlockReader;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
public class BronzeSteamEngineBlock extends SteamEngineBlock implements ITE<BronzeSteamEngineTileEntity> {
|
||||||
|
public BronzeSteamEngineBlock(Properties builder) {
|
||||||
|
super(builder);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TileEntity createTileEntity(BlockState state, IBlockReader world) {
|
||||||
|
return SPTiles.BRONZE_STEAM_ENGINE.create();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Class<BronzeSteamEngineTileEntity> getTileEntityClass() {
|
||||||
|
return BronzeSteamEngineTileEntity.class;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
package com.teammoeg.steampowered.block;
|
||||||
|
|
||||||
|
import com.simibubi.create.foundation.block.ITE;
|
||||||
|
import com.teammoeg.steampowered.registrate.SPTiles;
|
||||||
|
import com.teammoeg.steampowered.tileentity.BronzeSteamEngineTileEntity;
|
||||||
|
import com.teammoeg.steampowered.tileentity.CastIronSteamEngineTileEntity;
|
||||||
|
import net.minecraft.block.BlockState;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.world.IBlockReader;
|
||||||
|
|
||||||
|
public class CastIronSteamEngineBlock extends SteamEngineBlock implements ITE<CastIronSteamEngineTileEntity> {
|
||||||
|
public CastIronSteamEngineBlock(Properties builder) {
|
||||||
|
super(builder);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TileEntity createTileEntity(BlockState state, IBlockReader world) {
|
||||||
|
return SPTiles.CAST_IRON_STEAM_ENGINE.create();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Class<CastIronSteamEngineTileEntity> getTileEntityClass() {
|
||||||
|
return CastIronSteamEngineTileEntity.class;
|
||||||
|
}
|
||||||
|
}
|
|
@ -4,9 +4,9 @@ import com.jozufozu.flywheel.core.PartialModel;
|
||||||
import com.simibubi.create.AllBlockPartials;
|
import com.simibubi.create.AllBlockPartials;
|
||||||
import com.simibubi.create.AllShapes;
|
import com.simibubi.create.AllShapes;
|
||||||
import com.simibubi.create.content.contraptions.components.flywheel.engine.EngineBlock;
|
import com.simibubi.create.content.contraptions.components.flywheel.engine.EngineBlock;
|
||||||
import com.simibubi.create.content.contraptions.components.flywheel.engine.FurnaceEngineTileEntity;
|
|
||||||
import com.simibubi.create.foundation.block.ITE;
|
import com.simibubi.create.foundation.block.ITE;
|
||||||
import com.teammoeg.steampowered.registrate.SPTiles;
|
import com.teammoeg.steampowered.registrate.SPTiles;
|
||||||
|
import com.teammoeg.steampowered.tileentity.SteamEngineTileEntity;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.item.BlockItemUseContext;
|
import net.minecraft.item.BlockItemUseContext;
|
||||||
|
@ -29,7 +29,7 @@ import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
public class SteamEngineBlock extends EngineBlock implements ITE<FurnaceEngineTileEntity> {
|
public class SteamEngineBlock extends EngineBlock {
|
||||||
public static final BooleanProperty LIT = BlockStateProperties.LIT;
|
public static final BooleanProperty LIT = BlockStateProperties.LIT;
|
||||||
|
|
||||||
public SteamEngineBlock(Properties builder) {
|
public SteamEngineBlock(Properties builder) {
|
||||||
|
@ -48,7 +48,7 @@ public class SteamEngineBlock extends EngineBlock implements ITE<FurnaceEngineTi
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createTileEntity(BlockState state, IBlockReader world) {
|
public TileEntity createTileEntity(BlockState state, IBlockReader world) {
|
||||||
return SPTiles.STEAM_ENGINE.create();
|
return SPTiles.BRONZE_STEAM_ENGINE.create();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -67,11 +67,6 @@ public class SteamEngineBlock extends EngineBlock implements ITE<FurnaceEngineTi
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Class<FurnaceEngineTileEntity> getTileEntityClass() {
|
|
||||||
return FurnaceEngineTileEntity.class;
|
|
||||||
}
|
|
||||||
|
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public void animateTick(BlockState p_180655_1_, World p_180655_2_, BlockPos p_180655_3_, Random p_180655_4_) {
|
public void animateTick(BlockState p_180655_1_, World p_180655_2_, BlockPos p_180655_3_, Random p_180655_4_) {
|
||||||
if (p_180655_1_.getValue(LIT)) {
|
if (p_180655_1_.getValue(LIT)) {
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.teammoeg.steampowered.block;
|
||||||
|
|
||||||
|
import com.simibubi.create.content.contraptions.components.flywheel.FlywheelBlock;
|
||||||
|
import com.teammoeg.steampowered.registrate.SPTiles;
|
||||||
|
import net.minecraft.block.BlockState;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.world.IBlockReader;
|
||||||
|
|
||||||
|
public class SteamFlywheelBlock extends FlywheelBlock {
|
||||||
|
public SteamFlywheelBlock(Properties properties) {
|
||||||
|
super(properties);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TileEntity createTileEntity(BlockState state, IBlockReader world) {
|
||||||
|
return SPTiles.STEAM_FLYWHEEL.create();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
package com.teammoeg.steampowered.block;
|
||||||
|
|
||||||
|
import com.simibubi.create.foundation.block.ITE;
|
||||||
|
import com.teammoeg.steampowered.registrate.SPTiles;
|
||||||
|
import com.teammoeg.steampowered.tileentity.BronzeSteamEngineTileEntity;
|
||||||
|
import com.teammoeg.steampowered.tileentity.SteelSteamEngineTileEntity;
|
||||||
|
import net.minecraft.block.BlockState;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.world.IBlockReader;
|
||||||
|
|
||||||
|
public class SteelSteamEngineBlock extends SteamEngineBlock implements ITE<SteelSteamEngineTileEntity> {
|
||||||
|
public SteelSteamEngineBlock(Properties builder) {
|
||||||
|
super(builder);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TileEntity createTileEntity(BlockState state, IBlockReader world) {
|
||||||
|
return SPTiles.STEEL_STEAM_ENGINE.create();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Class<SteelSteamEngineTileEntity> getTileEntityClass() {
|
||||||
|
return SteelSteamEngineTileEntity.class;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,5 +1,6 @@
|
||||||
package com.teammoeg.steampowered.client;
|
package com.teammoeg.steampowered.client;
|
||||||
|
|
||||||
|
import com.teammoeg.steampowered.SPBlockPartials;
|
||||||
import com.teammoeg.steampowered.ponder.SPPonderIndex;
|
import com.teammoeg.steampowered.ponder.SPPonderIndex;
|
||||||
import com.teammoeg.steampowered.registrate.SPBlocks;
|
import com.teammoeg.steampowered.registrate.SPBlocks;
|
||||||
import com.teammoeg.steampowered.registrate.SPItems;
|
import com.teammoeg.steampowered.registrate.SPItems;
|
||||||
|
@ -17,6 +18,7 @@ public class SteamPoweredClient {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void clientInit(FMLClientSetupEvent event) {
|
public static void clientInit(FMLClientSetupEvent event) {
|
||||||
|
SPBlockPartials.clientInit();
|
||||||
SPPonderIndex.register();
|
SPPonderIndex.register();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,102 @@
|
||||||
|
package com.teammoeg.steampowered.client.render;
|
||||||
|
|
||||||
|
import com.jozufozu.flywheel.backend.Backend;
|
||||||
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
|
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
||||||
|
import com.simibubi.create.AllBlockPartials;
|
||||||
|
import com.simibubi.create.content.contraptions.base.HorizontalKineticBlock;
|
||||||
|
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
||||||
|
import com.simibubi.create.content.contraptions.base.KineticTileEntityRenderer;
|
||||||
|
import com.simibubi.create.content.contraptions.components.flywheel.FlywheelBlock;
|
||||||
|
import com.simibubi.create.content.contraptions.components.flywheel.FlywheelTileEntity;
|
||||||
|
import com.simibubi.create.foundation.render.PartialBufferer;
|
||||||
|
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
||||||
|
import com.simibubi.create.foundation.utility.AngleHelper;
|
||||||
|
import com.teammoeg.steampowered.SPBlockPartials;
|
||||||
|
import com.teammoeg.steampowered.mixin.FlywheelTileEntityAccess;
|
||||||
|
import net.minecraft.block.BlockState;
|
||||||
|
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||||
|
import net.minecraft.client.renderer.RenderType;
|
||||||
|
import net.minecraft.client.renderer.WorldRenderer;
|
||||||
|
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||||
|
import net.minecraft.state.properties.BlockStateProperties;
|
||||||
|
import net.minecraft.util.Direction;
|
||||||
|
import net.minecraft.util.Rotation;
|
||||||
|
import net.minecraft.util.math.MathHelper;
|
||||||
|
|
||||||
|
public class BronzeFlywheelRenderer extends KineticTileEntityRenderer {
|
||||||
|
public BronzeFlywheelRenderer(TileEntityRendererDispatcher dispatcher) {
|
||||||
|
super(dispatcher);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void renderSafe(KineticTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer, int light, int overlay) {
|
||||||
|
super.renderSafe(te, partialTicks, ms, buffer, light, overlay);
|
||||||
|
if (!Backend.getInstance().canUseInstancing(te.getLevel())) {
|
||||||
|
BlockState blockState = te.getBlockState();
|
||||||
|
FlywheelTileEntity wte = (FlywheelTileEntity)te;
|
||||||
|
// Mixin starts
|
||||||
|
FlywheelTileEntityAccess access = (FlywheelTileEntityAccess) wte;
|
||||||
|
float speed = access.getVisualSpeed().get(partialTicks) * 3.0F / 10.0F;
|
||||||
|
float angle = access.getAngle() + speed * partialTicks;
|
||||||
|
// Mixin ends
|
||||||
|
IVertexBuilder vb = buffer.getBuffer(RenderType.solid());
|
||||||
|
if (FlywheelBlock.isConnected(blockState)) {
|
||||||
|
Direction connection = FlywheelBlock.getConnection(blockState);
|
||||||
|
light = WorldRenderer.getLightColor(te.getLevel(), blockState, te.getBlockPos().relative(connection));
|
||||||
|
float rotation = connection.getAxis() == Direction.Axis.X ^ connection.getAxisDirection() == Direction.AxisDirection.NEGATIVE ? -angle : angle;
|
||||||
|
boolean flip = blockState.getValue(FlywheelBlock.CONNECTION) == FlywheelBlock.ConnectionState.LEFT;
|
||||||
|
this.transformConnector(this.rotateToFacing(PartialBufferer.get(SPBlockPartials.BRONZE_FLYWHEEL_UPPER_ROTATING, blockState), connection), true, true, rotation, flip).light(light).renderInto(ms, vb);
|
||||||
|
this.transformConnector(this.rotateToFacing(PartialBufferer.get(SPBlockPartials.BRONZE_FLYWHEEL_LOWER_ROTATING, blockState), connection), false, true, rotation, flip).light(light).renderInto(ms, vb);
|
||||||
|
this.transformConnector(this.rotateToFacing(PartialBufferer.get(SPBlockPartials.BRONZE_FLYWHEEL_UPPER_SLIDING, blockState), connection), true, false, rotation, flip).light(light).renderInto(ms, vb);
|
||||||
|
this.transformConnector(this.rotateToFacing(PartialBufferer.get(SPBlockPartials.BRONZE_FLYWHEEL_LOWER_SLIDING, blockState), connection), false, false, rotation, flip).light(light).renderInto(ms, vb);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.renderFlywheel(te, ms, light, blockState, angle, vb);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void renderFlywheel(KineticTileEntity te, MatrixStack ms, int light, BlockState blockState, float angle, IVertexBuilder vb) {
|
||||||
|
BlockState referenceState = blockState.rotate(Rotation.CLOCKWISE_90);
|
||||||
|
Direction facing = (Direction)referenceState.getValue(BlockStateProperties.HORIZONTAL_FACING);
|
||||||
|
SuperByteBuffer wheel = PartialBufferer.getFacing(SPBlockPartials.BRONZE_FLYWHEEL, referenceState, facing);
|
||||||
|
kineticRotationTransform(wheel, te, ((Direction)blockState.getValue(HorizontalKineticBlock.HORIZONTAL_FACING)).getAxis(), AngleHelper.rad((double)angle), light);
|
||||||
|
wheel.renderInto(ms, vb);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected SuperByteBuffer getRotatedModel(KineticTileEntity te) {
|
||||||
|
return PartialBufferer.getFacing(AllBlockPartials.SHAFT_HALF, te.getBlockState(), ((Direction)te.getBlockState().getValue(BlockStateProperties.HORIZONTAL_FACING)).getOpposite());
|
||||||
|
}
|
||||||
|
|
||||||
|
protected SuperByteBuffer transformConnector(SuperByteBuffer buffer, boolean upper, boolean rotating, float angle, boolean flip) {
|
||||||
|
float shift = upper ? 0.25F : -0.125F;
|
||||||
|
float offset = upper ? 0.25F : 0.25F;
|
||||||
|
float radians = (float)((double)(angle / 180.0F) * 3.141592653589793D);
|
||||||
|
float shifting = MathHelper.sin(radians) * shift + offset;
|
||||||
|
float maxAngle = upper ? -5.0F : -15.0F;
|
||||||
|
float minAngle = upper ? -45.0F : 5.0F;
|
||||||
|
float barAngle = 0.0F;
|
||||||
|
if (rotating) {
|
||||||
|
barAngle = MathHelper.lerp((MathHelper.sin((float)((double)radians + 1.5707963267948966D)) + 1.0F) / 2.0F, minAngle, maxAngle);
|
||||||
|
}
|
||||||
|
|
||||||
|
float pivotX = (upper ? 8.0F : 3.0F) / 16.0F;
|
||||||
|
float pivotY = (upper ? 8.0F : 2.0F) / 16.0F;
|
||||||
|
float pivotZ = (upper ? 23.0F : 21.5F) / 16.0F;
|
||||||
|
buffer.translate(pivotX, pivotY, pivotZ + shifting);
|
||||||
|
if (rotating) {
|
||||||
|
buffer.rotate(Direction.EAST, AngleHelper.rad((double)barAngle));
|
||||||
|
}
|
||||||
|
|
||||||
|
buffer.translate(-pivotX, -pivotY, -pivotZ);
|
||||||
|
if (flip && !upper) {
|
||||||
|
buffer.translate(0.5625F, 0.0F, 0.0F);
|
||||||
|
}
|
||||||
|
|
||||||
|
return buffer;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected SuperByteBuffer rotateToFacing(SuperByteBuffer buffer, Direction facing) {
|
||||||
|
buffer.rotateCentered(Direction.UP, AngleHelper.rad((double)AngleHelper.horizontalAngle(facing)));
|
||||||
|
return buffer;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,203 @@
|
||||||
|
package com.teammoeg.steampowered.instance;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import com.jozufozu.flywheel.backend.instancing.IDynamicInstance;
|
||||||
|
import com.jozufozu.flywheel.backend.instancing.InstanceData;
|
||||||
|
import com.jozufozu.flywheel.backend.instancing.Instancer;
|
||||||
|
import com.jozufozu.flywheel.backend.material.InstanceMaterial;
|
||||||
|
import com.jozufozu.flywheel.backend.material.MaterialManager;
|
||||||
|
import com.jozufozu.flywheel.core.materials.ModelData;
|
||||||
|
import com.jozufozu.flywheel.util.transform.MatrixTransformStack;
|
||||||
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
|
import com.simibubi.create.AllBlockPartials;
|
||||||
|
import com.simibubi.create.content.contraptions.base.KineticTileInstance;
|
||||||
|
import com.simibubi.create.content.contraptions.base.RotatingData;
|
||||||
|
import com.simibubi.create.content.contraptions.components.flywheel.FlywheelBlock;
|
||||||
|
import com.simibubi.create.content.contraptions.components.flywheel.FlywheelTileEntity;
|
||||||
|
import com.simibubi.create.foundation.utility.AngleHelper;
|
||||||
|
import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
||||||
|
import com.teammoeg.steampowered.SPBlockPartials;
|
||||||
|
import com.teammoeg.steampowered.mixin.FlywheelTileEntityAccess;
|
||||||
|
import net.minecraft.block.BlockState;
|
||||||
|
import net.minecraft.util.Direction;
|
||||||
|
import net.minecraft.util.Rotation;
|
||||||
|
import net.minecraft.util.math.MathHelper;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static net.minecraft.state.properties.BlockStateProperties.HORIZONTAL_FACING;
|
||||||
|
|
||||||
|
public class BronzeFlywheelInstance extends KineticTileInstance<FlywheelTileEntity> implements IDynamicInstance {
|
||||||
|
protected final Direction facing;
|
||||||
|
protected final Direction connection;
|
||||||
|
|
||||||
|
protected boolean connectedLeft;
|
||||||
|
protected float connectorAngleMult;
|
||||||
|
|
||||||
|
protected final RotatingData shaft;
|
||||||
|
|
||||||
|
protected final ModelData wheel;
|
||||||
|
|
||||||
|
protected List<ModelData> connectors;
|
||||||
|
protected ModelData upperRotating;
|
||||||
|
protected ModelData lowerRotating;
|
||||||
|
protected ModelData upperSliding;
|
||||||
|
protected ModelData lowerSliding;
|
||||||
|
|
||||||
|
protected float lastAngle = Float.NaN;
|
||||||
|
|
||||||
|
public BronzeFlywheelInstance(MaterialManager<?> modelManager, FlywheelTileEntity tile) {
|
||||||
|
super(modelManager, tile);
|
||||||
|
|
||||||
|
facing = blockState.getValue(HORIZONTAL_FACING);
|
||||||
|
|
||||||
|
shaft = setup(shaftModel().createInstance());
|
||||||
|
|
||||||
|
BlockState referenceState = blockState.rotate(Rotation.CLOCKWISE_90);
|
||||||
|
wheel = getTransformMaterial().getModel(SPBlockPartials.BRONZE_FLYWHEEL, referenceState, referenceState.getValue(HORIZONTAL_FACING)).createInstance();
|
||||||
|
|
||||||
|
connection = FlywheelBlock.getConnection(blockState);
|
||||||
|
if (connection != null) {
|
||||||
|
connectedLeft = blockState.getValue(FlywheelBlock.CONNECTION) == FlywheelBlock.ConnectionState.LEFT;
|
||||||
|
|
||||||
|
boolean flipAngle = connection.getAxis() == Direction.Axis.X ^ connection.getAxisDirection() == Direction.AxisDirection.NEGATIVE;
|
||||||
|
|
||||||
|
connectorAngleMult = flipAngle ? -1 : 1;
|
||||||
|
|
||||||
|
InstanceMaterial<ModelData> mat = getTransformMaterial();
|
||||||
|
|
||||||
|
upperRotating = mat.getModel(SPBlockPartials.BRONZE_FLYWHEEL_UPPER_ROTATING, blockState).createInstance();
|
||||||
|
lowerRotating = mat.getModel(SPBlockPartials.BRONZE_FLYWHEEL_LOWER_ROTATING, blockState).createInstance();
|
||||||
|
upperSliding = mat.getModel(SPBlockPartials.BRONZE_FLYWHEEL_UPPER_SLIDING, blockState).createInstance();
|
||||||
|
lowerSliding = mat.getModel(SPBlockPartials.BRONZE_FLYWHEEL_LOWER_SLIDING, blockState).createInstance();
|
||||||
|
|
||||||
|
connectors = Lists.newArrayList(upperRotating, lowerRotating, upperSliding, lowerSliding);
|
||||||
|
} else {
|
||||||
|
connectors = Collections.emptyList();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Mixin
|
||||||
|
FlywheelTileEntityAccess access = (FlywheelTileEntityAccess) tile;
|
||||||
|
animate(access.getAngle());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void beginFrame() {
|
||||||
|
|
||||||
|
float partialTicks = AnimationTickHolder.getPartialTicks();
|
||||||
|
|
||||||
|
// Mixin
|
||||||
|
FlywheelTileEntityAccess access = (FlywheelTileEntityAccess) tile;
|
||||||
|
float speed = access.getVisualSpeed().get(partialTicks) * 3 / 10f;
|
||||||
|
float angle = access.getAngle() + speed * partialTicks;
|
||||||
|
|
||||||
|
if (Math.abs(angle - lastAngle) < 0.001) return;
|
||||||
|
|
||||||
|
animate(angle);
|
||||||
|
|
||||||
|
lastAngle = angle;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void animate(float angle) {
|
||||||
|
MatrixStack ms = new MatrixStack();
|
||||||
|
MatrixTransformStack msr = MatrixTransformStack.of(ms);
|
||||||
|
|
||||||
|
msr.translate(getInstancePosition());
|
||||||
|
|
||||||
|
if (connection != null) {
|
||||||
|
float rotation = angle * connectorAngleMult;
|
||||||
|
|
||||||
|
ms.pushPose();
|
||||||
|
rotateToFacing(msr, connection);
|
||||||
|
|
||||||
|
ms.pushPose();
|
||||||
|
transformConnector(msr, true, true, rotation, connectedLeft);
|
||||||
|
upperRotating.setTransform(ms);
|
||||||
|
ms.popPose();
|
||||||
|
|
||||||
|
ms.pushPose();
|
||||||
|
transformConnector(msr, false, true, rotation, connectedLeft);
|
||||||
|
lowerRotating.setTransform(ms);
|
||||||
|
ms.popPose();
|
||||||
|
|
||||||
|
ms.pushPose();
|
||||||
|
transformConnector(msr, true, false, rotation, connectedLeft);
|
||||||
|
upperSliding.setTransform(ms);
|
||||||
|
ms.popPose();
|
||||||
|
|
||||||
|
ms.pushPose();
|
||||||
|
transformConnector(msr, false, false, rotation, connectedLeft);
|
||||||
|
lowerSliding.setTransform(ms);
|
||||||
|
ms.popPose();
|
||||||
|
|
||||||
|
ms.popPose();
|
||||||
|
}
|
||||||
|
|
||||||
|
msr.centre()
|
||||||
|
.rotate(Direction.get(Direction.AxisDirection.POSITIVE, facing.getAxis()), AngleHelper.rad(angle))
|
||||||
|
.unCentre();
|
||||||
|
|
||||||
|
wheel.setTransform(ms);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void update() {
|
||||||
|
updateRotation(shaft);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateLight() {
|
||||||
|
relight(pos, shaft, wheel);
|
||||||
|
|
||||||
|
if (connection != null) {
|
||||||
|
relight(this.pos.relative(connection), connectors.stream());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void remove() {
|
||||||
|
shaft.delete();
|
||||||
|
wheel.delete();
|
||||||
|
|
||||||
|
connectors.forEach(InstanceData::delete);
|
||||||
|
connectors.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Instancer<RotatingData> shaftModel() {
|
||||||
|
Direction opposite = facing.getOpposite();
|
||||||
|
return getRotatingMaterial().getModel(AllBlockPartials.SHAFT_HALF, blockState, opposite);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void transformConnector(MatrixTransformStack ms, boolean upper, boolean rotating, float angle, boolean flip) {
|
||||||
|
float shift = upper ? 1 / 4f : -1 / 8f;
|
||||||
|
float offset = upper ? 1 / 4f : 1 / 4f;
|
||||||
|
float radians = (float) (angle / 180 * Math.PI);
|
||||||
|
float shifting = MathHelper.sin(radians) * shift + offset;
|
||||||
|
|
||||||
|
float maxAngle = upper ? -5 : -15;
|
||||||
|
float minAngle = upper ? -45 : 5;
|
||||||
|
float barAngle = 0;
|
||||||
|
|
||||||
|
if (rotating)
|
||||||
|
barAngle = MathHelper.lerp((MathHelper.sin((float) (radians + Math.PI / 2)) + 1) / 2, minAngle, maxAngle);
|
||||||
|
|
||||||
|
float pivotX = (upper ? 8f : 3f) / 16;
|
||||||
|
float pivotY = (upper ? 8f : 2f) / 16;
|
||||||
|
float pivotZ = (upper ? 23f : 21.5f) / 16f;
|
||||||
|
|
||||||
|
ms.translate(pivotX, pivotY, pivotZ + shifting);
|
||||||
|
if (rotating)
|
||||||
|
ms.rotate(Direction.EAST, AngleHelper.rad(barAngle));
|
||||||
|
ms.translate(-pivotX, -pivotY, -pivotZ);
|
||||||
|
|
||||||
|
if (flip && !upper)
|
||||||
|
ms.translate(9 / 16f, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void rotateToFacing(MatrixTransformStack buffer, Direction facing) {
|
||||||
|
buffer.centre()
|
||||||
|
.rotate(Direction.UP, AngleHelper.rad(AngleHelper.horizontalAngle(facing)))
|
||||||
|
.unCentre();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
package com.teammoeg.steampowered.mixin;
|
||||||
|
|
||||||
|
import com.simibubi.create.content.contraptions.components.flywheel.FlywheelTileEntity;
|
||||||
|
import com.simibubi.create.foundation.gui.widgets.InterpolatedChasingValue;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||||
|
|
||||||
|
@Mixin(FlywheelTileEntity.class)
|
||||||
|
public interface FlywheelTileEntityAccess {
|
||||||
|
@Accessor(remap = false)
|
||||||
|
InterpolatedChasingValue getVisualSpeed();
|
||||||
|
|
||||||
|
@Accessor(remap = false)
|
||||||
|
float getAngle();
|
||||||
|
}
|
|
@ -12,7 +12,7 @@ public class SPPonderIndex {
|
||||||
static final PonderRegistrationHelper CREATE_HELPER = new PonderRegistrationHelper(Create.ID);
|
static final PonderRegistrationHelper CREATE_HELPER = new PonderRegistrationHelper(Create.ID);
|
||||||
static final PonderRegistrationHelper STEAM_HELPER = new PonderRegistrationHelper(SteamPowered.MODID);
|
static final PonderRegistrationHelper STEAM_HELPER = new PonderRegistrationHelper(SteamPowered.MODID);
|
||||||
|
|
||||||
public static final PonderTag STEAM = new PonderTag(new ResourceLocation(SteamPowered.MODID, "steam")).item(SPBlocks.STEAM_ENGINE.get(), true, false)
|
public static final PonderTag STEAM = new PonderTag(new ResourceLocation(SteamPowered.MODID, "steam")).item(SPBlocks.BRONZE_STEAM_ENGINE.get(), true, false)
|
||||||
.defaultLang("Steam", "Components related to steam production and usage");
|
.defaultLang("Steam", "Components related to steam production and usage");
|
||||||
|
|
||||||
public static void register() {
|
public static void register() {
|
||||||
|
@ -24,7 +24,7 @@ public class SPPonderIndex {
|
||||||
.addStoryBoard(new ResourceLocation("create", "cog/speedup"), KineticsScenes::cogsSpeedUp)
|
.addStoryBoard(new ResourceLocation("create", "cog/speedup"), KineticsScenes::cogsSpeedUp)
|
||||||
.addStoryBoard(new ResourceLocation("create", "cog/large"), KineticsScenes::largeCogAsRelay, PonderTag.KINETIC_RELAYS);
|
.addStoryBoard(new ResourceLocation("create", "cog/large"), KineticsScenes::largeCogAsRelay, PonderTag.KINETIC_RELAYS);
|
||||||
|
|
||||||
STEAM_HELPER.forComponents(SPBlocks.STEAM_ENGINE)
|
STEAM_HELPER.forComponents(SPBlocks.BRONZE_STEAM_ENGINE)
|
||||||
.addStoryBoard("steam_engine", SPScenes::steamEngine, PonderTag.KINETIC_SOURCES, STEAM);
|
.addStoryBoard("steam_engine", SPScenes::steamEngine, PonderTag.KINETIC_SOURCES, STEAM);
|
||||||
|
|
||||||
STEAM_HELPER.forComponents(SPBlocks.ALTERNATOR)
|
STEAM_HELPER.forComponents(SPBlocks.ALTERNATOR)
|
||||||
|
|
|
@ -9,7 +9,6 @@ import com.simibubi.create.foundation.ponder.elements.WorldSectionElement;
|
||||||
import com.teammoeg.steampowered.block.SteamEngineBlock;
|
import com.teammoeg.steampowered.block.SteamEngineBlock;
|
||||||
import com.teammoeg.steampowered.registrate.SPBlocks;
|
import com.teammoeg.steampowered.registrate.SPBlocks;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.block.FurnaceBlock;
|
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
|
||||||
|
@ -54,7 +53,7 @@ public class SPScenes {
|
||||||
scene.world.hideSection(furnaceSelect, Direction.NORTH);
|
scene.world.hideSection(furnaceSelect, Direction.NORTH);
|
||||||
scene.idle(15);
|
scene.idle(15);
|
||||||
// Change engine
|
// Change engine
|
||||||
scene.world.setBlock(enginePos, (BlockState) ((BlockState) SPBlocks.STEAM_ENGINE.get().defaultBlockState().setValue(FurnaceBlock.FACING, Direction.NORTH)).setValue(SteamEngineBlock.LIT, true), false);
|
scene.world.setBlock(enginePos, (BlockState) ((BlockState) SPBlocks.BRONZE_STEAM_ENGINE.get().defaultBlockState().setValue(SteamEngineBlock.FACING, Direction.NORTH)).setValue(SteamEngineBlock.LIT, true), false);
|
||||||
scene.world.showSection(furnaceSelect, Direction.NORTH);
|
scene.world.showSection(furnaceSelect, Direction.NORTH);
|
||||||
scene.idle(10);
|
scene.idle(10);
|
||||||
scene.world.moveSection(engine, util.vector.of(0.0D, -1.0D, 0.0D), 15);
|
scene.world.moveSection(engine, util.vector.of(0.0D, -1.0D, 0.0D), 15);
|
||||||
|
|
|
@ -3,6 +3,8 @@ package com.teammoeg.steampowered.registrate;
|
||||||
import com.simibubi.create.AllTags;
|
import com.simibubi.create.AllTags;
|
||||||
import com.simibubi.create.Create;
|
import com.simibubi.create.Create;
|
||||||
import com.simibubi.create.content.AllSections;
|
import com.simibubi.create.content.AllSections;
|
||||||
|
import com.simibubi.create.content.contraptions.components.flywheel.FlywheelBlock;
|
||||||
|
import com.simibubi.create.content.contraptions.components.flywheel.FlywheelGenerator;
|
||||||
import com.simibubi.create.content.contraptions.relays.elementary.BracketedKineticBlockModel;
|
import com.simibubi.create.content.contraptions.relays.elementary.BracketedKineticBlockModel;
|
||||||
import com.simibubi.create.content.contraptions.relays.elementary.CogwheelBlockItem;
|
import com.simibubi.create.content.contraptions.relays.elementary.CogwheelBlockItem;
|
||||||
import com.simibubi.create.foundation.block.BlockStressDefaults;
|
import com.simibubi.create.foundation.block.BlockStressDefaults;
|
||||||
|
@ -11,25 +13,40 @@ import com.simibubi.create.foundation.data.CreateRegistrate;
|
||||||
import com.simibubi.create.foundation.data.SharedProperties;
|
import com.simibubi.create.foundation.data.SharedProperties;
|
||||||
import com.simibubi.create.repack.registrate.util.entry.BlockEntry;
|
import com.simibubi.create.repack.registrate.util.entry.BlockEntry;
|
||||||
import com.teammoeg.steampowered.SteamPowered;
|
import com.teammoeg.steampowered.SteamPowered;
|
||||||
import com.teammoeg.steampowered.block.AlternatorBlock;
|
import com.teammoeg.steampowered.block.*;
|
||||||
import com.teammoeg.steampowered.block.MetalCogwheelBlock;
|
import net.minecraft.block.AbstractBlock;
|
||||||
import com.teammoeg.steampowered.block.SteamEngineBlock;
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.Blocks;
|
||||||
import net.minecraft.block.SoundType;
|
import net.minecraft.block.SoundType;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
import static com.simibubi.create.foundation.data.ModelGen.customItemModel;
|
import static com.simibubi.create.foundation.data.ModelGen.customItemModel;
|
||||||
|
|
||||||
public class SPBlocks {
|
public class SPBlocks {
|
||||||
private static final CreateRegistrate REGISTRATE = SteamPowered.registrate.get()
|
private static final CreateRegistrate REGISTRATE = SteamPowered.registrate.get()
|
||||||
.itemGroup(() -> SteamPowered.itemGroup);
|
.itemGroup(() -> SteamPowered.itemGroup);
|
||||||
|
|
||||||
public static final BlockEntry<SteamEngineBlock> STEAM_ENGINE = REGISTRATE.block("steam_engine", SteamEngineBlock::new)
|
public static final BlockEntry<BronzeSteamEngineBlock> BRONZE_STEAM_ENGINE = REGISTRATE.block("bronze_steam_engine", BronzeSteamEngineBlock::new)
|
||||||
.initialProperties(SharedProperties::stone)
|
.initialProperties(SharedProperties::softMetal)
|
||||||
|
.item()
|
||||||
|
.transform(customItemModel())
|
||||||
|
.register();
|
||||||
|
|
||||||
|
public static final BlockEntry<CastIronSteamEngineBlock> CAST_IRON_STEAM_ENGINE = REGISTRATE.block("cast_iron_steam_engine", CastIronSteamEngineBlock::new)
|
||||||
|
.initialProperties(SPBlocks::hardMetal)
|
||||||
|
.item()
|
||||||
|
.transform(customItemModel())
|
||||||
|
.register();
|
||||||
|
|
||||||
|
public static final BlockEntry<SteelSteamEngineBlock> STEEL_STEAM_ENGINE = REGISTRATE.block("steel_steam_engine", SteelSteamEngineBlock::new)
|
||||||
|
.initialProperties(SPBlocks::hardMetal)
|
||||||
.item()
|
.item()
|
||||||
.transform(customItemModel())
|
.transform(customItemModel())
|
||||||
.register();
|
.register();
|
||||||
|
|
||||||
public static final BlockEntry<MetalCogwheelBlock> STEEL_COGWHEEL = REGISTRATE.block("steel_cogwheel", MetalCogwheelBlock::small)
|
public static final BlockEntry<MetalCogwheelBlock> STEEL_COGWHEEL = REGISTRATE.block("steel_cogwheel", MetalCogwheelBlock::small)
|
||||||
.initialProperties(SharedProperties::softMetal)
|
.initialProperties(SPBlocks::hardMetal)
|
||||||
.transform(BlockStressDefaults.setImpact(0.1))
|
.transform(BlockStressDefaults.setImpact(0.1))
|
||||||
.properties(p -> p.sound(SoundType.METAL))
|
.properties(p -> p.sound(SoundType.METAL))
|
||||||
.blockstate(BlockStateGen.axisBlockProvider(false))
|
.blockstate(BlockStateGen.axisBlockProvider(false))
|
||||||
|
@ -39,7 +56,7 @@ public class SPBlocks {
|
||||||
.register();
|
.register();
|
||||||
|
|
||||||
public static final BlockEntry<MetalCogwheelBlock> STEEL_LARGE_COGWHEEL = REGISTRATE.block("steel_large_cogwheel", MetalCogwheelBlock::large)
|
public static final BlockEntry<MetalCogwheelBlock> STEEL_LARGE_COGWHEEL = REGISTRATE.block("steel_large_cogwheel", MetalCogwheelBlock::large)
|
||||||
.initialProperties(SharedProperties::softMetal)
|
.initialProperties(SPBlocks::hardMetal)
|
||||||
.transform(BlockStressDefaults.setImpact(0.1))
|
.transform(BlockStressDefaults.setImpact(0.1))
|
||||||
.properties(p -> p.sound(SoundType.METAL))
|
.properties(p -> p.sound(SoundType.METAL))
|
||||||
.blockstate(BlockStateGen.axisBlockProvider(false))
|
.blockstate(BlockStateGen.axisBlockProvider(false))
|
||||||
|
@ -49,7 +66,7 @@ public class SPBlocks {
|
||||||
.register();
|
.register();
|
||||||
|
|
||||||
public static final BlockEntry<MetalCogwheelBlock> CAST_IRON_COGWHEEL = REGISTRATE.block("cast_iron_cogwheel", MetalCogwheelBlock::small)
|
public static final BlockEntry<MetalCogwheelBlock> CAST_IRON_COGWHEEL = REGISTRATE.block("cast_iron_cogwheel", MetalCogwheelBlock::small)
|
||||||
.initialProperties(SharedProperties::softMetal)
|
.initialProperties(SPBlocks::hardMetal)
|
||||||
.transform(BlockStressDefaults.setImpact(0.2))
|
.transform(BlockStressDefaults.setImpact(0.2))
|
||||||
.properties(p -> p.sound(SoundType.METAL))
|
.properties(p -> p.sound(SoundType.METAL))
|
||||||
.blockstate(BlockStateGen.axisBlockProvider(false))
|
.blockstate(BlockStateGen.axisBlockProvider(false))
|
||||||
|
@ -59,7 +76,7 @@ public class SPBlocks {
|
||||||
.register();
|
.register();
|
||||||
|
|
||||||
public static final BlockEntry<MetalCogwheelBlock> CAST_IRON_LARGE_COGWHEEL = REGISTRATE.block("cast_iron_large_cogwheel", MetalCogwheelBlock::large)
|
public static final BlockEntry<MetalCogwheelBlock> CAST_IRON_LARGE_COGWHEEL = REGISTRATE.block("cast_iron_large_cogwheel", MetalCogwheelBlock::large)
|
||||||
.initialProperties(SharedProperties::softMetal)
|
.initialProperties(SPBlocks::hardMetal)
|
||||||
.transform(BlockStressDefaults.setImpact(0.2))
|
.transform(BlockStressDefaults.setImpact(0.2))
|
||||||
.properties(p -> p.sound(SoundType.METAL))
|
.properties(p -> p.sound(SoundType.METAL))
|
||||||
.blockstate(BlockStateGen.axisBlockProvider(false))
|
.blockstate(BlockStateGen.axisBlockProvider(false))
|
||||||
|
@ -89,20 +106,57 @@ public class SPBlocks {
|
||||||
.register();
|
.register();
|
||||||
|
|
||||||
public static final BlockEntry<AlternatorBlock> ALTERNATOR = REGISTRATE.block("alternator", AlternatorBlock::new)
|
public static final BlockEntry<AlternatorBlock> ALTERNATOR = REGISTRATE.block("alternator", AlternatorBlock::new)
|
||||||
.initialProperties(SharedProperties::stone)
|
.initialProperties(SPBlocks::hardMetal)
|
||||||
.transform(BlockStressDefaults.setImpact(4.0))
|
.transform(BlockStressDefaults.setImpact(4.0))
|
||||||
.tag(AllTags.AllBlockTags.SAFE_NBT.tag) //Dono what this tag means (contraption safe?).
|
.tag(AllTags.AllBlockTags.SAFE_NBT.tag) //Dono what this tag means (contraption safe?).
|
||||||
.item()
|
.item()
|
||||||
.transform(customItemModel())
|
.transform(customItemModel())
|
||||||
.register();
|
.register();
|
||||||
|
|
||||||
|
public static final BlockEntry<SteamFlywheelBlock> BRONZE_FLYWHEEL = REGISTRATE.block("bronze_flywheel", SteamFlywheelBlock::new)
|
||||||
|
.initialProperties(SharedProperties::softMetal)
|
||||||
|
.properties(AbstractBlock.Properties::noOcclusion)
|
||||||
|
.transform(BlockStressDefaults.setNoImpact())
|
||||||
|
.blockstate(new FlywheelGenerator()::generate)
|
||||||
|
.item()
|
||||||
|
.transform(customItemModel())
|
||||||
|
.register();
|
||||||
|
|
||||||
|
public static final BlockEntry<SteamFlywheelBlock> CAST_IRON_FLYWHEEL = REGISTRATE.block("cast_iron_flywheel", SteamFlywheelBlock::new)
|
||||||
|
.initialProperties(SPBlocks::hardMetal)
|
||||||
|
.properties(AbstractBlock.Properties::noOcclusion)
|
||||||
|
.transform(BlockStressDefaults.setNoImpact())
|
||||||
|
.blockstate(new FlywheelGenerator()::generate)
|
||||||
|
.item()
|
||||||
|
.transform(customItemModel())
|
||||||
|
.register();
|
||||||
|
|
||||||
|
public static final BlockEntry<SteamFlywheelBlock> STEEL_FLYWHEEL = REGISTRATE.block("steel_flywheel", SteamFlywheelBlock::new)
|
||||||
|
.initialProperties(SPBlocks::hardMetal)
|
||||||
|
.properties(AbstractBlock.Properties::noOcclusion)
|
||||||
|
.transform(BlockStressDefaults.setNoImpact())
|
||||||
|
.blockstate(new FlywheelGenerator()::generate)
|
||||||
|
.item()
|
||||||
|
.transform(customItemModel())
|
||||||
|
.register();
|
||||||
|
|
||||||
public static void register() {
|
public static void register() {
|
||||||
Create.registrate().addToSection(STEAM_ENGINE, AllSections.KINETICS);
|
Create.registrate().addToSection(BRONZE_STEAM_ENGINE, AllSections.KINETICS);
|
||||||
|
Create.registrate().addToSection(CAST_IRON_STEAM_ENGINE, AllSections.KINETICS);
|
||||||
|
Create.registrate().addToSection(STEEL_STEAM_ENGINE, AllSections.KINETICS);
|
||||||
Create.registrate().addToSection(STEEL_COGWHEEL, AllSections.KINETICS);
|
Create.registrate().addToSection(STEEL_COGWHEEL, AllSections.KINETICS);
|
||||||
Create.registrate().addToSection(STEEL_LARGE_COGWHEEL, AllSections.KINETICS);
|
Create.registrate().addToSection(STEEL_LARGE_COGWHEEL, AllSections.KINETICS);
|
||||||
Create.registrate().addToSection(CAST_IRON_COGWHEEL, AllSections.KINETICS);
|
Create.registrate().addToSection(CAST_IRON_COGWHEEL, AllSections.KINETICS);
|
||||||
Create.registrate().addToSection(CAST_IRON_LARGE_COGWHEEL, AllSections.KINETICS);
|
Create.registrate().addToSection(CAST_IRON_LARGE_COGWHEEL, AllSections.KINETICS);
|
||||||
Create.registrate().addToSection(BRONZE_COGWHEEL, AllSections.KINETICS);
|
Create.registrate().addToSection(BRONZE_COGWHEEL, AllSections.KINETICS);
|
||||||
Create.registrate().addToSection(BRONZE_LARGE_COGWHEEL, AllSections.KINETICS);
|
Create.registrate().addToSection(BRONZE_LARGE_COGWHEEL, AllSections.KINETICS);
|
||||||
|
Create.registrate().addToSection(BRONZE_FLYWHEEL, AllSections.KINETICS);
|
||||||
|
Create.registrate().addToSection(CAST_IRON_FLYWHEEL, AllSections.KINETICS);
|
||||||
|
Create.registrate().addToSection(STEEL_FLYWHEEL, AllSections.KINETICS);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
|
public static Block hardMetal() {
|
||||||
|
return Blocks.IRON_BLOCK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,21 +3,34 @@ package com.teammoeg.steampowered.registrate;
|
||||||
import com.simibubi.create.content.contraptions.base.HalfShaftInstance;
|
import com.simibubi.create.content.contraptions.base.HalfShaftInstance;
|
||||||
import com.simibubi.create.content.contraptions.base.KineticTileEntityRenderer;
|
import com.simibubi.create.content.contraptions.base.KineticTileEntityRenderer;
|
||||||
import com.simibubi.create.content.contraptions.base.SingleRotatingInstance;
|
import com.simibubi.create.content.contraptions.base.SingleRotatingInstance;
|
||||||
|
import com.simibubi.create.content.contraptions.components.flywheel.FlyWheelInstance;
|
||||||
|
import com.simibubi.create.content.contraptions.components.flywheel.FlywheelRenderer;
|
||||||
|
import com.simibubi.create.content.contraptions.components.flywheel.FlywheelTileEntity;
|
||||||
import com.simibubi.create.foundation.data.CreateRegistrate;
|
import com.simibubi.create.foundation.data.CreateRegistrate;
|
||||||
import com.simibubi.create.repack.registrate.util.entry.TileEntityEntry;
|
import com.simibubi.create.repack.registrate.util.entry.TileEntityEntry;
|
||||||
import com.teammoeg.steampowered.SteamPowered;
|
import com.teammoeg.steampowered.SteamPowered;
|
||||||
import com.teammoeg.steampowered.client.render.AlternatorRenderer;
|
import com.teammoeg.steampowered.client.render.AlternatorRenderer;
|
||||||
import com.teammoeg.steampowered.tileentity.AlternatorTileEntity;
|
import com.teammoeg.steampowered.client.render.BronzeFlywheelRenderer;
|
||||||
import com.teammoeg.steampowered.tileentity.MetalCogwheelTileEntity;
|
import com.teammoeg.steampowered.instance.BronzeFlywheelInstance;
|
||||||
import com.teammoeg.steampowered.tileentity.SteamEngineTileEntity;
|
import com.teammoeg.steampowered.tileentity.*;
|
||||||
|
|
||||||
public class SPTiles {
|
public class SPTiles {
|
||||||
private static final CreateRegistrate REGISTRATE = SteamPowered.registrate.get()
|
private static final CreateRegistrate REGISTRATE = SteamPowered.registrate.get()
|
||||||
.itemGroup(() -> SteamPowered.itemGroup);
|
.itemGroup(() -> SteamPowered.itemGroup);
|
||||||
|
|
||||||
public static final TileEntityEntry<SteamEngineTileEntity> STEAM_ENGINE = REGISTRATE
|
public static final TileEntityEntry<BronzeSteamEngineTileEntity> BRONZE_STEAM_ENGINE = REGISTRATE
|
||||||
.tileEntity("steam_engine", SteamEngineTileEntity::new)
|
.tileEntity("bronze_steam_engine", BronzeSteamEngineTileEntity::new)
|
||||||
.validBlocks(SPBlocks.STEAM_ENGINE)
|
.validBlocks(SPBlocks.BRONZE_STEAM_ENGINE)
|
||||||
|
.register();
|
||||||
|
|
||||||
|
public static final TileEntityEntry<CastIronSteamEngineTileEntity> CAST_IRON_STEAM_ENGINE = REGISTRATE
|
||||||
|
.tileEntity("cast_iron_steam_engine", CastIronSteamEngineTileEntity::new)
|
||||||
|
.validBlocks(SPBlocks.CAST_IRON_STEAM_ENGINE)
|
||||||
|
.register();
|
||||||
|
|
||||||
|
public static final TileEntityEntry<SteelSteamEngineTileEntity> STEEL_STEAM_ENGINE = REGISTRATE
|
||||||
|
.tileEntity("steel_steam_engine", SteelSteamEngineTileEntity::new)
|
||||||
|
.validBlocks(SPBlocks.STEEL_STEAM_ENGINE)
|
||||||
.register();
|
.register();
|
||||||
|
|
||||||
public static final TileEntityEntry<MetalCogwheelTileEntity> METAL_COGWHEEL = REGISTRATE
|
public static final TileEntityEntry<MetalCogwheelTileEntity> METAL_COGWHEEL = REGISTRATE
|
||||||
|
@ -34,6 +47,13 @@ public class SPTiles {
|
||||||
.renderer(() -> AlternatorRenderer::new)
|
.renderer(() -> AlternatorRenderer::new)
|
||||||
.register();
|
.register();
|
||||||
|
|
||||||
|
public static final TileEntityEntry<FlywheelTileEntity> STEAM_FLYWHEEL = REGISTRATE
|
||||||
|
.tileEntity("steam_flywheel", FlywheelTileEntity::new)
|
||||||
|
.instance(() -> BronzeFlywheelInstance::new)
|
||||||
|
.validBlocks(SPBlocks.BRONZE_FLYWHEEL, SPBlocks.CAST_IRON_FLYWHEEL, SPBlocks.STEEL_FLYWHEEL)
|
||||||
|
.renderer(() -> BronzeFlywheelRenderer::new)
|
||||||
|
.register();
|
||||||
|
|
||||||
public static void register() {
|
public static void register() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
package com.teammoeg.steampowered.tileentity;
|
||||||
|
|
||||||
|
import com.teammoeg.steampowered.registrate.SPBlocks;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.tileentity.TileEntityType;
|
||||||
|
|
||||||
|
public class BronzeSteamEngineTileEntity extends SteamEngineTileEntity {
|
||||||
|
public BronzeSteamEngineTileEntity(TileEntityType<? extends SteamEngineTileEntity> type) {
|
||||||
|
super(type);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Block getFlywheel() {
|
||||||
|
return SPBlocks.BRONZE_FLYWHEEL.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getGeneratingCapacity() {
|
||||||
|
return 32F;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getGeneratingSpeed() {
|
||||||
|
return 32F;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getSteamConsumptionPerTick() {
|
||||||
|
return 32;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getSteamStorage() {
|
||||||
|
return 32000;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,36 @@
|
||||||
|
package com.teammoeg.steampowered.tileentity;
|
||||||
|
|
||||||
|
import com.teammoeg.steampowered.registrate.SPBlocks;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.tileentity.TileEntityType;
|
||||||
|
|
||||||
|
public class CastIronSteamEngineTileEntity extends SteamEngineTileEntity {
|
||||||
|
public CastIronSteamEngineTileEntity(TileEntityType<? extends SteamEngineTileEntity> type) {
|
||||||
|
super(type);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Block getFlywheel() {
|
||||||
|
return SPBlocks.CAST_IRON_FLYWHEEL.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getGeneratingCapacity() {
|
||||||
|
return 64F;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getGeneratingSpeed() {
|
||||||
|
return 32F;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getSteamConsumptionPerTick() {
|
||||||
|
return 64;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getSteamStorage() {
|
||||||
|
return 64000;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,15 +1,21 @@
|
||||||
package com.teammoeg.steampowered.tileentity;
|
package com.teammoeg.steampowered.tileentity;
|
||||||
|
|
||||||
|
import com.simibubi.create.content.contraptions.components.flywheel.FlywheelBlock;
|
||||||
|
import com.simibubi.create.content.contraptions.components.flywheel.FlywheelTileEntity;
|
||||||
|
import com.simibubi.create.content.contraptions.components.flywheel.engine.EngineBlock;
|
||||||
import com.simibubi.create.content.contraptions.components.flywheel.engine.EngineTileEntity;
|
import com.simibubi.create.content.contraptions.components.flywheel.engine.EngineTileEntity;
|
||||||
import com.simibubi.create.content.contraptions.goggles.IHaveGoggleInformation;
|
import com.simibubi.create.content.contraptions.goggles.IHaveGoggleInformation;
|
||||||
import com.teammoeg.steampowered.FluidRegistry;
|
import com.teammoeg.steampowered.FluidRegistry;
|
||||||
import com.teammoeg.steampowered.block.SteamEngineBlock;
|
import com.teammoeg.steampowered.block.SteamEngineBlock;
|
||||||
import com.teammoeg.steampowered.network.PacketHandler;
|
import com.teammoeg.steampowered.network.PacketHandler;
|
||||||
import com.teammoeg.steampowered.network.TileSyncPacket;
|
import com.teammoeg.steampowered.network.TileSyncPacket;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.nbt.CompoundNBT;
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.tileentity.TileEntityType;
|
import net.minecraft.tileentity.TileEntityType;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.text.ITextComponent;
|
import net.minecraft.util.text.ITextComponent;
|
||||||
import net.minecraftforge.common.capabilities.Capability;
|
import net.minecraftforge.common.capabilities.Capability;
|
||||||
import net.minecraftforge.common.util.LazyOptional;
|
import net.minecraftforge.common.util.LazyOptional;
|
||||||
|
@ -22,44 +28,21 @@ import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class SteamEngineTileEntity extends EngineTileEntity implements IHaveGoggleInformation {
|
public abstract class SteamEngineTileEntity extends EngineTileEntity implements IHaveGoggleInformation {
|
||||||
|
|
||||||
private static final float GENERATING_CAPACITY = 32F;
|
private FluidTank tank;
|
||||||
private static final float GENERATING_SPEED = 32F;
|
private LazyOptional<IFluidHandler> holder = LazyOptional.of(() -> tank);
|
||||||
private static final int CONSUMING_STEAM_MB_PER_TICK = 30;
|
|
||||||
private static final int STEAM_STORAGE_MAXIMUM = 100000;
|
|
||||||
|
|
||||||
protected FluidTank tank = new FluidTank(STEAM_STORAGE_MAXIMUM, fluidStack -> {
|
public SteamEngineTileEntity(TileEntityType<? extends SteamEngineTileEntity> type) {
|
||||||
|
super(type);
|
||||||
|
this.refreshCapability();
|
||||||
|
this.tank = new FluidTank(this.getSteamStorage(), fluidStack -> {
|
||||||
return fluidStack.getFluid() == FluidRegistry.steam.get();
|
return fluidStack.getFluid() == FluidRegistry.steam.get();
|
||||||
}) {
|
}) {
|
||||||
protected void onContentsChanged() {
|
protected void onContentsChanged() {
|
||||||
syncFluidContent();
|
syncFluidContent();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
public void syncFluidContent() {
|
|
||||||
CompoundNBT nbt = new CompoundNBT();
|
|
||||||
nbt.put("tank", tank.writeToNBT(new CompoundNBT()));
|
|
||||||
PacketHandler.send(PacketDistributor.TRACKING_CHUNK.with(() -> {
|
|
||||||
return this.level.getChunkAt(this.worldPosition);
|
|
||||||
}), new TileSyncPacket(this, nbt));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void receiveFromServer(CompoundNBT message) {
|
|
||||||
if (message.contains("tank", 10)) {
|
|
||||||
this.tank.readFromNBT(message.getCompound("tank"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void receiveFromClient(CompoundNBT message) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private LazyOptional<IFluidHandler> holder = LazyOptional.of(() -> tank);
|
|
||||||
|
|
||||||
public SteamEngineTileEntity(TileEntityType<? extends SteamEngineTileEntity> type) {
|
|
||||||
super(type);
|
|
||||||
this.refreshCapability();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -68,13 +51,13 @@ public class SteamEngineTileEntity extends EngineTileEntity implements IHaveGogg
|
||||||
if (level != null && !level.isClientSide) {
|
if (level != null && !level.isClientSide) {
|
||||||
BlockState state = this.level.getBlockState(this.worldPosition);
|
BlockState state = this.level.getBlockState(this.worldPosition);
|
||||||
if (!tank.isEmpty()) {
|
if (!tank.isEmpty()) {
|
||||||
if (tank.getFluidAmount() < CONSUMING_STEAM_MB_PER_TICK) {
|
if (tank.getFluidAmount() < this.getSteamConsumptionPerTick()) {
|
||||||
tank.drain(tank.getFluidAmount(), IFluidHandler.FluidAction.EXECUTE);
|
tank.drain(tank.getFluidAmount(), IFluidHandler.FluidAction.EXECUTE);
|
||||||
} else {
|
} else {
|
||||||
tank.drain(CONSUMING_STEAM_MB_PER_TICK, IFluidHandler.FluidAction.EXECUTE);
|
tank.drain(this.getSteamConsumptionPerTick(), IFluidHandler.FluidAction.EXECUTE);
|
||||||
this.level.setBlockAndUpdate(this.worldPosition, state.setValue(SteamEngineBlock.LIT, true));
|
this.level.setBlockAndUpdate(this.worldPosition, state.setValue(SteamEngineBlock.LIT, true));
|
||||||
this.appliedCapacity = GENERATING_CAPACITY;
|
this.appliedCapacity = this.getGeneratingCapacity();
|
||||||
this.appliedSpeed = GENERATING_SPEED;
|
this.appliedSpeed = this.getGeneratingSpeed();
|
||||||
this.refreshWheelSpeed();
|
this.refreshWheelSpeed();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -116,4 +99,57 @@ public class SteamEngineTileEntity extends EngineTileEntity implements IHaveGogg
|
||||||
});
|
});
|
||||||
oldCap.invalidate();
|
oldCap.invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void syncFluidContent() {
|
||||||
|
CompoundNBT nbt = new CompoundNBT();
|
||||||
|
nbt.put("tank", tank.writeToNBT(new CompoundNBT()));
|
||||||
|
PacketHandler.send(PacketDistributor.TRACKING_CHUNK.with(() -> {
|
||||||
|
return this.level.getChunkAt(this.worldPosition);
|
||||||
|
}), new TileSyncPacket(this, nbt));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void receiveFromServer(CompoundNBT message) {
|
||||||
|
if (message.contains("tank", 10)) {
|
||||||
|
this.tank.readFromNBT(message.getCompound("tank"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void receiveFromClient(CompoundNBT message) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void attachWheel() {
|
||||||
|
Direction engineFacing = (Direction)this.getBlockState().getValue(EngineBlock.FACING);
|
||||||
|
BlockPos wheelPos = this.worldPosition.relative(engineFacing, 2);
|
||||||
|
BlockState wheelState = this.level.getBlockState(wheelPos);
|
||||||
|
if (this.getFlywheel() == wheelState.getBlock()) {
|
||||||
|
Direction wheelFacing = (Direction)wheelState.getValue(FlywheelBlock.HORIZONTAL_FACING);
|
||||||
|
if (wheelFacing.getAxis() == engineFacing.getClockWise().getAxis()) {
|
||||||
|
if (!FlywheelBlock.isConnected(wheelState) || FlywheelBlock.getConnection(wheelState) == engineFacing.getOpposite()) {
|
||||||
|
TileEntity te = this.level.getBlockEntity(wheelPos);
|
||||||
|
if (!te.isRemoved()) {
|
||||||
|
if (te instanceof FlywheelTileEntity) {
|
||||||
|
if (!FlywheelBlock.isConnected(wheelState)) {
|
||||||
|
FlywheelBlock.setConnection(this.level, te.getBlockPos(), te.getBlockState(), engineFacing.getOpposite());
|
||||||
|
}
|
||||||
|
|
||||||
|
this.poweredWheel = (FlywheelTileEntity)te;
|
||||||
|
this.refreshWheelSpeed();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract Block getFlywheel();
|
||||||
|
|
||||||
|
public abstract float getGeneratingCapacity();
|
||||||
|
|
||||||
|
public abstract float getGeneratingSpeed();
|
||||||
|
|
||||||
|
public abstract int getSteamConsumptionPerTick();
|
||||||
|
|
||||||
|
public abstract int getSteamStorage();
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
package com.teammoeg.steampowered.tileentity;
|
||||||
|
|
||||||
|
import com.teammoeg.steampowered.registrate.SPBlocks;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.tileentity.TileEntityType;
|
||||||
|
|
||||||
|
public class SteelSteamEngineTileEntity extends SteamEngineTileEntity {
|
||||||
|
public SteelSteamEngineTileEntity(TileEntityType<? extends SteamEngineTileEntity> type) {
|
||||||
|
super(type);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Block getFlywheel() {
|
||||||
|
return SPBlocks.STEEL_FLYWHEEL.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getGeneratingCapacity() {
|
||||||
|
return 96F;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getGeneratingSpeed() {
|
||||||
|
return 32F;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getSteamConsumptionPerTick() {
|
||||||
|
return 96;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getSteamStorage() {
|
||||||
|
return 96000;
|
||||||
|
}
|
||||||
|
}
|
|
@ -11,22 +11,29 @@ description = '''
|
||||||
Steam Age with Create
|
Steam Age with Create
|
||||||
'''
|
'''
|
||||||
[[dependencies.steampowered]]
|
[[dependencies.steampowered]]
|
||||||
modId = "forge"
|
modId = "forge"
|
||||||
mandatory = true
|
mandatory = true
|
||||||
versionRange = "[36,)"
|
versionRange = "[36,)"
|
||||||
ordering = "NONE"
|
ordering = "NONE"
|
||||||
side = "BOTH"
|
side = "BOTH"
|
||||||
|
|
||||||
[[dependencies.steampowered]]
|
[[dependencies.steampowered]]
|
||||||
modId = "minecraft"
|
modId = "minecraft"
|
||||||
mandatory = true
|
mandatory = true
|
||||||
versionRange = "[1.16.5,1.17)"
|
versionRange = "[1.16.5,1.17)"
|
||||||
ordering = "NONE"
|
ordering = "NONE"
|
||||||
side = "BOTH"
|
side = "BOTH"
|
||||||
|
|
||||||
[[dependencies.steampowered]]
|
[[dependencies.steampowered]]
|
||||||
modId="create"
|
modId="create"
|
||||||
mandatory=true
|
mandatory=true
|
||||||
versionRange="[v0.3.2d,)"
|
versionRange="[v0.3.2d,)"
|
||||||
ordering="BEFORE"
|
ordering="NONE"
|
||||||
side="BOTH"
|
side="BOTH"
|
||||||
|
|
||||||
|
[[dependencies.steampowered]]
|
||||||
|
modId="flywheel"
|
||||||
|
mandatory=true
|
||||||
|
versionRange="[1.16-0.2.3,1.16-0.3)"
|
||||||
|
ordering="AFTER"
|
||||||
|
side="CLIENT"
|
||||||
|
|
|
@ -0,0 +1,49 @@
|
||||||
|
{
|
||||||
|
"variants": {
|
||||||
|
"connection=none,facing=north": {
|
||||||
|
"model": "steampowered:block/bronze_flywheel/casing_none",
|
||||||
|
"y": 270
|
||||||
|
},
|
||||||
|
"connection=left,facing=north": {
|
||||||
|
"model": "steampowered:block/bronze_flywheel/casing_left",
|
||||||
|
"y": 270
|
||||||
|
},
|
||||||
|
"connection=right,facing=north": {
|
||||||
|
"model": "steampowered:block/bronze_flywheel/casing_right",
|
||||||
|
"y": 270
|
||||||
|
},
|
||||||
|
"connection=none,facing=south": {
|
||||||
|
"model": "steampowered:block/bronze_flywheel/casing_none",
|
||||||
|
"y": 90
|
||||||
|
},
|
||||||
|
"connection=left,facing=south": {
|
||||||
|
"model": "steampowered:block/bronze_flywheel/casing_left",
|
||||||
|
"y": 90
|
||||||
|
},
|
||||||
|
"connection=right,facing=south": {
|
||||||
|
"model": "steampowered:block/bronze_flywheel/casing_right",
|
||||||
|
"y": 90
|
||||||
|
},
|
||||||
|
"connection=none,facing=west": {
|
||||||
|
"model": "steampowered:block/bronze_flywheel/casing_none",
|
||||||
|
"y": 180
|
||||||
|
},
|
||||||
|
"connection=left,facing=west": {
|
||||||
|
"model": "steampowered:block/bronze_flywheel/casing_left",
|
||||||
|
"y": 180
|
||||||
|
},
|
||||||
|
"connection=right,facing=west": {
|
||||||
|
"model": "steampowered:block/bronze_flywheel/casing_right",
|
||||||
|
"y": 180
|
||||||
|
},
|
||||||
|
"connection=none,facing=east": {
|
||||||
|
"model": "steampowered:block/bronze_flywheel/casing_none"
|
||||||
|
},
|
||||||
|
"connection=left,facing=east": {
|
||||||
|
"model": "steampowered:block/bronze_flywheel/casing_left"
|
||||||
|
},
|
||||||
|
"connection=right,facing=east": {
|
||||||
|
"model": "steampowered:block/bronze_flywheel/casing_right"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
{
|
||||||
|
"variants": {
|
||||||
|
"facing=north": {
|
||||||
|
"model": "steampowered:block/bronze_steam_engine/block"
|
||||||
|
},
|
||||||
|
"facing=south": {
|
||||||
|
"model": "steampowered:block/bronze_steam_engine/block",
|
||||||
|
"y": 180
|
||||||
|
},
|
||||||
|
"facing=west": {
|
||||||
|
"model": "steampowered:block/bronze_steam_engine/block",
|
||||||
|
"y": 270
|
||||||
|
},
|
||||||
|
"facing=east": {
|
||||||
|
"model": "steampowered:block/bronze_steam_engine/block",
|
||||||
|
"y": 90
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,19 +0,0 @@
|
||||||
{
|
|
||||||
"variants": {
|
|
||||||
"facing=north": {
|
|
||||||
"model": "create:block/furnace_engine/block"
|
|
||||||
},
|
|
||||||
"facing=south": {
|
|
||||||
"model": "create:block/furnace_engine/block",
|
|
||||||
"y": 180
|
|
||||||
},
|
|
||||||
"facing=west": {
|
|
||||||
"model": "create:block/furnace_engine/block",
|
|
||||||
"y": 270
|
|
||||||
},
|
|
||||||
"facing=east": {
|
|
||||||
"model": "create:block/furnace_engine/block",
|
|
||||||
"y": 90
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -2,7 +2,12 @@
|
||||||
"itemGroup.steampowered": "Create: Steam Powered",
|
"itemGroup.steampowered": "Create: Steam Powered",
|
||||||
"item.steampowered.pressurized_gas_container": "Pressurized Gas Container",
|
"item.steampowered.pressurized_gas_container": "Pressurized Gas Container",
|
||||||
"item.steampowered.pressurized_steam_container": "Pressurized Steam Container",
|
"item.steampowered.pressurized_steam_container": "Pressurized Steam Container",
|
||||||
"block.steampowered.steam_engine": "Steam Engine",
|
"block.steampowered.bronze_steam_engine": "Bronze Steam Engine",
|
||||||
|
"block.steampowered.cast_iron_steam_engine": "Cast Iron Steam Engine",
|
||||||
|
"block.steampowered.steel_steam_engine": "Cast Iron Steam Engine",
|
||||||
|
"block.steampowered.bronze_flywheel": "Bronze Flywheel",
|
||||||
|
"block.steampowered.cast_iron_flywheel": "Cast Iron Flywheel",
|
||||||
|
"block.steampowered.steel_flywheel": "Steel Flywheel",
|
||||||
"block.steampowered.bronze_cogwheel": "Bronze Cogwheel",
|
"block.steampowered.bronze_cogwheel": "Bronze Cogwheel",
|
||||||
"block.steampowered.cast_iron_cogwheel": "Cast Iron Cogwheel",
|
"block.steampowered.cast_iron_cogwheel": "Cast Iron Cogwheel",
|
||||||
"block.steampowered.steel_cogwheel": "Steel Cogwheel",
|
"block.steampowered.steel_cogwheel": "Steel Cogwheel",
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
{
|
{
|
||||||
"credit": "Made with Blockbench",
|
"credit": "Made with Blockbench",
|
||||||
"textures": {
|
"textures": {
|
||||||
"0": "create:block/steam_engine_wheel",
|
"0": "steampowered:block/flywheel/bronze_steam_engine_wheel",
|
||||||
"5": "create:block/brass_casing",
|
"5": "steampowered:block/casing/bronze_casing",
|
||||||
"7": "create:block/brass_gearbox",
|
"7": "steampowered:block/gearbox/bronze_gearbox",
|
||||||
"particle": "create:block/steam_engine_wheel"
|
"particle": "steampowered:block/flywheel/bronze_steam_engine_wheel"
|
||||||
},
|
},
|
||||||
"elements": [
|
"elements": [
|
||||||
{
|
{
|
|
@ -1,10 +1,10 @@
|
||||||
{
|
{
|
||||||
"credit": "Made with Blockbench",
|
"credit": "Made with Blockbench",
|
||||||
"textures": {
|
"textures": {
|
||||||
"0": "create:block/steam_engine_wheel",
|
"0": "steampowered:block/flywheel/bronze_steam_engine_wheel",
|
||||||
"5": "create:block/brass_casing",
|
"5": "steampowered:block/casing/bronze_casing",
|
||||||
"7": "create:block/brass_gearbox",
|
"7": "steampowered:block/gearbox/bronze_gearbox",
|
||||||
"particle": "create:block/steam_engine_wheel"
|
"particle": "steampowered:block/flywheel/bronze_steam_engine_wheel"
|
||||||
},
|
},
|
||||||
"elements": [
|
"elements": [
|
||||||
{
|
{
|
|
@ -1,10 +1,10 @@
|
||||||
{
|
{
|
||||||
"credit": "Made with Blockbench",
|
"credit": "Made with Blockbench",
|
||||||
"textures": {
|
"textures": {
|
||||||
"0": "create:block/steam_engine_wheel",
|
"0": "steampowered:block/flywheel/bronze_steam_engine_wheel",
|
||||||
"5": "create:block/brass_casing",
|
"5": "steampowered:block/casing/bronze_casing",
|
||||||
"7": "create:block/brass_gearbox",
|
"7": "steampowered:block/gearbox/bronze_gearbox",
|
||||||
"particle": "create:block/steam_engine_wheel"
|
"particle": "steampowered:block/flywheel/bronze_steam_engine_wheel"
|
||||||
},
|
},
|
||||||
"elements": [
|
"elements": [
|
||||||
{
|
{
|
|
@ -1,10 +1,10 @@
|
||||||
{
|
{
|
||||||
"credit": "Made with Blockbench",
|
"credit": "Made with Blockbench",
|
||||||
"textures": {
|
"textures": {
|
||||||
"0": "create:block/steam_engine_wheel",
|
"0": "steampowered:block/flywheel/bronze_steam_engine_wheel",
|
||||||
"5": "create:block/brass_casing",
|
"5": "steampowered:block/casing/bronze_casing",
|
||||||
"7": "create:block/brass_gearbox",
|
"7": "steampowered:block/gearbox/bronze_gearbox",
|
||||||
"particle": "create:block/steam_engine_wheel"
|
"particle": "steampowered:block/flywheel/bronze_steam_engine_wheel"
|
||||||
},
|
},
|
||||||
"elements": [
|
"elements": [
|
||||||
{
|
{
|
|
@ -1,8 +1,8 @@
|
||||||
{
|
{
|
||||||
"credit": "Made with Blockbench",
|
"credit": "Made with Blockbench",
|
||||||
"textures": {
|
"textures": {
|
||||||
"0": "create:block/steam_engine_wheel",
|
"0": "steampowered:block/flywheel/bronze_steam_engine_wheel",
|
||||||
"particle": "create:block/steam_engine_wheel"
|
"particle": "steampowered:block/flywheel/bronze_steam_engine_wheel"
|
||||||
},
|
},
|
||||||
"elements": [
|
"elements": [
|
||||||
{
|
{
|
|
@ -1,8 +1,8 @@
|
||||||
{
|
{
|
||||||
"credit": "Made with Blockbench",
|
"credit": "Made with Blockbench",
|
||||||
"textures": {
|
"textures": {
|
||||||
"0": "create:block/steam_engine_wheel",
|
"0": "steampowered:block/flywheel/bronze_steam_engine_wheel",
|
||||||
"particle": "create:block/steam_engine_wheel"
|
"particle": "steampowered:block/flywheel/bronze_steam_engine_wheel"
|
||||||
},
|
},
|
||||||
"elements": [
|
"elements": [
|
||||||
{
|
{
|
|
@ -1,8 +1,8 @@
|
||||||
{
|
{
|
||||||
"credit": "Made with Blockbench",
|
"credit": "Made with Blockbench",
|
||||||
"textures": {
|
"textures": {
|
||||||
"0": "create:block/steam_engine_wheel",
|
"0": "steampowered:block/flywheel/bronze_steam_engine_wheel",
|
||||||
"particle": "create:block/steam_engine_wheel"
|
"particle": "steampowered:block/flywheel/bronze_steam_engine_wheel"
|
||||||
},
|
},
|
||||||
"elements": [
|
"elements": [
|
||||||
{
|
{
|
|
@ -1,8 +1,8 @@
|
||||||
{
|
{
|
||||||
"credit": "Made with Blockbench",
|
"credit": "Made with Blockbench",
|
||||||
"textures": {
|
"textures": {
|
||||||
"0": "create:block/steam_engine_wheel",
|
"0": "steampowered:block/flywheel/bronze_steam_engine_wheel",
|
||||||
"particle": "create:block/steam_engine_wheel"
|
"particle": "steampowered:block/flywheel/bronze_steam_engine_wheel"
|
||||||
},
|
},
|
||||||
"elements": [
|
"elements": [
|
||||||
{
|
{
|
|
@ -1,8 +1,8 @@
|
||||||
{
|
{
|
||||||
"credit": "Made with Blockbench",
|
"credit": "Made with Blockbench",
|
||||||
"textures": {
|
"textures": {
|
||||||
"0": "create:block/steam_engine_wheel",
|
"0": "steampowered:block/flywheel/bronze_steam_engine_wheel",
|
||||||
"particle": "create:block/steam_engine_wheel"
|
"particle": "steampowered:block/flywheel/bronze_steam_engine_wheel"
|
||||||
},
|
},
|
||||||
"elements": [
|
"elements": [
|
||||||
{
|
{
|
|
@ -1,9 +1,9 @@
|
||||||
{
|
{
|
||||||
"credit": "Made with Blockbench",
|
"credit": "Made with Blockbench",
|
||||||
"textures": {
|
"textures": {
|
||||||
"5": "create:block/brass_casing",
|
"5": "steampowered:block/casing/bronze_casing",
|
||||||
"1_1": "create:block/furnace_cylinder",
|
"1_1": "steampowered:block/steam_engine/bronze_furnace_cylinder",
|
||||||
"particle": "create:block/brass_block"
|
"particle": "steampowered:block/metal_block/bronze_block"
|
||||||
},
|
},
|
||||||
"elements": [
|
"elements": [
|
||||||
{
|
{
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"parent": "steampowered:block/bronze_flywheel/item"
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"parent": "steampowered:block/bronze_steam_engine/item"
|
||||||
|
}
|
|
@ -1,3 +0,0 @@
|
||||||
{
|
|
||||||
"parent": "create:block/furnace_engine/item"
|
|
||||||
}
|
|
Binary file not shown.
Binary file not shown.
After Width: | Height: | Size: 269 B |
Binary file not shown.
After Width: | Height: | Size: 268 B |
Binary file not shown.
After Width: | Height: | Size: 437 B |
14
src/main/resources/steampowered.mixins.json
Normal file
14
src/main/resources/steampowered.mixins.json
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
{
|
||||||
|
"required": true,
|
||||||
|
"minVersion": "0.8",
|
||||||
|
"package": "com.teammoeg.steampowered.mixin",
|
||||||
|
"compatibilityLevel": "JAVA_8",
|
||||||
|
"mixins": [
|
||||||
|
"FlywheelTileEntityAccess"
|
||||||
|
],
|
||||||
|
"client": [
|
||||||
|
],
|
||||||
|
"injectors": {
|
||||||
|
"defaultRequire": 1
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue