stuffffffffffff
@@ -0,0 +1,110 @@
|
||||
package com.drmangotea.tfmg.content.electricity.generators.large_generator;
|
||||
|
||||
import com.drmangotea.tfmg.content.decoration.flywheels.TFMGFlywheelBlock;
|
||||
import com.drmangotea.tfmg.content.decoration.flywheels.TFMGFlywheelBlockEntity;
|
||||
import com.drmangotea.tfmg.registry.TFMGPartialModels;
|
||||
import com.simibubi.create.AllPartialModels;
|
||||
import com.simibubi.create.content.kinetics.base.KineticBlockEntityVisual;
|
||||
import com.simibubi.create.content.kinetics.base.RotatingInstance;
|
||||
import com.simibubi.create.foundation.render.AllInstanceTypes;
|
||||
import dev.engine_room.flywheel.api.instance.Instance;
|
||||
import dev.engine_room.flywheel.api.visualization.VisualizationContext;
|
||||
import dev.engine_room.flywheel.lib.instance.InstanceTypes;
|
||||
import dev.engine_room.flywheel.lib.instance.TransformedInstance;
|
||||
import dev.engine_room.flywheel.lib.model.Models;
|
||||
import dev.engine_room.flywheel.lib.visual.SimpleDynamicVisual;
|
||||
import net.createmod.catnip.math.AngleHelper;
|
||||
import net.minecraft.core.Direction;
|
||||
import org.joml.Matrix4f;
|
||||
import org.joml.Quaternionf;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public class RotorVisual extends KineticBlockEntityVisual<RotorBlockEntity> implements SimpleDynamicVisual {
|
||||
|
||||
protected final RotatingInstance shaft;
|
||||
protected final TransformedInstance wheel;
|
||||
protected float lastAngle = Float.NaN;
|
||||
|
||||
protected final Matrix4f baseTransform = new Matrix4f();
|
||||
|
||||
|
||||
public RotorVisual(VisualizationContext context, RotorBlockEntity blockEntity, float partialTick) {
|
||||
super(context, blockEntity, partialTick);
|
||||
|
||||
var axis = rotationAxis();
|
||||
shaft = instancerProvider().instancer(AllInstanceTypes.ROTATING, Models.partial(AllPartialModels.SHAFT))
|
||||
.createInstance();
|
||||
|
||||
shaft.setup(RotorVisual.this.blockEntity)
|
||||
.setPosition(getVisualPosition())
|
||||
.rotateToFace(axis)
|
||||
.setChanged();
|
||||
|
||||
wheel = instancerProvider().instancer(InstanceTypes.TRANSFORMED, Models.partial(TFMGPartialModels.ROTOR))
|
||||
.createInstance();
|
||||
|
||||
|
||||
Direction align = Direction.fromAxisAndDirection(axis, Direction.AxisDirection.POSITIVE);
|
||||
|
||||
wheel.translate(getVisualPosition())
|
||||
.center()
|
||||
.rotate(new Quaternionf().rotateTo(0, 1, 0, align.getStepX(), align.getStepY(), align.getStepZ()));
|
||||
|
||||
|
||||
//wheel.rotateX((float) Math.PI/2);
|
||||
//wheel.rotateY((float) Math.PI/2);
|
||||
//wheel.rotateZ((float) Math.PI/2);
|
||||
|
||||
|
||||
baseTransform.set(wheel.pose);
|
||||
|
||||
animate(blockEntity.angle);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beginFrame(Context ctx) {
|
||||
|
||||
float partialTicks = ctx.partialTick();
|
||||
|
||||
float speed = blockEntity.visualSpeed.getValue(partialTicks) * 3 / 10f;
|
||||
float angle = blockEntity.angle + speed * partialTicks;
|
||||
|
||||
if (Math.abs(angle - lastAngle) < 0.001)
|
||||
return;
|
||||
|
||||
animate(angle);
|
||||
|
||||
lastAngle = angle;
|
||||
}
|
||||
|
||||
private void animate(float angle) {
|
||||
wheel.setTransform(baseTransform)
|
||||
.rotateY(AngleHelper.rad(angle))
|
||||
.uncenter()
|
||||
.setChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(float pt) {
|
||||
shaft.setup(blockEntity)
|
||||
.setChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateLight(float partialTick) {
|
||||
relight(shaft, wheel);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _delete() {
|
||||
shaft.delete();
|
||||
wheel.delete();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void collectCrumblingInstances(Consumer<Instance> consumer) {
|
||||
consumer.accept(shaft);
|
||||
consumer.accept(wheel);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,226 @@
|
||||
package com.drmangotea.tfmg.content.engines.types.large_engine;
|
||||
|
||||
|
||||
import com.drmangotea.tfmg.base.TFMGShapes;
|
||||
import com.drmangotea.tfmg.registry.TFMGBlockEntities;
|
||||
import com.drmangotea.tfmg.registry.TFMGBlocks;
|
||||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.AllShapes;
|
||||
import com.simibubi.create.content.equipment.wrench.IWrenchable;
|
||||
import com.simibubi.create.content.fluids.tank.FluidTankBlock;
|
||||
import com.simibubi.create.content.kinetics.simpleRelays.ShaftBlock;
|
||||
import com.simibubi.create.content.kinetics.steamEngine.PoweredShaftBlock;
|
||||
import com.simibubi.create.foundation.block.IBE;
|
||||
import com.simibubi.create.foundation.utility.BlockHelper;
|
||||
import net.createmod.catnip.data.Couple;
|
||||
import net.createmod.catnip.placement.IPlacementHelper;
|
||||
import net.createmod.catnip.placement.PlacementHelpers;
|
||||
import net.createmod.catnip.placement.PlacementOffset;
|
||||
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.Direction.Axis;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.BlockItem;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.context.BlockPlaceContext;
|
||||
import net.minecraft.world.level.BlockGetter;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.LevelAccessor;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.HorizontalDirectionalBlock;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.block.state.StateDefinition.Builder;
|
||||
import net.minecraft.world.level.block.state.properties.AttachFace;
|
||||
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
|
||||
import net.minecraft.world.level.block.state.properties.EnumProperty;
|
||||
import net.minecraft.world.level.pathfinder.PathComputationType;
|
||||
import net.minecraft.world.phys.BlockHitResult;
|
||||
import net.minecraft.world.phys.shapes.CollisionContext;
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import static net.minecraft.world.level.block.state.properties.BlockStateProperties.WATERLOGGED;
|
||||
|
||||
public class LargeEngineBlock extends HorizontalDirectionalBlock
|
||||
implements IWrenchable, IBE<LargeEngineBlockEntity> {
|
||||
public static final EnumProperty<AttachFace> FACE = BlockStateProperties.ATTACH_FACE;
|
||||
|
||||
private static final int placementHelperId = PlacementHelpers.register(new PlacementHelper());
|
||||
|
||||
public LargeEngineBlock(Properties properties) {
|
||||
super(properties);
|
||||
registerDefaultState(stateDefinition.any().setValue(FACE, AttachFace.FLOOR).setValue(FACING, Direction.NORTH).setValue(WATERLOGGED, false));
|
||||
}
|
||||
|
||||
public static Direction getConnectedDirection(BlockState p_53201_) {
|
||||
switch ((AttachFace) p_53201_.getValue(FACE)) {
|
||||
case CEILING:
|
||||
return Direction.DOWN;
|
||||
case FLOOR:
|
||||
return Direction.UP;
|
||||
default:
|
||||
return p_53201_.getValue(FACING);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void createBlockStateDefinition(Builder<Block, BlockState> pBuilder) {
|
||||
super.createBlockStateDefinition(pBuilder.add(FACE, FACING, WATERLOGGED));
|
||||
}
|
||||
/*
|
||||
@Override
|
||||
public void setPlacedBy(Level pLevel, BlockPos pPos, BlockState pState, LivingEntity pPlacer, ItemStack pStack) {
|
||||
super.setPlacedBy(pLevel, pPos, pState, pPlacer, pStack);
|
||||
AdvancementBehaviour.setPlacedBy(pLevel, pPos, pPlacer);
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
|
||||
@Nullable
|
||||
public BlockState getStateForPlacement(BlockPlaceContext p_53184_) {
|
||||
for (Direction direction : p_53184_.getNearestLookingDirections()) {
|
||||
BlockState blockstate;
|
||||
if (direction.getAxis() == Axis.Y) {
|
||||
blockstate = this.defaultBlockState().setValue(FACE, direction == Direction.UP ? AttachFace.CEILING : AttachFace.FLOOR).setValue(FACING, p_53184_.getHorizontalDirection());
|
||||
} else {
|
||||
blockstate = this.defaultBlockState().setValue(FACE, AttachFace.WALL).setValue(FACING, direction.getOpposite());
|
||||
}
|
||||
|
||||
if (blockstate.canSurvive(p_53184_.getLevel(), p_53184_.getClickedPos())) {
|
||||
return blockstate;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand,
|
||||
BlockHitResult ray) {
|
||||
ItemStack heldItem = player.getItemInHand(hand);
|
||||
|
||||
IPlacementHelper placementHelper = PlacementHelpers.get(placementHelperId);
|
||||
if (placementHelper.matchesItem(heldItem))
|
||||
return placementHelper.getOffset(player, world, state, pos, ray)
|
||||
.placeInWorld(world, (BlockItem) heldItem.getItem(), player, hand, ray);
|
||||
return InteractionResult.PASS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState updateShape(BlockState state, Direction direction, BlockState neighbourState, LevelAccessor world,
|
||||
BlockPos pos, BlockPos neighbourPos) {
|
||||
// if (state.getValue(WATERLOGGED))
|
||||
// world.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(world));
|
||||
return state;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlace(BlockState pState, Level pLevel, BlockPos pPos, BlockState pOldState, boolean pIsMoving) {
|
||||
// FluidTankBlock.updateBoilerState(pState, pLevel, pPos.relative(getFacing(pState).getOpposite()));
|
||||
BlockPos shaftPos = getShaftPos(pState, pPos);
|
||||
BlockState shaftState = pLevel.getBlockState(shaftPos);
|
||||
if (isShaftValid(pState, shaftState))
|
||||
pLevel.setBlock(shaftPos, PoweredShaftBlock.getEquivalent(shaftState), 3);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRemove(BlockState pState, Level pLevel, BlockPos pPos, BlockState pNewState, boolean pIsMoving) {
|
||||
if (pState.hasBlockEntity() && (!pState.is(pNewState.getBlock()) || !pNewState.hasBlockEntity()))
|
||||
pLevel.removeBlockEntity(pPos);
|
||||
FluidTankBlock.updateBoilerState(pState, pLevel, pPos.relative(getFacing(pState).getOpposite()));
|
||||
BlockPos shaftPos = getShaftPos(pState, pPos);
|
||||
BlockState shaftState = pLevel.getBlockState(shaftPos);
|
||||
if (AllBlocks.POWERED_SHAFT.has(shaftState))
|
||||
pLevel.scheduleTick(shaftPos, shaftState.getBlock(), 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public VoxelShape getShape(BlockState state, BlockGetter pLevel, BlockPos pPos, CollisionContext pContext) {
|
||||
|
||||
if (TFMGBlocks.LARGE_ENGINE.has(state))
|
||||
return TFMGShapes.FULL;
|
||||
|
||||
|
||||
AttachFace face = state.getValue(FACE);
|
||||
Direction direction = state.getValue(FACING);
|
||||
return face == AttachFace.CEILING ? AllShapes.STEAM_ENGINE_CEILING.get(direction.getAxis())
|
||||
: face == AttachFace.FLOOR ? AllShapes.STEAM_ENGINE.get(direction.getAxis())
|
||||
: AllShapes.STEAM_ENGINE_WALL.get(direction);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isPathfindable(BlockState state, BlockGetter reader, BlockPos pos, PathComputationType type) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static Direction getFacing(BlockState sideState) {
|
||||
return getConnectedDirection(sideState);
|
||||
}
|
||||
|
||||
public static BlockPos getShaftPos(BlockState sideState, BlockPos pos) {
|
||||
return pos.relative(getConnectedDirection(sideState), 2);
|
||||
}
|
||||
|
||||
public static boolean isShaftValid(BlockState state, BlockState shaft) {
|
||||
return (AllBlocks.SHAFT.has(shaft) || AllBlocks.POWERED_SHAFT.has(shaft))
|
||||
&& shaft.getValue(ShaftBlock.AXIS) != getFacing(state).getAxis();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<LargeEngineBlockEntity> getBlockEntityClass() {
|
||||
return LargeEngineBlockEntity.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockEntityType<? extends LargeEngineBlockEntity> getBlockEntityType() {
|
||||
return TFMGBlockEntities.LARGE_ENGINE.get();
|
||||
}
|
||||
|
||||
@MethodsReturnNonnullByDefault
|
||||
private static class PlacementHelper implements IPlacementHelper {
|
||||
@Override
|
||||
public Predicate<ItemStack> getItemPredicate() {
|
||||
return AllBlocks.SHAFT::isIn;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Predicate<BlockState> getStatePredicate() {
|
||||
return s -> s.getBlock() instanceof LargeEngineBlock;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PlacementOffset getOffset(Player player, Level world, BlockState state, BlockPos pos,
|
||||
BlockHitResult ray) {
|
||||
BlockPos shaftPos = LargeEngineBlock.getShaftPos(state, pos);
|
||||
BlockState shaft = AllBlocks.SHAFT.getDefaultState();
|
||||
for (Direction direction : Direction.orderedByNearest(player)) {
|
||||
shaft = shaft.setValue(ShaftBlock.AXIS, direction.getAxis());
|
||||
if (isShaftValid(state, shaft))
|
||||
break;
|
||||
}
|
||||
|
||||
BlockState newState = world.getBlockState(shaftPos);
|
||||
if (!newState.canBeReplaced())
|
||||
return PlacementOffset.fail();
|
||||
|
||||
Axis axis = shaft.getValue(ShaftBlock.AXIS);
|
||||
return PlacementOffset.success(shaftPos,
|
||||
s -> BlockHelper.copyProperties(s, AllBlocks.POWERED_SHAFT.getDefaultState())
|
||||
.setValue(PoweredShaftBlock.AXIS, axis));
|
||||
}
|
||||
}
|
||||
|
||||
public static Couple<Integer> getSpeedRange() {
|
||||
return Couple.create(16, 128);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,344 @@
|
||||
package com.drmangotea.tfmg.content.engines.types.large_engine;
|
||||
|
||||
|
||||
import com.drmangotea.tfmg.base.TFMGUtils;
|
||||
import com.drmangotea.tfmg.content.engines.base.AbstractEngineBlockEntity;
|
||||
import com.drmangotea.tfmg.content.engines.base.EngineFluidTank;
|
||||
import com.drmangotea.tfmg.registry.TFMGBlocks;
|
||||
import com.drmangotea.tfmg.registry.TFMGTags;
|
||||
import com.simibubi.create.content.kinetics.base.GeneratingKineticBlockEntity;
|
||||
import com.simibubi.create.content.kinetics.base.KineticBlockEntityRenderer;
|
||||
import com.simibubi.create.content.kinetics.belt.behaviour.DirectBeltInputBehaviour;
|
||||
import com.simibubi.create.content.kinetics.steamEngine.PoweredShaftBlockEntity;
|
||||
import com.simibubi.create.content.kinetics.steamEngine.SteamEngineBlock;
|
||||
import com.simibubi.create.foundation.blockEntity.behaviour.BlockEntityBehaviour;
|
||||
import com.simibubi.create.foundation.fluid.CombinedTankWrapper;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.Direction.Axis;
|
||||
import net.minecraft.core.Direction.AxisDirection;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.tags.TagKey;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.material.Fluid;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.capabilities.ForgeCapabilities;
|
||||
import net.minecraftforge.common.util.LazyOptional;
|
||||
import net.minecraftforge.fluids.capability.IFluidHandler;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.List;
|
||||
|
||||
public class LargeEngineBlockEntity extends AbstractEngineBlockEntity {
|
||||
|
||||
//protected ScrollOptionBehaviour<WindmillBearingBlockEntity.RotationDirection> movementDirection;
|
||||
|
||||
public WeakReference<PoweredShaftBlockEntity> target;
|
||||
|
||||
|
||||
public EngineFluidTank airTank;
|
||||
|
||||
|
||||
public LargeEngineBlockEntity(BlockEntityType<?> type, BlockPos pos, BlockState state) {
|
||||
super(type, pos, state);
|
||||
target = new WeakReference<>(null);
|
||||
fuelTank = new EngineFluidTank(2000, false, true, this::tankUpdated, TFMGTags.TFMGFluidTags.AIR.tag);
|
||||
airTank = new EngineFluidTank(1000, false, true, TFMGTags.TFMGFluidTags.AIR.tag, this::tankUpdated);
|
||||
refreshCapability();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TagKey<Fluid>> getSupportedFuels() {
|
||||
return List.of(TFMGTags.TFMGFluidTags.DIESEL.tag, TFMGTags.TFMGFluidTags.KEROSENE.tag, TFMGTags.TFMGFluidTags.NAPHTHA.tag, TFMGTags.TFMGFluidTags.FURNACE_GAS.tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addBehaviours(List<BlockEntityBehaviour> behaviours) {
|
||||
behaviours.add(new DirectBeltInputBehaviour(this));
|
||||
}
|
||||
|
||||
private void onDirectionChanged() {
|
||||
}
|
||||
|
||||
public boolean isSimpleEngine(){
|
||||
return TFMGBlocks.SIMPLE_LARGE_ENGINE.has(getBlockState());
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFluidHandler handlerForCapability() {
|
||||
return new CombinedTankWrapper(fuelTank, exhaustTank, airTank);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void manageFuelAndExhaust() {
|
||||
super.manageFuelAndExhaust();
|
||||
|
||||
if (fuelConsumptionTimer > 2) {
|
||||
airTank.forceDrain(150, IFluidHandler.FluidAction.EXECUTE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
super.tick();
|
||||
|
||||
PoweredShaftBlockEntity shaft = getShaft();
|
||||
|
||||
if (shaft == null) {
|
||||
if (level.isClientSide())
|
||||
return;
|
||||
if (shaft == null)
|
||||
return;
|
||||
if (!shaft.getBlockPos()
|
||||
.subtract(worldPosition)
|
||||
.equals(shaft.enginePos))
|
||||
return;
|
||||
if (shaft.engineEfficiency == 0)
|
||||
return;
|
||||
Direction facing = LargeEngineBlock.getFacing(getBlockState());
|
||||
if (level.isLoaded(worldPosition.relative(facing.getOpposite())))
|
||||
shaft.update(worldPosition, 0, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
BlockState blockState = getBlockState();
|
||||
if (!TFMGBlocks.LARGE_ENGINE.has(blockState) && !TFMGBlocks.SIMPLE_LARGE_ENGINE.has(blockState))
|
||||
return;
|
||||
|
||||
if (!level.isClientSide)
|
||||
if (getShaft() != null)
|
||||
engineProcess();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public float efficiencyModifier() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float speedModifier() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float torqueModifier() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String engineId() {
|
||||
return "Large";
|
||||
}
|
||||
|
||||
|
||||
/// /@OnlyIn(Dist.CLIENT)
|
||||
//private void makeSound(Axis targetAxis, boolean verticalTarget) {
|
||||
// Float targetAngle = getTargetAngle();
|
||||
// PoweredShaftBlockEntity ste = target.get();
|
||||
// if (ste == null)
|
||||
// return;
|
||||
// //if (engineStrength == 0)
|
||||
// // return;
|
||||
// PoweredShaftBlockEntity shaft = getShaft();
|
||||
//
|
||||
// if (tanks.get(true).isEmpty() || tanks.get(true).isEmpty()) {
|
||||
// engineStrength = 0;
|
||||
//
|
||||
// shaft.update(worldPosition, getConveyedSpeedLevel(engineStrength, targetAxis, verticalTarget), engineStrength);
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// if (expansionBE != null) {
|
||||
// if (airTank.isEmpty() && expansionBE.airTank.isEmpty()) {
|
||||
// engineStrength = 0;
|
||||
// shaft.update(worldPosition, getConveyedSpeedLevel(engineStrength, targetAxis, verticalTarget), engineStrength);
|
||||
// return;
|
||||
// }
|
||||
// } else if (airTank.isEmpty()) {
|
||||
// engineStrength = 0;
|
||||
// shaft.update(worldPosition, getConveyedSpeedLevel(engineStrength, targetAxis, verticalTarget), engineStrength);
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// if (tanks.get(false).getFluidAmount() + 5 > 1000) {
|
||||
// engineStrength = 0;
|
||||
// shaft.update(worldPosition, getConveyedSpeedLevel(engineStrength, targetAxis, verticalTarget), engineStrength);
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// if (targetAngle == null)
|
||||
// return;
|
||||
//
|
||||
// float angle = AngleHelper.deg(targetAngle);
|
||||
// angle += (angle < 0) ? -180 + 75 : 360 - 75;
|
||||
// angle %= 360;
|
||||
//
|
||||
//
|
||||
// if (shaft == null || shaft.getSpeed() == 0)
|
||||
// return;
|
||||
//
|
||||
// if (angle >= 0 && !(prevAngle > 180 && angle < 180)) {
|
||||
// prevAngle = angle;
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// if (angle < 0 && !(prevAngle < -180 && angle > -180)) {
|
||||
// prevAngle = angle;
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// TFMGSoundEvents.DIESEL_ENGINE.playAt(level, worldPosition, 0.4f, 1f, false);
|
||||
//
|
||||
// prevAngle = angle;
|
||||
//}
|
||||
|
||||
@Override
|
||||
public boolean canWork() {
|
||||
|
||||
if (airTank.isEmpty())
|
||||
return false;
|
||||
|
||||
|
||||
return super.canWork();
|
||||
}
|
||||
|
||||
private void engineProcess() {
|
||||
PoweredShaftBlockEntity shaft = getShaft();
|
||||
|
||||
|
||||
if (!canWork()) {
|
||||
shaft.update(worldPosition, 0, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
shaft.update(worldPosition, 2, 15 * getFuelType().getStress());
|
||||
sendData();
|
||||
setChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addToGoggleTooltip(List<Component> tooltip, boolean isPlayerSneaking) {
|
||||
|
||||
TFMGUtils.createFluidTooltip(this,tooltip);
|
||||
|
||||
return super.addToGoggleTooltip(tooltip, isPlayerSneaking);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
PoweredShaftBlockEntity shaft = getShaft();
|
||||
if (shaft != null)
|
||||
shaft.remove(worldPosition);
|
||||
super.remove();
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
protected AABB createRenderBoundingBox() {
|
||||
return super.createRenderBoundingBox().inflate(2);
|
||||
}
|
||||
|
||||
public PoweredShaftBlockEntity getShaft() {
|
||||
PoweredShaftBlockEntity shaft = target.get();
|
||||
if (shaft == null || shaft.isRemoved() || !shaft.canBePoweredBy(worldPosition)) {
|
||||
if (shaft != null)
|
||||
target = new WeakReference<>(null);
|
||||
Direction facing = LargeEngineBlock.getFacing(getBlockState());
|
||||
BlockEntity anyShaftAt = level.getBlockEntity(worldPosition.relative(facing, 2));
|
||||
if (anyShaftAt instanceof PoweredShaftBlockEntity ps && ps.canBePoweredBy(worldPosition))
|
||||
target = new WeakReference<>(shaft = ps);
|
||||
}
|
||||
return shaft;
|
||||
}
|
||||
|
||||
|
||||
float prevAngle = 0;
|
||||
|
||||
|
||||
@Nullable
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public Float getTargetAngle() {
|
||||
float angle = 0;
|
||||
BlockState blockState = getBlockState();
|
||||
if (!TFMGBlocks.LARGE_ENGINE.has(blockState)&&!TFMGBlocks.SIMPLE_LARGE_ENGINE.has(blockState))
|
||||
return null;
|
||||
|
||||
Direction facing = SteamEngineBlock.getFacing(blockState);
|
||||
PoweredShaftBlockEntity shaft = getShaft();
|
||||
Axis facingAxis = facing.getAxis();
|
||||
Axis axis = Axis.Y;
|
||||
|
||||
if (shaft == null)
|
||||
return null;
|
||||
|
||||
axis = KineticBlockEntityRenderer.getRotationAxisOf(shaft);
|
||||
angle = KineticBlockEntityRenderer.getAngleForBe(shaft, shaft.getBlockPos(), axis);
|
||||
|
||||
if (axis == facingAxis)
|
||||
return null;
|
||||
if (axis.isHorizontal() && (facingAxis == Axis.X ^ facing.getAxisDirection() == AxisDirection.POSITIVE))
|
||||
angle *= -1;
|
||||
if (axis == Axis.X && facing == Direction.DOWN)
|
||||
angle *= -1;
|
||||
return angle;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void write(CompoundTag compound, boolean clientPacket) {
|
||||
compound.put("Air", airTank.writeToNBT(new CompoundTag()));
|
||||
super.write(compound, clientPacket);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFuelConsumption() {
|
||||
if(getShaft()==null)
|
||||
return 0;
|
||||
|
||||
if(isSimpleEngine())
|
||||
return (int) getShaft().getGeneratedSpeed()/10;
|
||||
return (int) getShaft().getGeneratedSpeed()/40;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void read(CompoundTag compound, boolean clientPacket) {
|
||||
airTank.readFromNBT(compound.getCompound("Air"));
|
||||
super.read(compound, clientPacket);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void invalidate() {
|
||||
super.invalidate();
|
||||
|
||||
fluidCapability.invalidate();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
@SuppressWarnings("removal")
|
||||
public <T> LazyOptional<T> getCapability(@Nonnull Capability<T> cap, Direction side) {
|
||||
|
||||
if (cap == ForgeCapabilities.FLUID_HANDLER)
|
||||
return fluidCapability.cast();
|
||||
return super.getCapability(cap, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifyUpdate() {
|
||||
super.notifyUpdate();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
package com.drmangotea.tfmg.content.engines.types.large_engine;
|
||||
|
||||
|
||||
import com.drmangotea.tfmg.registry.TFMGPartialModels;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||
import com.simibubi.create.AllPartialModels;
|
||||
import com.simibubi.create.content.kinetics.base.KineticBlockEntityRenderer;
|
||||
import com.simibubi.create.content.kinetics.steamEngine.PoweredShaftBlockEntity;
|
||||
import com.simibubi.create.foundation.blockEntity.renderer.SafeBlockEntityRenderer;
|
||||
import dev.engine_room.flywheel.lib.model.baked.PartialModel;
|
||||
import net.createmod.catnip.math.AngleHelper;
|
||||
import net.createmod.catnip.render.CachedBuffers;
|
||||
import net.createmod.catnip.render.SuperByteBuffer;
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.Direction.Axis;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
|
||||
public class LargeEngineRenderer extends SafeBlockEntityRenderer<LargeEngineBlockEntity> {
|
||||
|
||||
public LargeEngineRenderer(BlockEntityRendererProvider.Context context) {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void renderSafe(LargeEngineBlockEntity be, float partialTicks, PoseStack ms, MultiBufferSource buffer,
|
||||
int light, int overlay) {
|
||||
//if (Backend.canUseInstancing(te.getLevel()))
|
||||
// return;
|
||||
|
||||
Float angle = be.getTargetAngle();
|
||||
if (angle == null)
|
||||
return;
|
||||
|
||||
BlockState blockState = be.getBlockState();
|
||||
Direction facing = LargeEngineBlock.getFacing(blockState);
|
||||
Axis facingAxis = facing.getAxis();
|
||||
Axis axis = Axis.Y;
|
||||
|
||||
PoweredShaftBlockEntity shaft = be.getShaft();
|
||||
if (shaft != null)
|
||||
axis = KineticBlockEntityRenderer.getRotationAxisOf(shaft);
|
||||
|
||||
boolean roll90 = facingAxis.isHorizontal() && axis == Axis.Y || facingAxis.isVertical() && axis == Axis.Z;
|
||||
float sine = Mth.sin(angle);
|
||||
float sine2 = Mth.sin(angle - Mth.HALF_PI);
|
||||
float piston = ((1 - sine) / 4) * 24 / 16f;
|
||||
|
||||
VertexConsumer vb = buffer.getBuffer(RenderType.solid());
|
||||
|
||||
|
||||
transformed(be.isSimpleEngine() ? TFMGPartialModels.SIMPLE_LARGE_ENGINE_PISTON : TFMGPartialModels.LARGE_ENGINE_PISTON, blockState, facing, roll90)
|
||||
.translate(0, piston, 0)
|
||||
.light(light)
|
||||
.renderInto(ms, vb);
|
||||
|
||||
|
||||
transformed(be.isSimpleEngine() ? TFMGPartialModels.SIMPLE_LARGE_ENGINE_LINKAGE : TFMGPartialModels.LARGE_ENGINE_LINKAGE, blockState, facing, roll90)
|
||||
.center()
|
||||
.translate(0, 1, 0)
|
||||
.uncenter()
|
||||
.translate(0, piston, 0)
|
||||
.translate(0, 4 / 16f, 8 / 16f)
|
||||
.rotateXDegrees(sine2 * 23f)
|
||||
.translate(0, -4 / 16f, -8 / 16f)
|
||||
.light(light)
|
||||
.renderInto(ms, vb);
|
||||
|
||||
transformed(AllPartialModels.ENGINE_CONNECTOR, blockState, facing, roll90)
|
||||
.translate(0, 2, 0)
|
||||
.center()
|
||||
.rotateX(-angle + Mth.HALF_PI)
|
||||
.uncenter()
|
||||
.light(light)
|
||||
.renderInto(ms, vb);
|
||||
|
||||
|
||||
}
|
||||
|
||||
private SuperByteBuffer transformed(PartialModel model, BlockState blockState, Direction facing, boolean roll90) {
|
||||
return CachedBuffers.partial(model, blockState)
|
||||
.center()
|
||||
.rotateYDegrees(AngleHelper.horizontalAngle(facing))
|
||||
.rotateXDegrees(AngleHelper.verticalAngle(facing) + 90)
|
||||
.rotateYDegrees(roll90 ? -90 : 0)
|
||||
.uncenter();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getViewDistance() {
|
||||
return 128;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.drmangotea.tfmg.datagen.recipes.values;
|
||||
|
||||
import com.drmangotea.tfmg.datagen.recipes.TFMGProcessingRecipeGen;
|
||||
import com.drmangotea.tfmg.registry.TFMGBlocks;
|
||||
import com.drmangotea.tfmg.registry.TFMGFluids;
|
||||
import com.simibubi.create.AllRecipeTypes;
|
||||
import net.minecraft.data.PackOutput;
|
||||
|
||||
public class TFMGFillingRecipeGen extends TFMGProcessingRecipeGen {
|
||||
|
||||
GeneratedRecipe
|
||||
|
||||
HARDENED_PLANKS = create("hardened_planks", b -> b
|
||||
.require(TFMGFluids.CREOSOTE.getSource(), 250)
|
||||
.output(TFMGBlocks.HARDENED_PLANKS));
|
||||
|
||||
|
||||
public TFMGFillingRecipeGen(PackOutput output) {
|
||||
super(output);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected AllRecipeTypes getRecipeType() {
|
||||
return AllRecipeTypes.FILLING;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package com.drmangotea.tfmg.datagen.recipes.values;
|
||||
|
||||
import com.drmangotea.tfmg.datagen.recipes.TFMGRecipeProvider;
|
||||
import com.drmangotea.tfmg.datagen.recipes.builder.IndustrialBlastingRecipeBuilder;
|
||||
import com.drmangotea.tfmg.registry.TFMGFluids;
|
||||
import com.drmangotea.tfmg.registry.TFMGTags;
|
||||
import com.simibubi.create.AllItems;
|
||||
import net.minecraft.data.PackOutput;
|
||||
import net.minecraft.world.item.Items;
|
||||
import net.minecraft.world.item.crafting.Ingredient;
|
||||
|
||||
import static com.drmangotea.tfmg.datagen.recipes.TFMGRecipeProvider.I.ironDust;
|
||||
|
||||
|
||||
public class TFMGIndustrialBlastingRecipeGen extends TFMGRecipeProvider{
|
||||
|
||||
|
||||
GeneratedRecipe
|
||||
|
||||
STEEL = createIndustrialBlastingRecipe("steel", b -> (IndustrialBlastingRecipeBuilder) b
|
||||
.require(AllItems.CRUSHED_IRON)
|
||||
.require(TFMGTags.TFMGItemTags.FLUX.tag)
|
||||
.output(TFMGFluids.MOLTEN_STEEL.get(),144)
|
||||
.output(TFMGFluids.MOLTEN_SLAG.get(),144)
|
||||
.output(TFMGFluids.FURNACE_GAS.get(),20)
|
||||
.duration(60)
|
||||
, 20),
|
||||
STEEL_DOUBLE = createIndustrialBlastingRecipe("steel_from_raw_iron", b -> (IndustrialBlastingRecipeBuilder) b
|
||||
.require(Items.RAW_IRON)
|
||||
.require(Ingredient.of(TFMGTags.TFMGItemTags.FLUX.tag))
|
||||
.require(Ingredient.of(TFMGTags.TFMGItemTags.FLUX.tag))
|
||||
.output(TFMGFluids.MOLTEN_STEEL.get(),288)
|
||||
.output(TFMGFluids.MOLTEN_SLAG.get(),288)
|
||||
.output(TFMGFluids.FURNACE_GAS.get(),20)
|
||||
.duration(120)
|
||||
, 30),
|
||||
|
||||
|
||||
STEEL_DUST = createIndustrialBlastingRecipe("steel_from_dust", b -> (IndustrialBlastingRecipeBuilder) b
|
||||
.require(ironDust())
|
||||
.require(TFMGTags.TFMGItemTags.FLUX.tag)
|
||||
.output(TFMGFluids.MOLTEN_STEEL.get(),144)
|
||||
.output(TFMGFluids.MOLTEN_SLAG.get(),144)
|
||||
.output(TFMGFluids.FURNACE_GAS.get(),20)
|
||||
.duration(50)
|
||||
, 20)
|
||||
|
||||
|
||||
|
||||
;
|
||||
|
||||
|
||||
public TFMGIndustrialBlastingRecipeGen(PackOutput output) {super(output);}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.drmangotea.tfmg.datagen.recipes.values;
|
||||
|
||||
import com.drmangotea.tfmg.datagen.recipes.TFMGProcessingRecipeGen;
|
||||
import com.drmangotea.tfmg.datagen.recipes.TFMGRecipeProvider;
|
||||
import com.drmangotea.tfmg.registry.TFMGBlocks;
|
||||
import com.drmangotea.tfmg.registry.TFMGItems;
|
||||
import com.simibubi.create.AllRecipeTypes;
|
||||
import net.minecraft.data.PackOutput;
|
||||
import net.minecraft.world.item.crafting.Ingredient;
|
||||
import net.minecraft.world.level.ItemLike;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import static com.drmangotea.tfmg.datagen.recipes.TFMGRecipeProvider.I.*;
|
||||
|
||||
public class TFMGItemApplicationRecipeGen extends TFMGProcessingRecipeGen {
|
||||
|
||||
GeneratedRecipe STEEL = casing("steel", () -> Ingredient.of(steelIngot()), TFMGBlocks.STEEL_CASING::get, TFMGBlocks.HARDENED_PLANKS::get);
|
||||
GeneratedRecipe HEAVY_CASING = casing("heavy_machinery", () -> Ingredient.of(steelSheet()), TFMGBlocks.HEAVY_MACHINERY_CASING::get, TFMGBlocks.STEEL_CASING::get);
|
||||
GeneratedRecipe ALUMINUM = casing("aluminum", () -> Ingredient.of(aluminumSheet()), TFMGBlocks.ALUMINUM_CASING::get, TFMGBlocks.STEEL_CASING::get);
|
||||
|
||||
|
||||
GeneratedRecipe
|
||||
COATED_CIRCUIT_BOARD = create("coated_circuit_board", b -> b
|
||||
.require(TFMGItems.EMPTY_CIRCUIT_BOARD)
|
||||
.require(goldSheet())
|
||||
.output(TFMGItems.COATED_CIRCUIT_BOARD)
|
||||
);
|
||||
|
||||
protected TFMGRecipeProvider.GeneratedRecipe casing(String type, Supplier<Ingredient> ingredient,
|
||||
Supplier<ItemLike> output, Supplier<ItemLike> block) {
|
||||
return create(type + "_casing", b -> b.require(block.get())
|
||||
.require(ingredient.get())
|
||||
.output(output.get()));
|
||||
}
|
||||
|
||||
public TFMGItemApplicationRecipeGen(PackOutput output) {
|
||||
super(output);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected AllRecipeTypes getRecipeType() {
|
||||
return AllRecipeTypes.ITEM_APPLICATION;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,173 @@
|
||||
package com.drmangotea.tfmg.datagen.recipes.values;
|
||||
|
||||
import java.util.function.UnaryOperator;
|
||||
|
||||
import com.drmangotea.tfmg.datagen.recipes.TFMGRecipeProvider;
|
||||
import com.drmangotea.tfmg.registry.TFMGBlocks;
|
||||
import com.drmangotea.tfmg.registry.TFMGItems;
|
||||
import com.google.common.base.Supplier;
|
||||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.AllItems;
|
||||
import com.simibubi.create.Create;
|
||||
|
||||
import com.simibubi.create.foundation.data.recipe.CreateRecipeProvider;
|
||||
import com.simibubi.create.foundation.data.recipe.MechanicalCraftingRecipeBuilder;
|
||||
import net.createmod.catnip.platform.CatnipServices;
|
||||
import net.minecraft.data.PackOutput;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.tags.ItemTags;
|
||||
import net.minecraft.world.item.Items;
|
||||
import net.minecraft.world.item.crafting.Ingredient;
|
||||
import net.minecraft.world.level.ItemLike;
|
||||
import net.minecraftforge.common.Tags;
|
||||
|
||||
import static com.drmangotea.tfmg.datagen.recipes.TFMGRecipeProvider.I.*;
|
||||
|
||||
public class TFMGMechanicalCraftingRecipeGen extends TFMGRecipeProvider {
|
||||
|
||||
GeneratedRecipe
|
||||
|
||||
ENGINE_CONTROLLER = create(TFMGBlocks.ENGINE_CONTROLLER::get)
|
||||
.recipe(b -> b
|
||||
.key('R', rubber())
|
||||
.key('S', shaft())
|
||||
.key('V', TFMGBlocks.VOLTMETER)
|
||||
.key('W', copperWire())
|
||||
.key('C', heavyMachineryCasing())
|
||||
.key('Z', circuitBoard())
|
||||
.key('M', steelMechanism())
|
||||
.patternLine("RRR")
|
||||
.patternLine("VSV")
|
||||
.patternLine("WCW")
|
||||
.patternLine("ZMZ")
|
||||
.disallowMirrored()),
|
||||
|
||||
ROTOR = create(TFMGBlocks.ROTOR::get)
|
||||
.recipe(b -> b
|
||||
.key('C', coil1000Turns())
|
||||
.key('A', aluminumIngot())
|
||||
.key('S', steelBlock())
|
||||
.patternLine(" CCC ")
|
||||
.patternLine("CAAAC")
|
||||
.patternLine("CASAC")
|
||||
.patternLine("CAAAC")
|
||||
.patternLine(" CCC ")
|
||||
.disallowMirrored()),
|
||||
|
||||
STATOR = create(TFMGBlocks.STATOR::get).returns(3)
|
||||
.recipe(b -> b
|
||||
.key('C', coil1000Turns())
|
||||
.key('A', aluminumSheet())
|
||||
.key('W', copperWire())
|
||||
.key('M', magnet())
|
||||
.key('S', steelBlock())
|
||||
.patternLine("CM ")
|
||||
.patternLine("ACM ")
|
||||
.patternLine("ASCM")
|
||||
.patternLine("WAAC")
|
||||
.disallowMirrored()),
|
||||
|
||||
SIMPLE_LARGE_ENGINE = create(TFMGBlocks.SIMPLE_LARGE_ENGINE::get)
|
||||
.recipe(b -> b
|
||||
.key('C', castIronIngot())
|
||||
.key('O', steelSheet())
|
||||
.key('M', precisionMechanism())
|
||||
.patternLine("CCC")
|
||||
.patternLine("OCO")
|
||||
.patternLine("OMO")
|
||||
.patternLine("OCO")
|
||||
.disallowMirrored()),
|
||||
|
||||
QUAD_POTATO_CANNON = create(TFMGItems.QUAD_POTATO_CANNON::get)
|
||||
.recipe(b -> b
|
||||
.key('O', steelIngot())
|
||||
.key('C', castIronIngot())
|
||||
.key('P', steelPipe())
|
||||
.key('M', steelMechanism())
|
||||
.patternLine("PMPC")
|
||||
.patternLine("PMPC")
|
||||
.patternLine(" O ")
|
||||
.disallowMirrored()),
|
||||
|
||||
FLAMETHROWER = create(TFMGItems.FLAMETHROWER::get)
|
||||
.recipe(b -> b
|
||||
.key('O', steelIngot())
|
||||
.key('C', circuitBoard())
|
||||
.key('P', steelPipe())
|
||||
.key('M', steelMechanism())
|
||||
.key('W', copperWire())
|
||||
.patternLine("BWC ")
|
||||
.patternLine("PPTM")
|
||||
.patternLine("S O ")
|
||||
.disallowMirrored()),
|
||||
|
||||
LARGE_ENGINE = create(TFMGBlocks.LARGE_ENGINE::get)
|
||||
.recipe((b) -> b
|
||||
.key('A', aluminumSheet())
|
||||
.key('B', aluminumIngot())
|
||||
.key('H', I.heavyPlate())
|
||||
.key('S', I.steelMechanism())
|
||||
.key('C', I.heavyMachineryCasing())
|
||||
.key('O', steelIngot())
|
||||
.key('T', TFMGBlocks.STEEL_FLUID_TANK.get())
|
||||
.patternLine(" O ")
|
||||
.patternLine(" B ")
|
||||
.patternLine("AOA")
|
||||
.patternLine("SCS")
|
||||
.patternLine("STS")
|
||||
.patternLine("HHH")),
|
||||
|
||||
SPARK_PLUG = create(TFMGItems.SPARK_PLUG::get)
|
||||
.recipe(b -> b
|
||||
.key('F', Items.FLINT)
|
||||
.key('A', aluminumIngot())
|
||||
.patternLine("F")
|
||||
.patternLine("A")
|
||||
.disallowMirrored());
|
||||
|
||||
|
||||
|
||||
public TFMGMechanicalCraftingRecipeGen(PackOutput p_i48262_1_) {
|
||||
super(p_i48262_1_);
|
||||
}
|
||||
|
||||
GeneratedRecipeBuilder create(Supplier<ItemLike> result) {
|
||||
return new GeneratedRecipeBuilder(result);
|
||||
}
|
||||
|
||||
class GeneratedRecipeBuilder {
|
||||
|
||||
private String suffix;
|
||||
private Supplier<ItemLike> result;
|
||||
private int amount;
|
||||
|
||||
public GeneratedRecipeBuilder(Supplier<ItemLike> result) {
|
||||
this.suffix = "";
|
||||
this.result = result;
|
||||
this.amount = 1;
|
||||
}
|
||||
|
||||
GeneratedRecipeBuilder returns(int amount) {
|
||||
this.amount = amount;
|
||||
return this;
|
||||
}
|
||||
|
||||
GeneratedRecipeBuilder withSuffix(String suffix) {
|
||||
this.suffix = suffix;
|
||||
return this;
|
||||
}
|
||||
|
||||
GeneratedRecipe recipe(UnaryOperator<MechanicalCraftingRecipeBuilder> builder) {
|
||||
return register(consumer -> {
|
||||
MechanicalCraftingRecipeBuilder b =
|
||||
builder.apply(MechanicalCraftingRecipeBuilder.shapedRecipe(result.get(), amount));
|
||||
ResourceLocation location = Create.asResource("mechanical_crafting/" + CatnipServices.REGISTRIES.getKeyOrThrow(result.get()
|
||||
.asItem())
|
||||
.getPath() + suffix);
|
||||
b.build(consumer, location);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"credit": "Made with Blockbench",
|
||||
"textures": {
|
||||
"0": "tfmg:block/engines/engine_top_connected",
|
||||
"particle": "tfmg:block/engines/engine_top_connected"
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"from": [7.5, 7.5, 1],
|
||||
"to": [8.5, 9.5, 1],
|
||||
"rotation": {"angle": 0, "axis": "y", "origin": [7, 8, 0]},
|
||||
"faces": {
|
||||
"north": {"uv": [2.5, 0, 3, 1], "texture": "#0"},
|
||||
"east": {"uv": [0, 0, 0, 2], "texture": "#0"},
|
||||
"west": {"uv": [0, 0, 0, 2], "texture": "#0"},
|
||||
"up": {"uv": [0, 0, 1, 0], "texture": "#0"},
|
||||
"down": {"uv": [0, 0, 1, 0], "texture": "#0"}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"credit": "Made with Blockbench",
|
||||
"parent": "block/block",
|
||||
"textures": {
|
||||
"0": "tfmg:block/diesel_engine_back",
|
||||
"1": "tfmg:block/diesel_engine_front",
|
||||
"2": "tfmg:block/diesel_engine_side",
|
||||
"particle": "tfmg:block/diesel_engine_back"
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"from": [0, 0, 0],
|
||||
"to": [16, 16, 16],
|
||||
"faces": {
|
||||
"north": {"uv": [0, 0, 16, 16], "texture": "#2"},
|
||||
"east": {"uv": [0, 0, 16, 16], "texture": "#2"},
|
||||
"south": {"uv": [0, 0, 16, 16], "texture": "#2"},
|
||||
"west": {"uv": [0, 0, 16, 16], "texture": "#2"},
|
||||
"up": {"uv": [0, 0, 16, 16], "texture": "#1"},
|
||||
"down": {"uv": [0, 0, 16, 16], "texture": "#0"}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
{
|
||||
"credit": "Made with Blockbench",
|
||||
"textures": {
|
||||
"0": "tfmg:block/diesel_engine_linkage"
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"from": [6, 1, 4],
|
||||
"to": [10, 7, 12],
|
||||
"faces": {
|
||||
"north": {"uv": [8.5, 11, 10.5, 14], "texture": "#0"},
|
||||
"east": {"uv": [10.5, 11, 14.5, 14], "texture": "#0"},
|
||||
"south": {"uv": [8.5, 11, 10.5, 14], "texture": "#0"},
|
||||
"west": {"uv": [10.5, 11, 14.5, 14], "texture": "#0"},
|
||||
"up": {"uv": [10.5, 9, 14.5, 11], "rotation": 90, "texture": "#0"},
|
||||
"down": {"uv": [10.5, 14, 14.5, 16], "rotation": 90, "texture": "#0"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [6, 15, 4],
|
||||
"to": [10, 21, 12],
|
||||
"faces": {
|
||||
"north": {"uv": [8.5, 11, 10.5, 14], "texture": "#0"},
|
||||
"east": {"uv": [10.5, 11, 14.5, 14], "texture": "#0"},
|
||||
"south": {"uv": [8.5, 11, 10.5, 14], "texture": "#0"},
|
||||
"west": {"uv": [10.5, 11, 14.5, 14], "texture": "#0"},
|
||||
"up": {"uv": [10.5, 9, 14.5, 11], "rotation": 90, "texture": "#0"},
|
||||
"down": {"uv": [10.5, 14, 14.5, 16], "rotation": 90, "texture": "#0"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [6, 7, 6],
|
||||
"to": [10, 15, 10],
|
||||
"faces": {
|
||||
"north": {"uv": [1.5, 1, 3.5, 6], "texture": "#0"},
|
||||
"east": {"uv": [1.5, 1, 3.5, 6], "texture": "#0"},
|
||||
"south": {"uv": [1.5, 1, 3.5, 6], "texture": "#0"},
|
||||
"west": {"uv": [1.5, 1, 3.5, 6], "texture": "#0"}
|
||||
}
|
||||
}
|
||||
],
|
||||
"display": {},
|
||||
"groups": [
|
||||
{
|
||||
"name": "Linkage",
|
||||
"origin": [8, 8, 8],
|
||||
"color": 0,
|
||||
"children": [0, 1, 2]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"credit": "Made with Blockbench",
|
||||
"textures": {
|
||||
"0": "tfmg:block/diesel_engine_linkage"
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"from": [5, 3, 5],
|
||||
"to": [11, 22, 11],
|
||||
"faces": {
|
||||
"north": {"uv": [4, 6.5, 7, 16], "texture": "#0"},
|
||||
"east": {"uv": [1, 6.5, 4, 16], "texture": "#0"},
|
||||
"south": {"uv": [4, 6.5, 7, 16], "texture": "#0"},
|
||||
"west": {"uv": [1, 6.5, 4, 16], "texture": "#0"},
|
||||
"up": {"uv": [4, 3.5, 7, 6.5], "texture": "#0"}
|
||||
}
|
||||
}
|
||||
],
|
||||
"display": {},
|
||||
"groups": [
|
||||
{
|
||||
"name": "Piston",
|
||||
"origin": [0, 0, 0],
|
||||
"color": 0,
|
||||
"children": [0]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"credit": "Made with Blockbench",
|
||||
"texture_size": [128, 128],
|
||||
"textures": {
|
||||
"1": "tfmg:block/large_radial_engine",
|
||||
"particle": "tfmg:block/engines/aluminum_cylinder"
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"from": [4, -1, 4],
|
||||
"to": [12, 13, 12],
|
||||
"rotation": {"angle": 0, "axis": "y", "origin": [8, 8, 0]},
|
||||
"faces": {
|
||||
"north": {"uv": [5.5, 0, 9, 2], "rotation": 90, "texture": "#1"},
|
||||
"east": {"uv": [5.5, 0, 9, 2], "rotation": 90, "texture": "#1"},
|
||||
"south": {"uv": [5.5, 0, 9, 2], "rotation": 90, "texture": "#1"},
|
||||
"west": {"uv": [5.5, 0, 9, 2], "rotation": 90, "texture": "#1"},
|
||||
"up": {"uv": [15.5, 5.5, 13.5, 3.5], "texture": "#1"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [5, -1, 5],
|
||||
"to": [11, 13, 11],
|
||||
"rotation": {"angle": 0, "axis": "y", "origin": [8, 8, 0]},
|
||||
"faces": {
|
||||
"north": {"uv": [12, 2, 15.5, 3.5], "rotation": 270, "texture": "#1"},
|
||||
"east": {"uv": [12, 2, 15.5, 3.5], "rotation": 270, "texture": "#1"},
|
||||
"south": {"uv": [12, 2, 15.5, 3.5], "rotation": 270, "texture": "#1"},
|
||||
"west": {"uv": [12, 2, 15.5, 3.5], "rotation": 270, "texture": "#1"},
|
||||
"up": {"uv": [15, 5.5, 13.5, 7], "rotation": 180, "texture": "#1"}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"credit": "Made with Blockbench",
|
||||
"parent": "block/block",
|
||||
"textures": {
|
||||
"0": "tfmg:block/simple_large_engine",
|
||||
"particle": "tfmg:block/simple_large_engine"
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"from": [1, 0, 1],
|
||||
"to": [15, 3, 15],
|
||||
"rotation": {"angle": 0, "axis": "x", "origin": [1, 2, 1]},
|
||||
"faces": {
|
||||
"north": {"uv": [0, 16, 7, 14.5], "rotation": 180, "texture": "#0"},
|
||||
"east": {"uv": [0, 16, 7, 14.5], "rotation": 180, "texture": "#0"},
|
||||
"south": {"uv": [0, 14.5, 7, 16], "texture": "#0"},
|
||||
"west": {"uv": [0, 14.5, 7, 16], "texture": "#0"},
|
||||
"up": {"uv": [9, 0, 16, 7], "rotation": 180, "texture": "#0"},
|
||||
"down": {"uv": [9, 0, 16, 7], "texture": "#0"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [3, 2, 3],
|
||||
"to": [13, 15, 13],
|
||||
"rotation": {"angle": 0, "axis": "x", "origin": [1, 4, 1]},
|
||||
"faces": {
|
||||
"north": {"uv": [14.5, 14.5, 9.5, 8], "rotation": 180, "texture": "#0"},
|
||||
"east": {"uv": [0, 6, 5, 12.5], "texture": "#0"},
|
||||
"south": {"uv": [9.5, 8, 14.5, 14.5], "texture": "#0"},
|
||||
"west": {"uv": [0, 6, 5, 12.5], "texture": "#0"},
|
||||
"up": {"uv": [0, 0, 5, 5], "rotation": 180, "texture": "#0"}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"credit": "Made with Blockbench",
|
||||
"parent": "block/block",
|
||||
"textures": {
|
||||
"0": "tfmg:block/simple_large_engine",
|
||||
"particle": "tfmg:block/simple_large_engine"
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"from": [1, 0, 1],
|
||||
"to": [15, 3, 15],
|
||||
"rotation": {"angle": 0, "axis": "x", "origin": [1, 2, 1]},
|
||||
"faces": {
|
||||
"north": {"uv": [0, 16, 7, 14.5], "rotation": 180, "texture": "#0"},
|
||||
"east": {"uv": [0, 16, 7, 14.5], "rotation": 180, "texture": "#0"},
|
||||
"south": {"uv": [0, 14.5, 7, 16], "texture": "#0"},
|
||||
"west": {"uv": [0, 14.5, 7, 16], "texture": "#0"},
|
||||
"up": {"uv": [9, 0, 16, 7], "rotation": 180, "texture": "#0"},
|
||||
"down": {"uv": [9, 0, 16, 7], "texture": "#0"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [3, 2, 3],
|
||||
"to": [13, 15, 13],
|
||||
"rotation": {"angle": 0, "axis": "x", "origin": [1, 4, 1]},
|
||||
"faces": {
|
||||
"north": {"uv": [14.5, 14.5, 9.5, 8], "rotation": 180, "texture": "#0"},
|
||||
"east": {"uv": [0, 6, 5, 12.5], "texture": "#0"},
|
||||
"south": {"uv": [9.5, 8, 14.5, 14.5], "texture": "#0"},
|
||||
"west": {"uv": [0, 6, 5, 12.5], "texture": "#0"},
|
||||
"up": {"uv": [0, 0, 5, 5], "rotation": 180, "texture": "#0"}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
{
|
||||
"credit": "Made with Blockbench",
|
||||
"textures": {
|
||||
"0": "tfmg:block/simple_engine_linkage"
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"from": [6, 1, 4],
|
||||
"to": [10, 7, 12],
|
||||
"faces": {
|
||||
"north": {"uv": [8.5, 11, 10.5, 14], "texture": "#0"},
|
||||
"east": {"uv": [10.5, 11, 14.5, 14], "texture": "#0"},
|
||||
"south": {"uv": [8.5, 11, 10.5, 14], "texture": "#0"},
|
||||
"west": {"uv": [10.5, 11, 14.5, 14], "texture": "#0"},
|
||||
"up": {"uv": [10.5, 9, 14.5, 11], "rotation": 90, "texture": "#0"},
|
||||
"down": {"uv": [10.5, 14, 14.5, 16], "rotation": 90, "texture": "#0"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [6, 15, 4],
|
||||
"to": [10, 21, 12],
|
||||
"faces": {
|
||||
"north": {"uv": [8.5, 11, 10.5, 14], "texture": "#0"},
|
||||
"east": {"uv": [10.5, 11, 14.5, 14], "texture": "#0"},
|
||||
"south": {"uv": [8.5, 11, 10.5, 14], "texture": "#0"},
|
||||
"west": {"uv": [10.5, 11, 14.5, 14], "texture": "#0"},
|
||||
"up": {"uv": [10.5, 9, 14.5, 11], "rotation": 90, "texture": "#0"},
|
||||
"down": {"uv": [10.5, 14, 14.5, 16], "rotation": 90, "texture": "#0"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [6, 7, 6],
|
||||
"to": [10, 15, 10],
|
||||
"faces": {
|
||||
"north": {"uv": [1.5, 1, 3.5, 6], "texture": "#0"},
|
||||
"east": {"uv": [1.5, 1, 3.5, 6], "texture": "#0"},
|
||||
"south": {"uv": [1.5, 1, 3.5, 6], "texture": "#0"},
|
||||
"west": {"uv": [1.5, 1, 3.5, 6], "texture": "#0"}
|
||||
}
|
||||
}
|
||||
],
|
||||
"groups": [
|
||||
{
|
||||
"name": "Linkage",
|
||||
"origin": [8, 8, 8],
|
||||
"color": 0,
|
||||
"children": [0, 1, 2]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"credit": "Made with Blockbench",
|
||||
"textures": {
|
||||
"0": "tfmg:block/simple_engine_linkage"
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"from": [5, 3, 5],
|
||||
"to": [11, 22, 11],
|
||||
"faces": {
|
||||
"north": {"uv": [4, 6.5, 7, 16], "texture": "#0"},
|
||||
"east": {"uv": [1, 6.5, 4, 16], "texture": "#0"},
|
||||
"south": {"uv": [4, 6.5, 7, 16], "texture": "#0"},
|
||||
"west": {"uv": [1, 6.5, 4, 16], "texture": "#0"},
|
||||
"up": {"uv": [4, 3.5, 7, 6.5], "texture": "#0"}
|
||||
}
|
||||
}
|
||||
],
|
||||
"display": {},
|
||||
"groups": [
|
||||
{
|
||||
"name": "Piston",
|
||||
"origin": [0, 0, 0],
|
||||
"color": 0,
|
||||
"children": [0]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
After Width: | Height: | Size: 418 B |
|
After Width: | Height: | Size: 374 B |
|
After Width: | Height: | Size: 132 B |
|
After Width: | Height: | Size: 443 B |
|
After Width: | Height: | Size: 449 B |
|
After Width: | Height: | Size: 424 B |
|
After Width: | Height: | Size: 440 B |
|
After Width: | Height: | Size: 418 B |
|
After Width: | Height: | Size: 426 B |
BIN
src/main/resources/assets/tfmg/textures/block/firebrick_vat.png
Normal file
|
After Width: | Height: | Size: 513 B |
|
After Width: | Height: | Size: 2.5 KiB |
|
After Width: | Height: | Size: 442 B |
|
After Width: | Height: | Size: 454 B |
|
After Width: | Height: | Size: 805 B |
|
After Width: | Height: | Size: 806 B |
|
After Width: | Height: | Size: 410 B |
|
After Width: | Height: | Size: 430 B |
BIN
src/main/resources/assets/tfmg/textures/item/bauxite_powder.png
Normal file
|
After Width: | Height: | Size: 202 B |
|
After Width: | Height: | Size: 231 B |