air intakes and engines
@@ -1,7 +1,7 @@
|
||||
package com.drmangotea.tfmg;
|
||||
|
||||
import com.drmangotea.tfmg.base.TFMGLangPartials;
|
||||
import com.drmangotea.tfmg.blocks.gadgets.explosives.thermite_grenades.fire.TFMGColoredFires;
|
||||
import com.drmangotea.tfmg.items.gadgets.explosives.thermite_grenades.fire.TFMGColoredFires;
|
||||
import com.drmangotea.tfmg.registry.*;
|
||||
import com.drmangotea.tfmg.worldgen.TFMGConfiguredFeatures;
|
||||
import com.drmangotea.tfmg.worldgen.TFMGFeatures;
|
||||
@@ -69,6 +69,7 @@ public class CreateTFMG
|
||||
DataGenerator gen = event.getGenerator();
|
||||
gen.addProvider(true, new LangMerger(gen, MOD_ID, NAME, TFMGLangPartials.values()));
|
||||
}
|
||||
@SuppressWarnings("removal")
|
||||
private void clientSetup(final FMLClientSetupEvent event) {
|
||||
ItemBlockRenderTypes.setRenderLayer(TFMGColoredFires.GREEN_FIRE.get(), RenderType.cutout());
|
||||
ItemBlockRenderTypes.setRenderLayer(TFMGColoredFires.BLUE_FIRE.get(), RenderType.cutout());
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.drmangotea.tfmg;
|
||||
|
||||
|
||||
import com.drmangotea.tfmg.blocks.gadgets.quad_potato_cannon.QuadPotatoCannonRenderHandler;
|
||||
import com.drmangotea.tfmg.items.gadgets.quad_potato_cannon.QuadPotatoCannonRenderHandler;
|
||||
import com.drmangotea.tfmg.registry.TFMGPartialModels;
|
||||
import net.minecraftforge.eventbus.api.IEventBus;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
|
||||
@@ -1,18 +1,70 @@
|
||||
package com.drmangotea.tfmg.base;
|
||||
|
||||
import com.drmangotea.tfmg.CreateTFMG;
|
||||
import com.drmangotea.tfmg.base.palettes.TFMGPaletteBlockPattern;
|
||||
import com.simibubi.create.foundation.data.CreateRegistrate;
|
||||
import com.tterrag.registrate.builders.BlockBuilder;
|
||||
import com.tterrag.registrate.builders.ItemBuilder;
|
||||
import com.tterrag.registrate.providers.DataGenContext;
|
||||
import com.tterrag.registrate.providers.RegistrateBlockstateProvider;
|
||||
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.item.BlockItem;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.SlabBlock;
|
||||
import net.minecraft.world.level.block.StairBlock;
|
||||
import net.minecraft.world.level.block.WallBlock;
|
||||
import net.minecraftforge.client.model.generators.ModelFile;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class TFMGVanillaBlockStates {
|
||||
|
||||
|
||||
|
||||
//WALL
|
||||
public static void generateWallBlockState(DataGenContext<Block, WallBlock> ctx, RegistrateBlockstateProvider prov,
|
||||
String name) {
|
||||
prov.wallBlock(ctx.get(), name, CreateTFMG.asResource("block/"+name));
|
||||
}
|
||||
public static ItemBuilder<BlockItem, BlockBuilder<WallBlock, CreateRegistrate>> transformWallItem(
|
||||
ItemBuilder<BlockItem, BlockBuilder<WallBlock, CreateRegistrate>> builder, String name) {
|
||||
builder.model((c, p) -> p.wallInventory(c.getName(), CreateTFMG.asResource("block/"+name)));
|
||||
return builder;
|
||||
}
|
||||
|
||||
//STAIR
|
||||
public static void generateStairBlockState(DataGenContext<Block, StairBlock> ctx, RegistrateBlockstateProvider prov,
|
||||
String name) {
|
||||
prov.stairsBlock(ctx.get(), name, CreateTFMG.asResource("block/"+name));
|
||||
}
|
||||
public static ItemBuilder<BlockItem, BlockBuilder<StairBlock, CreateRegistrate>> transformStairItem(
|
||||
ItemBuilder<BlockItem, BlockBuilder<StairBlock, CreateRegistrate>> builder, String variantName) {
|
||||
return builder;
|
||||
}
|
||||
|
||||
//SLAB
|
||||
|
||||
public static void generateSlabBlockState(DataGenContext<Block, SlabBlock> ctx, RegistrateBlockstateProvider prov,
|
||||
String variantName) {
|
||||
String name = variantName;
|
||||
ResourceLocation texture = CreateTFMG.asResource("block/"+name);
|
||||
|
||||
|
||||
ModelFile bottom = prov.models()
|
||||
.slab(name+"_bottom", texture, texture, texture);
|
||||
ModelFile top = prov.models()
|
||||
.slabTop(name + "_top", texture, texture, texture);
|
||||
ModelFile doubleSlab = prov.models()
|
||||
.getExistingFile(prov.modLoc("block/"+name));
|
||||
|
||||
|
||||
prov.slabBlock(ctx.get(), bottom, top, doubleSlab);
|
||||
}
|
||||
public static ItemBuilder<BlockItem, BlockBuilder<SlabBlock, CreateRegistrate>> transformSlabItem(
|
||||
ItemBuilder<BlockItem, BlockBuilder<SlabBlock, CreateRegistrate>> builder, String variantName) {
|
||||
return builder;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -17,6 +17,6 @@ public class BuldingCreativeModeTab extends TFMGCreativeModeTab {
|
||||
|
||||
@Override
|
||||
public ItemStack makeIcon() {
|
||||
return TFMGBlocks.CONCRETE.asStack();
|
||||
return TFMGBlocks.CONCRETE_TEST.asStack();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.drmangotea.tfmg.base.spark;
|
||||
|
||||
|
||||
import com.drmangotea.tfmg.blocks.gadgets.explosives.thermite_grenades.fire.BlueFireBlock;
|
||||
import com.drmangotea.tfmg.items.gadgets.explosives.thermite_grenades.fire.BlueFireBlock;
|
||||
import com.drmangotea.tfmg.registry.TFMGEntityTypes;
|
||||
import com.drmangotea.tfmg.registry.TFMGItems;
|
||||
import com.simibubi.create.content.trains.CubeParticleData;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.drmangotea.tfmg.base.spark;
|
||||
|
||||
|
||||
import com.drmangotea.tfmg.blocks.gadgets.explosives.thermite_grenades.fire.GreenFireBlock;
|
||||
import com.drmangotea.tfmg.items.gadgets.explosives.thermite_grenades.fire.GreenFireBlock;
|
||||
import com.drmangotea.tfmg.registry.TFMGEntityTypes;
|
||||
import com.drmangotea.tfmg.registry.TFMGItems;
|
||||
import com.simibubi.create.content.trains.CubeParticleData;
|
||||
|
||||
@@ -31,7 +31,7 @@ public class ConcreteFluid extends ForgeFlowingFluid {
|
||||
int random = randomSource.nextInt(7) ;
|
||||
|
||||
if(random==2) {
|
||||
level.setBlock(pos, TFMGBlocks.CONCRETE.get().defaultBlockState(), 3);
|
||||
level.setBlock(pos, TFMGBlocks.CONCRETE_TEST.get().defaultBlockState(), 3);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ public class FormWorkBlockEntity extends TFMGMachineBlockEntity {
|
||||
timer--;
|
||||
|
||||
if(timer==0){
|
||||
level.setBlock(getBlockPos(), TFMGBlocks.CONCRETE.getDefaultState(),1);
|
||||
level.setBlock(getBlockPos(), TFMGBlocks.CONCRETE_TEST.getDefaultState(),1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,125 @@
|
||||
package com.drmangotea.tfmg.blocks.decoration;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
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.block.*;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.block.state.StateDefinition;
|
||||
import net.minecraft.world.level.block.state.properties.DirectionProperty;
|
||||
import net.minecraft.world.level.pathfinder.PathComputationType;
|
||||
import net.minecraft.world.phys.shapes.CollisionContext;
|
||||
import net.minecraft.world.phys.shapes.Shapes;
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
|
||||
public class CornerRailingBlock extends Block {
|
||||
public static final DirectionProperty FACING = HorizontalDirectionalBlock.FACING;
|
||||
|
||||
|
||||
|
||||
public static final VoxelShape SHAPE_SECONDARY_RAILING_WEST = Block.box(0, 0, 14, 16, 16, 16);
|
||||
public static final VoxelShape SHAPE_SECONDARY_RAILING_NORTH = Block.box(0, 0, 0, 2, 16, 16);
|
||||
public static final VoxelShape SHAPE_SECONDARY_RAILING_EAST = Block.box(0, 0, 0, 16, 16, 2);
|
||||
public static final VoxelShape SHAPE_SECONDARY_RAILING_SOUTH = Block.box(14, 0, 0, 16, 16, 16);
|
||||
|
||||
public static final VoxelShape SHAPE_WEST = Shapes.or(Block.box(0, 0, 0, 2, 16, 16),SHAPE_SECONDARY_RAILING_WEST);
|
||||
public static final VoxelShape SHAPE_NORTH = Shapes.or(Block.box(0, 0, 0, 16, 16, 2),SHAPE_SECONDARY_RAILING_NORTH);
|
||||
public static final VoxelShape SHAPE_EAST = Shapes.or(Block.box(14, 0, 0, 16, 16, 16),SHAPE_SECONDARY_RAILING_EAST);
|
||||
public static final VoxelShape SHAPE_SOUTH = Shapes.or(Block.box(0, 0, 14, 16, 16, 16),SHAPE_SECONDARY_RAILING_SOUTH);
|
||||
|
||||
|
||||
public CornerRailingBlock(Properties p_54479_) {
|
||||
super(p_54479_);
|
||||
this.registerDefaultState(this.stateDefinition.any().setValue(FACING, Direction.NORTH));
|
||||
}
|
||||
|
||||
public RenderShape getRenderShape(BlockState p_54559_) {
|
||||
return RenderShape.MODEL;
|
||||
}
|
||||
|
||||
public VoxelShape getOcclusionShape(BlockState p_54584_, BlockGetter p_54585_, BlockPos p_54586_) {
|
||||
switch((Direction)p_54584_.getValue(FACING)) {
|
||||
case NORTH:
|
||||
return SHAPE_SOUTH;
|
||||
case SOUTH:
|
||||
return SHAPE_NORTH;
|
||||
case EAST:
|
||||
return SHAPE_WEST;
|
||||
case WEST:
|
||||
return SHAPE_EAST;
|
||||
default:
|
||||
return SHAPE_NORTH;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean useShapeForLightOcclusion(BlockState p_54582_) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public BlockState getStateForPlacement(BlockPlaceContext p_54481_) {
|
||||
Level level = p_54481_.getLevel();
|
||||
ItemStack itemstack = p_54481_.getItemInHand();
|
||||
Player player = p_54481_.getPlayer();
|
||||
boolean flag = false;
|
||||
if (!level.isClientSide && player != null && player.canUseGameMasterBlocks()) {
|
||||
CompoundTag compoundtag = BlockItem.getBlockEntityData(itemstack);
|
||||
if (compoundtag != null && compoundtag.contains("Book")) {
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
|
||||
return this.defaultBlockState().setValue(FACING, p_54481_.getHorizontalDirection().getOpposite());
|
||||
}
|
||||
|
||||
public VoxelShape getCollisionShape(BlockState p_54577_, BlockGetter p_54578_, BlockPos p_54579_, CollisionContext p_54580_) {
|
||||
switch((Direction)p_54577_.getValue(FACING)) {
|
||||
case NORTH:
|
||||
return SHAPE_SOUTH;
|
||||
case SOUTH:
|
||||
return SHAPE_NORTH;
|
||||
case EAST:
|
||||
return SHAPE_WEST;
|
||||
case WEST:
|
||||
return SHAPE_EAST;
|
||||
default:
|
||||
return SHAPE_NORTH;
|
||||
}
|
||||
}
|
||||
|
||||
public VoxelShape getShape(BlockState p_54561_, BlockGetter p_54562_, BlockPos p_54563_, CollisionContext p_54564_) {
|
||||
switch((Direction)p_54561_.getValue(FACING)) {
|
||||
case NORTH:
|
||||
return SHAPE_SOUTH;
|
||||
case SOUTH:
|
||||
return SHAPE_NORTH;
|
||||
case EAST:
|
||||
return SHAPE_WEST;
|
||||
case WEST:
|
||||
return SHAPE_EAST;
|
||||
default:
|
||||
return SHAPE_NORTH;
|
||||
}
|
||||
}
|
||||
|
||||
public BlockState rotate(BlockState p_54540_, Rotation p_54541_) {
|
||||
return p_54540_.setValue(FACING, p_54541_.rotate(p_54540_.getValue(FACING)));
|
||||
}
|
||||
|
||||
public BlockState mirror(BlockState p_54537_, Mirror p_54538_) {
|
||||
return p_54537_.rotate(p_54538_.getRotation(p_54537_.getValue(FACING)));
|
||||
}
|
||||
|
||||
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> p_54543_) {
|
||||
p_54543_.add(FACING);
|
||||
}
|
||||
|
||||
|
||||
public boolean isPathfindable(BlockState p_54510_, BlockGetter p_54511_, BlockPos p_54512_, PathComputationType p_54513_) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
package com.drmangotea.tfmg.blocks.decoration;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
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.block.*;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.block.state.StateDefinition;
|
||||
import net.minecraft.world.level.block.state.properties.DirectionProperty;
|
||||
import net.minecraft.world.level.pathfinder.PathComputationType;
|
||||
import net.minecraft.world.phys.shapes.CollisionContext;
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
|
||||
public class RailingBlock extends Block {
|
||||
public static final DirectionProperty FACING = HorizontalDirectionalBlock.FACING;
|
||||
|
||||
public static final VoxelShape SHAPE_WEST = Block.box(0, 0, 0, 2, 16, 16);
|
||||
public static final VoxelShape SHAPE_NORTH = Block.box(0, 0, 0, 16, 16, 2);
|
||||
public static final VoxelShape SHAPE_EAST = Block.box(14, 0, 0, 16, 16, 16);
|
||||
public static final VoxelShape SHAPE_SOUTH = Block.box(0, 0, 14, 16, 16, 16);
|
||||
|
||||
|
||||
public RailingBlock(Properties p_54479_) {
|
||||
super(p_54479_);
|
||||
this.registerDefaultState(this.stateDefinition.any().setValue(FACING, Direction.NORTH));
|
||||
}
|
||||
|
||||
public RenderShape getRenderShape(BlockState p_54559_) {
|
||||
return RenderShape.MODEL;
|
||||
}
|
||||
|
||||
public VoxelShape getOcclusionShape(BlockState p_54584_, BlockGetter p_54585_, BlockPos p_54586_) {
|
||||
switch((Direction)p_54584_.getValue(FACING)) {
|
||||
case NORTH:
|
||||
return SHAPE_SOUTH;
|
||||
case SOUTH:
|
||||
return SHAPE_NORTH;
|
||||
case EAST:
|
||||
return SHAPE_WEST;
|
||||
case WEST:
|
||||
return SHAPE_EAST;
|
||||
default:
|
||||
return SHAPE_NORTH;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean useShapeForLightOcclusion(BlockState p_54582_) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public BlockState getStateForPlacement(BlockPlaceContext p_54481_) {
|
||||
Level level = p_54481_.getLevel();
|
||||
ItemStack itemstack = p_54481_.getItemInHand();
|
||||
Player player = p_54481_.getPlayer();
|
||||
boolean flag = false;
|
||||
if (!level.isClientSide && player != null && player.canUseGameMasterBlocks()) {
|
||||
CompoundTag compoundtag = BlockItem.getBlockEntityData(itemstack);
|
||||
if (compoundtag != null && compoundtag.contains("Book")) {
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
|
||||
return this.defaultBlockState().setValue(FACING, p_54481_.getHorizontalDirection().getOpposite());
|
||||
}
|
||||
|
||||
public VoxelShape getCollisionShape(BlockState p_54577_, BlockGetter p_54578_, BlockPos p_54579_, CollisionContext p_54580_) {
|
||||
switch((Direction)p_54577_.getValue(FACING)) {
|
||||
case NORTH:
|
||||
return SHAPE_SOUTH;
|
||||
case SOUTH:
|
||||
return SHAPE_NORTH;
|
||||
case EAST:
|
||||
return SHAPE_WEST;
|
||||
case WEST:
|
||||
return SHAPE_EAST;
|
||||
default:
|
||||
return SHAPE_NORTH;
|
||||
}
|
||||
}
|
||||
|
||||
public VoxelShape getShape(BlockState p_54561_, BlockGetter p_54562_, BlockPos p_54563_, CollisionContext p_54564_) {
|
||||
switch((Direction)p_54561_.getValue(FACING)) {
|
||||
case NORTH:
|
||||
return SHAPE_SOUTH;
|
||||
case SOUTH:
|
||||
return SHAPE_NORTH;
|
||||
case EAST:
|
||||
return SHAPE_WEST;
|
||||
case WEST:
|
||||
return SHAPE_EAST;
|
||||
default:
|
||||
return SHAPE_NORTH;
|
||||
}
|
||||
}
|
||||
|
||||
public BlockState rotate(BlockState p_54540_, Rotation p_54541_) {
|
||||
return p_54540_.setValue(FACING, p_54541_.rotate(p_54540_.getValue(FACING)));
|
||||
}
|
||||
|
||||
public BlockState mirror(BlockState p_54537_, Mirror p_54538_) {
|
||||
return p_54537_.rotate(p_54538_.getRotation(p_54537_.getValue(FACING)));
|
||||
}
|
||||
|
||||
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> p_54543_) {
|
||||
p_54543_.add(FACING);
|
||||
}
|
||||
|
||||
|
||||
public boolean isPathfindable(BlockState p_54510_, BlockGetter p_54511_, BlockPos p_54512_, PathComputationType p_54513_) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.drmangotea.tfmg.blocks.decoration;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.level.BlockGetter;
|
||||
import net.minecraft.world.level.block.FallingBlock;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
|
||||
public class TFMGGravityBlock extends FallingBlock {
|
||||
public TFMGGravityBlock(Properties p_53736_) {
|
||||
super(p_53736_);
|
||||
}
|
||||
|
||||
public int getDustColor(BlockState p_53738_, BlockGetter p_53739_, BlockPos p_53740_) {
|
||||
return -8356741;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package com.drmangotea.tfmg.blocks.decoration;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.item.context.BlockPlaceContext;
|
||||
import net.minecraft.world.level.LevelAccessor;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.Rotation;
|
||||
import net.minecraft.world.level.block.SimpleWaterloggedBlock;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.block.state.StateDefinition;
|
||||
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
|
||||
import net.minecraft.world.level.block.state.properties.BooleanProperty;
|
||||
import net.minecraft.world.level.block.state.properties.EnumProperty;
|
||||
import net.minecraft.world.level.material.FluidState;
|
||||
import net.minecraft.world.level.material.Fluids;
|
||||
|
||||
public class TrussBlock extends Block implements SimpleWaterloggedBlock {
|
||||
public static final EnumProperty<Direction.Axis> AXIS = BlockStateProperties.AXIS;
|
||||
public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED;
|
||||
public TrussBlock(Properties p_55926_) {
|
||||
super(p_55926_);
|
||||
this.registerDefaultState(this.defaultBlockState().setValue(AXIS, Direction.Axis.Y).setValue(WATERLOGGED, Boolean.valueOf(false)));
|
||||
}
|
||||
public BlockState rotate(BlockState p_55930_, Rotation p_55931_) {
|
||||
return rotatePillar(p_55930_, p_55931_);
|
||||
}
|
||||
|
||||
public static BlockState rotatePillar(BlockState p_154377_, Rotation p_154378_) {
|
||||
switch(p_154378_) {
|
||||
case COUNTERCLOCKWISE_90:
|
||||
case CLOCKWISE_90:
|
||||
switch((Direction.Axis)p_154377_.getValue(AXIS)) {
|
||||
case X:
|
||||
return p_154377_.setValue(AXIS, Direction.Axis.Z);
|
||||
case Z:
|
||||
return p_154377_.setValue(AXIS, Direction.Axis.X);
|
||||
default:
|
||||
return p_154377_;
|
||||
}
|
||||
default:
|
||||
return p_154377_;
|
||||
}
|
||||
}
|
||||
|
||||
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> p_55933_) {
|
||||
p_55933_.add(AXIS, WATERLOGGED);
|
||||
}
|
||||
public BlockState updateShape(BlockState p_56381_, Direction p_56382_, BlockState p_56383_, LevelAccessor p_56384_, BlockPos p_56385_, BlockPos p_56386_) {
|
||||
if (p_56381_.getValue(WATERLOGGED)) {
|
||||
p_56384_.scheduleTick(p_56385_, Fluids.WATER, Fluids.WATER.getTickDelay(p_56384_));
|
||||
}
|
||||
|
||||
return super.updateShape(p_56381_, p_56382_, p_56383_, p_56384_, p_56385_, p_56386_);
|
||||
}
|
||||
public FluidState getFluidState(BlockState p_56397_) {
|
||||
return p_56397_.getValue(WATERLOGGED) ? Fluids.WATER.getSource(false) : super.getFluidState(p_56397_);
|
||||
}
|
||||
|
||||
public BlockState getStateForPlacement(BlockPlaceContext p_55928_) {
|
||||
return this.defaultBlockState().setValue(AXIS, p_55928_.getClickedFace().getAxis());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,220 @@
|
||||
package com.drmangotea.tfmg.blocks.engines.diesel;
|
||||
|
||||
|
||||
import com.drmangotea.tfmg.registry.TFMGBlockEntities;
|
||||
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.placement.IPlacementHelper;
|
||||
import com.simibubi.create.foundation.placement.PlacementHelpers;
|
||||
import com.simibubi.create.foundation.placement.PlacementOffset;
|
||||
import com.simibubi.create.foundation.utility.BlockHelper;
|
||||
import com.simibubi.create.foundation.utility.Couple;
|
||||
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 DieselEngineBlock extends HorizontalDirectionalBlock
|
||||
implements IWrenchable, IBE<DieselEngineBlockEntity> {
|
||||
public static final EnumProperty<AttachFace> FACE = BlockStateProperties.ATTACH_FACE;
|
||||
|
||||
private static final int placementHelperId = PlacementHelpers.register(new PlacementHelper());
|
||||
|
||||
public DieselEngineBlock(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 pState, BlockGetter pLevel, BlockPos pPos, CollisionContext pContext) {
|
||||
AttachFace face = pState.getValue(FACE);
|
||||
Direction direction = pState.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<DieselEngineBlockEntity> getBlockEntityClass() {
|
||||
return DieselEngineBlockEntity.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockEntityType<? extends DieselEngineBlockEntity> getBlockEntityType() {
|
||||
return TFMGBlockEntities.DIESEL_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 DieselEngineBlock;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PlacementOffset getOffset(Player player, Level world, BlockState state, BlockPos pos,
|
||||
BlockHitResult ray) {
|
||||
BlockPos shaftPos =DieselEngineBlock.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.getMaterial().isReplaceable())
|
||||
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,545 @@
|
||||
package com.drmangotea.tfmg.blocks.engines.diesel;
|
||||
|
||||
|
||||
import com.drmangotea.tfmg.registry.TFMGBlocks;
|
||||
import com.drmangotea.tfmg.registry.TFMGFluids;
|
||||
import com.simibubi.create.content.contraptions.bearing.WindmillBearingBlockEntity;
|
||||
import com.simibubi.create.content.equipment.goggles.IHaveGoggleInformation;
|
||||
import com.simibubi.create.content.kinetics.base.GeneratingKineticBlockEntity;
|
||||
import com.simibubi.create.content.kinetics.base.IRotate;
|
||||
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.SteamEngineValueBox;
|
||||
import com.simibubi.create.foundation.blockEntity.SmartBlockEntity;
|
||||
import com.simibubi.create.foundation.blockEntity.behaviour.BlockEntityBehaviour;
|
||||
import com.simibubi.create.foundation.blockEntity.behaviour.fluid.SmartFluidTankBehaviour;
|
||||
import com.simibubi.create.foundation.blockEntity.behaviour.scrollValue.ScrollOptionBehaviour;
|
||||
import com.simibubi.create.foundation.fluid.CombinedTankWrapper;
|
||||
import com.simibubi.create.foundation.utility.*;
|
||||
import net.minecraft.ChatFormatting;
|
||||
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.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.phys.AABB;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.util.LazyOptional;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
|
||||
import net.minecraftforge.fluids.capability.IFluidHandler;
|
||||
import net.minecraftforge.fml.DistExecutor;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
public class DieselEngineBlockEntity extends SmartBlockEntity implements IHaveGoggleInformation {
|
||||
|
||||
protected ScrollOptionBehaviour<WindmillBearingBlockEntity.RotationDirection> movementDirection;
|
||||
|
||||
public WeakReference<PoweredShaftBlockEntity> target;
|
||||
///////////
|
||||
|
||||
public SmartFluidTankBehaviour inputTank;
|
||||
protected SmartFluidTankBehaviour exhaustTank;
|
||||
private boolean contentsChanged;
|
||||
private int consumptionTimer=0;
|
||||
public float engineStrength = 0;
|
||||
private Couple<SmartFluidTankBehaviour> tanks;
|
||||
|
||||
public boolean connectionVerticalX=false;
|
||||
public boolean connectionVerticalZ=false;
|
||||
|
||||
public boolean connectionX=false;
|
||||
public boolean connectionX2=false;
|
||||
|
||||
public boolean connectionZ=false;
|
||||
public boolean connectionZ2=false;
|
||||
|
||||
protected LazyOptional<IFluidHandler> fluidCapability;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
List<IntAttached<FluidStack>> visualizedOutputFluids;
|
||||
|
||||
public DieselEngineBlockEntity(BlockEntityType<?> type, BlockPos pos, BlockState state) {
|
||||
super(type, pos, state);
|
||||
target = new WeakReference<>(null);
|
||||
|
||||
/////////
|
||||
|
||||
|
||||
|
||||
contentsChanged = true;
|
||||
|
||||
|
||||
|
||||
tanks = Couple.create(inputTank, exhaustTank);
|
||||
tanks.get(true).forbidExtraction();
|
||||
tanks.get(false).forbidInsertion();
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addBehaviours(List<BlockEntityBehaviour> behaviours) {
|
||||
//movementDirection = new ScrollOptionBehaviour<>(WindmillBearingBlockEntity.RotationDirection.class,
|
||||
// Lang.translateDirect("contraptions.windmill.rotation_direction"), this, new DieselEngineValueBox());
|
||||
movementDirection = new ScrollOptionBehaviour<>(WindmillBearingBlockEntity.RotationDirection.class,
|
||||
Lang.translateDirect("contraptions.windmill.rotation_direction"), this, new SteamEngineValueBox());
|
||||
movementDirection.onlyActiveWhen(() -> {
|
||||
PoweredShaftBlockEntity shaft = getShaft();
|
||||
return shaft == null || !shaft.hasSource();
|
||||
});
|
||||
movementDirection.withCallback($ -> onDirectionChanged());
|
||||
behaviours.add(movementDirection);
|
||||
////////////////////////////////////////////
|
||||
behaviours.add(new DirectBeltInputBehaviour(this));
|
||||
|
||||
|
||||
|
||||
inputTank = new SmartFluidTankBehaviour(SmartFluidTankBehaviour.INPUT, this, 1, 1000, true)
|
||||
.whenFluidUpdates(() -> contentsChanged = true);
|
||||
|
||||
exhaustTank = new SmartFluidTankBehaviour(SmartFluidTankBehaviour.OUTPUT, this, 1, 1000, true)
|
||||
.whenFluidUpdates(() -> contentsChanged = true)
|
||||
.forbidInsertion();
|
||||
behaviours.add(inputTank);
|
||||
behaviours.add(exhaustTank);
|
||||
|
||||
fluidCapability = LazyOptional.of(() -> {
|
||||
LazyOptional<? extends IFluidHandler> inputCap = inputTank.getCapability();
|
||||
LazyOptional<? extends IFluidHandler> outputCap = exhaustTank.getCapability();
|
||||
return new CombinedTankWrapper(outputCap.orElse(null), inputCap.orElse(null));
|
||||
});
|
||||
}
|
||||
|
||||
private void onDirectionChanged() {}
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
super.tick();
|
||||
|
||||
|
||||
spawnConnections();
|
||||
|
||||
|
||||
|
||||
if(!level.isClientSide()){
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
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 = DieselEngineBlock.getFacing(getBlockState());
|
||||
if (level.isLoaded(worldPosition.relative(facing.getOpposite())))
|
||||
shaft.update(worldPosition, 0, 0);
|
||||
return;
|
||||
}
|
||||
engineProcess();
|
||||
boolean verticalTarget = false;
|
||||
BlockState shaftState = shaft.getBlockState();
|
||||
Axis targetAxis = Axis.X;
|
||||
if (shaftState.getBlock()instanceof IRotate ir)
|
||||
targetAxis = ir.getRotationAxis(shaftState);
|
||||
verticalTarget = targetAxis == Axis.Y;
|
||||
|
||||
BlockState blockState = getBlockState();
|
||||
if (!TFMGBlocks.DIESEL_ENGINE.has(blockState))
|
||||
return;
|
||||
Direction facing = DieselEngineBlock.getFacing(blockState);
|
||||
if (facing.getAxis() == Axis.Y)
|
||||
facing = blockState.getValue(DieselEngineBlock.FACING);
|
||||
|
||||
|
||||
//if (engineStrength > 0)
|
||||
|
||||
// award(AllAdvancements.STEAM_ENGINE);
|
||||
|
||||
int conveyedSpeedLevel =
|
||||
engineStrength == 0 ? 1 : verticalTarget ? 1 : (int) GeneratingKineticBlockEntity.convertToDirection(1, facing)*2;
|
||||
if (targetAxis == Axis.Z)
|
||||
conveyedSpeedLevel *= -1;
|
||||
if (movementDirection.get() == WindmillBearingBlockEntity.RotationDirection.COUNTER_CLOCKWISE)
|
||||
conveyedSpeedLevel *= -1;
|
||||
|
||||
float shaftSpeed = shaft.getTheoreticalSpeed();
|
||||
if (shaft.hasSource() && shaftSpeed != 0 && conveyedSpeedLevel != 0
|
||||
&& (shaftSpeed > 0) != (conveyedSpeedLevel > 0)) {
|
||||
movementDirection.setValue(1 - movementDirection.get()
|
||||
.ordinal());
|
||||
conveyedSpeedLevel *= -1;
|
||||
}
|
||||
|
||||
shaft.update(worldPosition, conveyedSpeedLevel, engineStrength);
|
||||
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> this::makeSound);
|
||||
}
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
private void makeSound(){
|
||||
Float targetAngle = getTargetAngle();
|
||||
PoweredShaftBlockEntity ste = target.get();
|
||||
if (ste == null)
|
||||
return;
|
||||
if (!ste.isPoweredBy(worldPosition) || ste.engineEfficiency == 0)
|
||||
return;
|
||||
if (targetAngle == null)
|
||||
return;
|
||||
|
||||
float angle = AngleHelper.deg(targetAngle);
|
||||
angle += (angle < 0) ? -180 + 75 : 360 - 75;
|
||||
angle %= 360;
|
||||
|
||||
PoweredShaftBlockEntity shaft = getShaft();
|
||||
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;
|
||||
}
|
||||
|
||||
float pitch = 1.18f - level.random.nextFloat() * .25f;
|
||||
//CISoundEvents.DIESEL_ENGINE_SOUNDS.playAt(level, worldPosition, 0.3f, .2f, false);
|
||||
|
||||
prevAngle = angle;
|
||||
}
|
||||
|
||||
private void spawnConnections(){
|
||||
if(((DieselEngineBlock)this.getBlockState().getBlock()).getConnectedDirection(this.getBlockState()) == Direction.UP||
|
||||
((DieselEngineBlock)this.getBlockState().getBlock()).getConnectedDirection(this.getBlockState()) == Direction.DOWN){
|
||||
|
||||
if(
|
||||
level.getBlockState(this.getBlockPos().north()).is(TFMGBlocks.DIESEL_ENGINE.get())||
|
||||
level.getBlockState(this.getBlockPos().south()).is(TFMGBlocks.DIESEL_ENGINE.get())
|
||||
){
|
||||
connectionVerticalZ=true;
|
||||
} else connectionVerticalZ=false;
|
||||
if(
|
||||
level.getBlockState(this.getBlockPos().west()).is(TFMGBlocks.DIESEL_ENGINE.get())||
|
||||
level.getBlockState(this.getBlockPos().east()).is(TFMGBlocks.DIESEL_ENGINE.get())
|
||||
){
|
||||
connectionVerticalX=true;
|
||||
} else connectionVerticalX=false;
|
||||
|
||||
|
||||
|
||||
}
|
||||
if(((DieselEngineBlock)this.getBlockState().getBlock()).getConnectedDirection(this.getBlockState()) == Direction.WEST||
|
||||
((DieselEngineBlock)this.getBlockState().getBlock()).getConnectedDirection(this.getBlockState()) == Direction.EAST){
|
||||
|
||||
if(
|
||||
level.getBlockState(this.getBlockPos().north()).is(TFMGBlocks.DIESEL_ENGINE.get())||
|
||||
level.getBlockState(this.getBlockPos().south()).is(TFMGBlocks.DIESEL_ENGINE.get())
|
||||
){
|
||||
connectionZ=true;
|
||||
} else connectionZ=false;
|
||||
if(
|
||||
level.getBlockState(this.getBlockPos().above()).is(TFMGBlocks.DIESEL_ENGINE.get())||
|
||||
level.getBlockState(this.getBlockPos().below()).is(TFMGBlocks.DIESEL_ENGINE.get())
|
||||
){
|
||||
connectionZ2=true;
|
||||
} else connectionZ2=false;
|
||||
|
||||
|
||||
|
||||
}
|
||||
if(((DieselEngineBlock)this.getBlockState().getBlock()).getConnectedDirection(this.getBlockState()) == Direction.NORTH||
|
||||
((DieselEngineBlock)this.getBlockState().getBlock()).getConnectedDirection(this.getBlockState()) == Direction.SOUTH){
|
||||
|
||||
if(
|
||||
level.getBlockState(this.getBlockPos().west()).is(TFMGBlocks.DIESEL_ENGINE.get())||
|
||||
level.getBlockState(this.getBlockPos().east()).is(TFMGBlocks.DIESEL_ENGINE.get())
|
||||
){
|
||||
connectionX=true;
|
||||
} else connectionX=false;
|
||||
if(
|
||||
level.getBlockState(this.getBlockPos().above()).is(TFMGBlocks.DIESEL_ENGINE.get())||
|
||||
level.getBlockState(this.getBlockPos().below()).is(TFMGBlocks.DIESEL_ENGINE.get())
|
||||
){
|
||||
connectionX2=true;
|
||||
} else connectionX2=false;
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void engineProcess() {
|
||||
if(tanks.get(true).getPrimaryHandler().isEmpty()||tanks.get(true).getPrimaryHandler().isEmpty()) {
|
||||
engineStrength=0;
|
||||
return;
|
||||
}
|
||||
if(tanks.get(false).getPrimaryHandler().getFluidAmount()+5>1000) {
|
||||
engineStrength = 0;
|
||||
return;
|
||||
}
|
||||
if(tanks.get(true).getPrimaryHandler().getFluid().getFluid().isSame(TFMGFluids.DIESEL.getSource())) {
|
||||
|
||||
|
||||
|
||||
if(consumptionTimer>=3) {
|
||||
//if(signal!=0)
|
||||
tanks.get(true).getPrimaryHandler().drain(3, IFluidHandler.FluidAction.EXECUTE);
|
||||
tanks.get(false) .getPrimaryHandler().setFluid(new FluidStack(TFMGFluids.CARBON_DIOXIDE.getSource(), tanks.get(false).getPrimaryHandler().getFluidAmount()+1));
|
||||
consumptionTimer=0;
|
||||
}
|
||||
consumptionTimer++;
|
||||
|
||||
engineStrength=40;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@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 = DieselEngineBlock.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.DIESEL_ENGINE.has(blockState))
|
||||
return null;
|
||||
|
||||
Direction facing = DieselEngineBlock.getFacing(blockState);
|
||||
PoweredShaftBlockEntity shaft = getShaft();
|
||||
Axis facingAxis = facing.getAxis();
|
||||
Axis axis = Axis.Y;
|
||||
|
||||
if (shaft == null)
|
||||
return null;
|
||||
|
||||
axis = KineticBlockEntityRenderer.getRotationAxisOf(shaft);
|
||||
angle = KineticBlockEntityRenderer.getAngleForTe(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 boolean addToGoggleTooltip(List<Component> tooltip, boolean isPlayerSneaking) {
|
||||
PoweredShaftBlockEntity shaft = getShaft();
|
||||
return shaft == null ? false : shaft.addToEngineTooltip(tooltip, isPlayerSneaking);
|
||||
}
|
||||
|
||||
*/
|
||||
////////////////////////////////////
|
||||
|
||||
@Override
|
||||
protected void read(CompoundTag compound, boolean clientPacket) {
|
||||
super.read(compound, clientPacket);
|
||||
|
||||
|
||||
if (!clientPacket)
|
||||
return;
|
||||
// tanks.get(true).getPrimaryHandler().readFromNBT(compound.getCompound("Fuel"));
|
||||
// tanks.get(true).getPrimaryHandler().readFromNBT(compound.getCompound("Exhaust"));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(CompoundTag compound, boolean clientPacket) {
|
||||
super.write(compound, clientPacket);
|
||||
|
||||
|
||||
|
||||
if (!clientPacket)
|
||||
return;
|
||||
// compound.put("Fuel", tanks.get(true).getPrimaryHandler().writeToNBT(new CompoundTag()));
|
||||
// compound.put("Exhaust", tanks.get(false).getPrimaryHandler().writeToNBT(new CompoundTag()));
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void invalidate() {
|
||||
super.invalidate();
|
||||
|
||||
fluidCapability.invalidate();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public <T> LazyOptional<T> getCapability(@Nonnull Capability<T> cap, Direction side) {
|
||||
|
||||
if (cap == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY)
|
||||
return fluidCapability.cast();
|
||||
return super.getCapability(cap, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifyUpdate() {
|
||||
super.notifyUpdate();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public Couple<SmartFluidTankBehaviour> getTanks() {
|
||||
return tanks;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public boolean addToGoggleTooltip(List<Component> tooltip, boolean isPlayerSneaking) {
|
||||
|
||||
|
||||
|
||||
//--Fluid Info--//
|
||||
LazyOptional<IFluidHandler> handler = this.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY);
|
||||
Optional<IFluidHandler> resolve = handler.resolve();
|
||||
if (!resolve.isPresent())
|
||||
return false;
|
||||
|
||||
IFluidHandler tank = resolve.get();
|
||||
if (tank.getTanks() == 0)
|
||||
return false;
|
||||
|
||||
LangBuilder mb = Lang.translate("generic.unit.millibuckets");
|
||||
Lang.translate("goggles.diesel_engine_info")
|
||||
.style(ChatFormatting.GRAY)
|
||||
.forGoggles(tooltip);
|
||||
|
||||
boolean isEmpty = true;
|
||||
for (int i = 0; i < tank.getTanks(); i++) {
|
||||
FluidStack fluidStack = tank.getFluidInTank(i);
|
||||
if (fluidStack.isEmpty())
|
||||
continue;
|
||||
|
||||
Lang.fluidName(fluidStack)
|
||||
.style(ChatFormatting.GRAY)
|
||||
.forGoggles(tooltip, 1);
|
||||
|
||||
Lang.builder()
|
||||
.add(Lang.number(fluidStack.getAmount())
|
||||
.add(mb)
|
||||
.style(ChatFormatting.DARK_GREEN))
|
||||
.text(ChatFormatting.GRAY, " / ")
|
||||
.add(Lang.number(tank.getTankCapacity(i))
|
||||
.add(mb)
|
||||
.style(ChatFormatting.DARK_GRAY))
|
||||
.forGoggles(tooltip, 1);
|
||||
|
||||
isEmpty = false;
|
||||
}
|
||||
|
||||
if (tank.getTanks() > 1) {
|
||||
if (isEmpty)
|
||||
tooltip.remove(tooltip.size() - 1);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!isEmpty)
|
||||
return true;
|
||||
|
||||
Lang.translate("gui.goggles.fluid_container.capacity")
|
||||
.add(Lang.number(tank.getTankCapacity(0))
|
||||
.add(mb)
|
||||
.style(ChatFormatting.DARK_GREEN))
|
||||
.style(ChatFormatting.DARK_GRAY)
|
||||
.forGoggles(tooltip, 1);
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
class BasinValueBox extends ValueBoxTransform.Sided {
|
||||
|
||||
@Override
|
||||
protected Vec3 getSouthLocation() {
|
||||
return VecHelper.voxelSpace(8, 12, 15.75);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isSideActive(BlockState state, Direction direction) {
|
||||
return direction.getAxis()
|
||||
.isHorizontal();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
}
|
||||
@@ -0,0 +1,145 @@
|
||||
package com.drmangotea.tfmg.blocks.engines.diesel;
|
||||
|
||||
|
||||
import com.drmangotea.tfmg.registry.TFMGPartialModels;
|
||||
import com.jozufozu.flywheel.api.MaterialManager;
|
||||
import com.jozufozu.flywheel.api.instance.DynamicInstance;
|
||||
import com.jozufozu.flywheel.backend.instancing.blockentity.BlockEntityInstance;
|
||||
import com.jozufozu.flywheel.core.Materials;
|
||||
import com.jozufozu.flywheel.core.materials.model.ModelData;
|
||||
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.utility.AngleHelper;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.Direction.Axis;
|
||||
import net.minecraft.util.Mth;
|
||||
|
||||
public class DieselEngineInstance extends BlockEntityInstance<DieselEngineBlockEntity> implements DynamicInstance {
|
||||
|
||||
protected final ModelData piston;
|
||||
protected final ModelData linkage;
|
||||
protected final ModelData connector;
|
||||
//protected final ModelData connection;
|
||||
|
||||
public DieselEngineInstance(MaterialManager materialManager, DieselEngineBlockEntity blockEntity) {
|
||||
super(materialManager, blockEntity);
|
||||
|
||||
piston = materialManager.defaultSolid()
|
||||
.material(Materials.TRANSFORMED)
|
||||
.getModel(AllPartialModels.ENGINE_PISTON, blockState)
|
||||
.createInstance();
|
||||
linkage = materialManager.defaultSolid()
|
||||
.material(Materials.TRANSFORMED)
|
||||
.getModel(AllPartialModels.ENGINE_LINKAGE, blockState)
|
||||
.createInstance();
|
||||
connector = materialManager.defaultSolid()
|
||||
.material(Materials.TRANSFORMED)
|
||||
.getModel(AllPartialModels.ENGINE_CONNECTOR, blockState)
|
||||
.createInstance();
|
||||
//connection = materialManager.defaultSolid()
|
||||
// .material(Materials.TRANSFORMED)
|
||||
// .getModel(TFMGPartialModels.DIESEL_ENGINE_CONNECTION, blockState)
|
||||
// .createInstance();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beginFrame() {
|
||||
Float angle = blockEntity.getTargetAngle();
|
||||
if (angle == null) {
|
||||
piston.setEmptyTransform();
|
||||
linkage.setEmptyTransform();
|
||||
connector.setEmptyTransform();
|
||||
//connection.setEmptyTransform();
|
||||
return;
|
||||
}
|
||||
|
||||
Direction facing = DieselEngineBlock.getFacing(blockState);
|
||||
Axis facingAxis = facing.getAxis();
|
||||
Axis axis = Axis.Y;
|
||||
|
||||
PoweredShaftBlockEntity shaft = blockEntity.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;
|
||||
|
||||
|
||||
transformed(this.piston, facing, roll90)
|
||||
.translate(0, piston, 0);
|
||||
|
||||
|
||||
transformed(linkage, facing, roll90)
|
||||
.centre()
|
||||
.translate(0, 1, 0)
|
||||
.unCentre()
|
||||
.translate(0, piston, 0)
|
||||
.translate(0, 4 / 16f, 8 / 16f)
|
||||
.rotateX(sine2 * 23f)
|
||||
.translate(0, -4 / 16f, -8 / 16f);
|
||||
|
||||
transformed(connector, facing, roll90)
|
||||
.translate(0, 2, 0)
|
||||
.centre()
|
||||
.rotateXRadians(-angle + Mth.HALF_PI)
|
||||
.unCentre();
|
||||
|
||||
// if(blockEntity.connectionVerticalX)
|
||||
// transformed(this.connection, facing, roll90)
|
||||
// .rotateY(90)
|
||||
// .translate(-1, 0, 0);
|
||||
//
|
||||
// if(blockEntity.connectionVerticalZ)
|
||||
// transformed(this.connection, facing, roll90)
|
||||
// .rotateY(90)
|
||||
// .translate(-1, 0, 0);
|
||||
//
|
||||
// if(blockEntity.connectionX)
|
||||
// transformed(this.connection, facing, roll90)
|
||||
// .rotateY(90)
|
||||
// .translate(-1, 0, 0);
|
||||
// if(blockEntity.connectionX2)
|
||||
// transformed(this.connection, facing, roll90)
|
||||
// .rotateY(90)
|
||||
// .translate(-1, 0,0 );
|
||||
//
|
||||
// if(blockEntity.connectionZ)
|
||||
// transformed(this.connection, facing, roll90)
|
||||
// .rotateY(90)
|
||||
// .translate(-1, 0, 0);
|
||||
// if(blockEntity.connectionZ2)
|
||||
// transformed(this.connection, facing, roll90)
|
||||
// .rotateY(90)
|
||||
// .translate(-1, 0, 0);
|
||||
|
||||
|
||||
}
|
||||
|
||||
protected ModelData transformed(ModelData modelData, Direction facing, boolean roll90) {
|
||||
return modelData.loadIdentity()
|
||||
.translate(getInstancePosition())
|
||||
.centre()
|
||||
.rotateY(AngleHelper.horizontalAngle(facing))
|
||||
.rotateX(AngleHelper.verticalAngle(facing) + 90)
|
||||
.rotateY(roll90 ? -90 : 0)
|
||||
.unCentre();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateLight() {
|
||||
relight(pos, piston, linkage, connector);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void remove() {
|
||||
piston.delete();
|
||||
linkage.delete();
|
||||
connector.delete();
|
||||
//connection.delete();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
package com.drmangotea.tfmg.blocks.engines.diesel;
|
||||
|
||||
|
||||
import com.jozufozu.flywheel.backend.Backend;
|
||||
import com.jozufozu.flywheel.core.PartialModel;
|
||||
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 com.simibubi.create.foundation.render.CachedBufferer;
|
||||
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
||||
import com.simibubi.create.foundation.utility.AngleHelper;
|
||||
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 DieselEngineRenderer extends SafeBlockEntityRenderer<DieselEngineBlockEntity> {
|
||||
|
||||
public DieselEngineRenderer(BlockEntityRendererProvider.Context context) {}
|
||||
|
||||
@Override
|
||||
protected void renderSafe(DieselEngineBlockEntity te, float partialTicks, PoseStack ms, MultiBufferSource buffer,
|
||||
int light, int overlay) {
|
||||
if (Backend.canUseInstancing(te.getLevel()))
|
||||
return;
|
||||
|
||||
Float angle = te.getTargetAngle();
|
||||
if (angle == null)
|
||||
return;
|
||||
|
||||
BlockState blockState = te.getBlockState();
|
||||
Direction facing = DieselEngineBlock.getFacing(blockState);
|
||||
Axis facingAxis = facing.getAxis();
|
||||
Axis axis = Axis.Y;
|
||||
|
||||
PoweredShaftBlockEntity shaft = te.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(AllPartialModels.ENGINE_PISTON, blockState, facing, roll90)
|
||||
.translate(0, piston, 0)
|
||||
.light(light)
|
||||
.renderInto(ms, vb);
|
||||
|
||||
|
||||
transformed(AllPartialModels.ENGINE_LINKAGE, blockState, facing, roll90)
|
||||
.centre()
|
||||
.translate(0, 1, 0)
|
||||
.unCentre()
|
||||
.translate(0, piston, 0)
|
||||
.translate(0, 4 / 16f, 8 / 16f)
|
||||
.rotateX(sine2 * 23f)
|
||||
.translate(0, -4 / 16f, -8 / 16f)
|
||||
.light(light)
|
||||
.renderInto(ms, vb);
|
||||
|
||||
transformed(AllPartialModels.ENGINE_CONNECTOR, blockState, facing, roll90)
|
||||
.translate(0, 2, 0)
|
||||
.centre()
|
||||
.rotateXRadians(-angle + Mth.HALF_PI)
|
||||
.unCentre()
|
||||
.light(light)
|
||||
.renderInto(ms, vb);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
private SuperByteBuffer transformed(PartialModel model, BlockState blockState, Direction facing, boolean roll90) {
|
||||
return CachedBufferer.partial(model, blockState)
|
||||
.centre()
|
||||
.rotateY(AngleHelper.horizontalAngle(facing))
|
||||
.rotateX(AngleHelper.verticalAngle(facing) + 90)
|
||||
.rotateY(roll90 ? -90 : 0)
|
||||
.unCentre();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getViewDistance() {
|
||||
return 128;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
package com.drmangotea.tfmg.blocks.engines.diesel;
|
||||
|
||||
|
||||
import com.jozufozu.flywheel.util.transform.TransformStack;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.simibubi.create.foundation.blockEntity.behaviour.ValueBoxTransform;
|
||||
import com.simibubi.create.foundation.utility.AngleHelper;
|
||||
import com.simibubi.create.foundation.utility.Pointing;
|
||||
import com.simibubi.create.foundation.utility.VecHelper;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.Direction.Axis;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
|
||||
public class DieselEngineValueBox extends ValueBoxTransform.Sided {
|
||||
|
||||
@Override
|
||||
protected boolean isSideActive(BlockState state, Direction direction) {
|
||||
return DieselEngineBlock.getFacing(state)
|
||||
.getAxis() != direction.getAxis();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vec3 getLocalOffset(BlockState state) {
|
||||
Direction side = getSide();
|
||||
Direction engineFacing = DieselEngineBlock.getFacing(state);
|
||||
|
||||
float roll = 0;
|
||||
for (Pointing p : Pointing.values()) {
|
||||
if (p.getCombinedDirection(engineFacing) == side)
|
||||
roll = p.getXRotation();
|
||||
}
|
||||
if (engineFacing == Direction.UP)
|
||||
roll += 180;
|
||||
|
||||
float horizontalAngle = AngleHelper.horizontalAngle(engineFacing);
|
||||
float verticalAngle = AngleHelper.verticalAngle(engineFacing);
|
||||
|
||||
boolean recessed = roll % 180 == 0;
|
||||
if (engineFacing.getAxis() == Axis.Y)
|
||||
recessed ^= state.getValue(DieselEngineBlock.FACING).getAxis() == Axis.X;
|
||||
|
||||
Vec3 local = VecHelper.voxelSpace(8, recessed ? 13 : 15, 9);
|
||||
|
||||
local = VecHelper.rotateCentered(local, roll, Axis.Z);
|
||||
local = VecHelper.rotateCentered(local, horizontalAngle, Axis.Y);
|
||||
local = VecHelper.rotateCentered(local, verticalAngle, Axis.X);
|
||||
|
||||
return local;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void rotate(BlockState state, PoseStack ms) {
|
||||
Direction facing = DieselEngineBlock.getFacing(state);
|
||||
|
||||
if (facing.getAxis() == Axis.Y) {
|
||||
super.rotate(state, ms);
|
||||
return;
|
||||
}
|
||||
|
||||
float roll = 0;
|
||||
for (Pointing p : Pointing.values()) {
|
||||
if (p.getCombinedDirection(facing) == getSide())
|
||||
roll = p.getXRotation();
|
||||
}
|
||||
|
||||
float yRot = AngleHelper.horizontalAngle(facing) + (facing == Direction.DOWN ? 180 : 0);
|
||||
TransformStack.cast(ms)
|
||||
.rotateY(yRot)
|
||||
.rotateX(facing == Direction.DOWN ? -90 : 90)
|
||||
.rotateY(roll);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Vec3 getSouthLocation() {
|
||||
return Vec3.ZERO;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
package com.drmangotea.tfmg.blocks.engines.intake;
|
||||
|
||||
import com.drmangotea.tfmg.CreateTFMG;
|
||||
import com.drmangotea.tfmg.registry.TFMGBlockEntities;
|
||||
import com.simibubi.create.content.equipment.wrench.IWrenchable;
|
||||
import com.simibubi.create.content.kinetics.base.DirectionalKineticBlock;
|
||||
import com.simibubi.create.content.kinetics.base.KineticBlock;
|
||||
import com.simibubi.create.content.kinetics.base.KineticBlockEntity;
|
||||
import com.simibubi.create.foundation.block.IBE;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
import net.minecraft.world.item.context.UseOnContext;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.LevelReader;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.RenderShape;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.block.state.StateDefinition;
|
||||
import net.minecraft.world.level.block.state.properties.BooleanProperty;
|
||||
|
||||
public class AirIntakeBlock extends DirectionalKineticBlock implements IBE<AirIntakeBlockEntity>, IWrenchable {
|
||||
|
||||
public static final BooleanProperty INVISIBLE = BooleanProperty.create("invisible");
|
||||
|
||||
public AirIntakeBlock(Properties properties) {
|
||||
super(properties);
|
||||
this.registerDefaultState(this.stateDefinition.any().setValue(INVISIBLE, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Direction.Axis getRotationAxis(BlockState state) {
|
||||
return state.getValue(FACING).getAxis();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean hasShaftTowards(LevelReader world, BlockPos pos, BlockState state, Direction face) {
|
||||
AirIntakeBlockEntity be = (AirIntakeBlockEntity) world.getBlockEntity(pos);
|
||||
|
||||
if(be.hasShaft) {
|
||||
return face == state.getValue(FACING).getOpposite();
|
||||
}else return false;
|
||||
}
|
||||
public InteractionResult onWrenched(BlockState state, UseOnContext context) {
|
||||
|
||||
Direction direction = context.getClickedFace();
|
||||
Level level = context.getLevel();
|
||||
AirIntakeBlockEntity be = (AirIntakeBlockEntity) level.getBlockEntity(context.getClickedPos());
|
||||
|
||||
if(direction == state.getValue(FACING).getOpposite()) {
|
||||
((AirIntakeBlockEntity) level.getBlockEntity(context.getClickedPos())).hasShaft = !be.hasShaft;
|
||||
//////////
|
||||
BlockPos pos = context.getClickedPos();
|
||||
|
||||
playRotateSound(level,pos);
|
||||
|
||||
AirIntakeBlockEntity kineticBlockEntity = (AirIntakeBlockEntity) level.getBlockEntity(pos);
|
||||
if(!kineticBlockEntity.hasShaft) {
|
||||
if (kineticBlockEntity.hasNetwork())
|
||||
kineticBlockEntity.getOrCreateNetwork()
|
||||
.remove(kineticBlockEntity);
|
||||
kineticBlockEntity.detachKinetics();
|
||||
kineticBlockEntity.removeSource();
|
||||
kineticBlockEntity.setSpeed(0);
|
||||
kineticBlockEntity.remove();
|
||||
kineticBlockEntity.notifyUpdate();
|
||||
} else{
|
||||
kineticBlockEntity.attachKinetics();
|
||||
kineticBlockEntity.notifyUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
return super.onWrenched(state,context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<AirIntakeBlockEntity> getBlockEntityClass() {
|
||||
return AirIntakeBlockEntity.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockEntityType<? extends AirIntakeBlockEntity> getBlockEntityType() {
|
||||
return TFMGBlockEntities.AIR_INTAKE.get();
|
||||
}
|
||||
@Override
|
||||
public RenderShape getRenderShape(BlockState pState) {
|
||||
return RenderShape.MODEL;
|
||||
}
|
||||
|
||||
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> p_55125_) {
|
||||
p_55125_.add(FACING, INVISIBLE);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,564 @@
|
||||
package com.drmangotea.tfmg.blocks.engines.intake;
|
||||
|
||||
import com.drmangotea.tfmg.registry.TFMGBlocks;
|
||||
import com.drmangotea.tfmg.registry.TFMGFluids;
|
||||
import com.simibubi.create.content.equipment.wrench.IWrenchable;
|
||||
import com.simibubi.create.content.kinetics.base.KineticBlockEntity;
|
||||
import com.simibubi.create.foundation.fluid.CombinedTankWrapper;
|
||||
import com.simibubi.create.foundation.fluid.SmartFluidTank;
|
||||
import com.simibubi.create.foundation.utility.Lang;
|
||||
import com.simibubi.create.foundation.utility.LangBuilder;
|
||||
import com.simibubi.create.foundation.utility.animation.LerpedFloat;
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
import net.minecraft.world.item.context.UseOnContext;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.util.LazyOptional;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
|
||||
import net.minecraftforge.fluids.capability.IFluidHandler;
|
||||
import net.minecraftforge.fluids.capability.templates.FluidTank;
|
||||
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static com.drmangotea.tfmg.blocks.engines.intake.AirIntakeBlock.INVISIBLE;
|
||||
import static com.simibubi.create.content.kinetics.base.DirectionalKineticBlock.FACING;
|
||||
|
||||
public class AirIntakeBlockEntity extends KineticBlockEntity implements IWrenchable {
|
||||
|
||||
|
||||
int diameter = 1;
|
||||
|
||||
boolean isController=false;
|
||||
|
||||
public boolean hasShaft=true;
|
||||
|
||||
boolean isUsedByController = false;
|
||||
|
||||
|
||||
public BlockPos controller;
|
||||
|
||||
public List<AirIntakeBlockEntity> blockEntities = new ArrayList<>();
|
||||
|
||||
public float maxShaftSpeed =0;
|
||||
|
||||
public float angle = 0;
|
||||
public LerpedFloat visual_angle = LerpedFloat.angular();
|
||||
|
||||
protected FluidTank tankInventory;
|
||||
protected LazyOptional<IFluidHandler> fluidCapability;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public AirIntakeBlockEntity(BlockEntityType<?> typeIn, BlockPos pos, BlockState state) {
|
||||
super(typeIn, pos, state);
|
||||
tankInventory = createInventory();
|
||||
fluidCapability = LazyOptional.of(() -> tankInventory);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void tick(){
|
||||
super.tick();
|
||||
|
||||
|
||||
int production = ((int)maxShaftSpeed*((diameter*diameter)))/60;
|
||||
if(tankInventory.getFluidAmount()+production <= tankInventory.getCapacity())
|
||||
tankInventory.fill(new FluidStack(TFMGFluids.AIR.getSource(),production), IFluidHandler.FluidAction.EXECUTE);
|
||||
////////////////
|
||||
|
||||
|
||||
if(diameter == 3){
|
||||
visual_angle.chase(angle, 0.1f, LerpedFloat.Chaser.EXP);
|
||||
visual_angle.tickChaser();
|
||||
}
|
||||
|
||||
angle+=maxShaftSpeed/2;
|
||||
|
||||
|
||||
angle %= 360;
|
||||
|
||||
|
||||
if(isUsedByController)
|
||||
blockEntities.clear();
|
||||
|
||||
|
||||
|
||||
if(!this.getBlockState().getValue(INVISIBLE)){
|
||||
if(isController||isUsedByController){
|
||||
level.setBlock(this.getBlockPos(),this.getBlockState().setValue(INVISIBLE,true),2);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
if(!isController&&!isUsedByController)
|
||||
level.setBlock(this.getBlockPos(),this.getBlockState().setValue(INVISIBLE,false),2);
|
||||
|
||||
if(controller == null)
|
||||
controller = this.getBlockPos();
|
||||
|
||||
diameter =getPossibleDiameter();
|
||||
|
||||
if(controller == this.getBlockPos()) {
|
||||
|
||||
isUsedByController = false;
|
||||
} else {
|
||||
isUsedByController = true;
|
||||
isController = false;
|
||||
}
|
||||
|
||||
if(diameter ==1) {
|
||||
isController = false;
|
||||
|
||||
}
|
||||
|
||||
if(!(level.getBlockEntity(controller) instanceof AirIntakeBlockEntity)) {
|
||||
isUsedByController = false;
|
||||
controller = this.getBlockPos();
|
||||
|
||||
} else {
|
||||
if(!(((AirIntakeBlockEntity) level.getBlockEntity(controller)).isController))
|
||||
isUsedByController = false;
|
||||
}
|
||||
//else
|
||||
// if(!(((AirIntakeBlockEntity) level.getBlockEntity(controller)).isController))
|
||||
// controller = this.getBlockPos();
|
||||
|
||||
if(controller!=null) {
|
||||
if(((AirIntakeBlockEntity)level.getBlockEntity(controller)).diameter==2) {
|
||||
int x = Math.abs(this.getBlockPos().getX() - controller.getX());
|
||||
int y = Math.abs(this.getBlockPos().getY() - controller.getY());
|
||||
int z = Math.abs(this.getBlockPos().getZ() - controller.getZ());
|
||||
|
||||
int distanceFromController = x + y + z;
|
||||
if (x > 1 || y > 1 || z > 1) {
|
||||
isUsedByController = false;
|
||||
controller = this.getBlockPos();
|
||||
}
|
||||
}
|
||||
if(((AirIntakeBlockEntity)level.getBlockEntity(controller)).diameter==1) {
|
||||
isUsedByController = false;
|
||||
controller = this.getBlockPos();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
////////////////////////
|
||||
|
||||
if(diameter == 1){
|
||||
maxShaftSpeed = Math.abs(getSpeed());
|
||||
|
||||
}else {
|
||||
maxShaftSpeed = Math.abs(getSpeed());
|
||||
List<Float> speeds = new ArrayList<>();
|
||||
//
|
||||
for (AirIntakeBlockEntity be : blockEntities) {
|
||||
speeds.add(Math.abs(be.getSpeed()));
|
||||
//
|
||||
}
|
||||
//
|
||||
for(float testedSpeed : speeds){
|
||||
if(testedSpeed> maxShaftSpeed)
|
||||
maxShaftSpeed = testedSpeed;
|
||||
}
|
||||
// maxShaftSpeed = getSpeed();
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(isUsedByController)
|
||||
return;
|
||||
|
||||
if(diameter ==2){
|
||||
|
||||
if(blockEntities.toArray().length!=4)
|
||||
return;
|
||||
}
|
||||
if(diameter ==3){
|
||||
if(blockEntities.toArray().length!=9)
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@Override
|
||||
public void invalidate() {
|
||||
super.invalidate();
|
||||
|
||||
fluidCapability.invalidate();
|
||||
}
|
||||
|
||||
public InteractionResult onWrenched(BlockState state, UseOnContext context){
|
||||
Direction direction = context.getClickedFace();
|
||||
|
||||
if(direction == getBlockState().getValue(FACING).getOpposite()) {
|
||||
hasShaft = !hasShaft;
|
||||
}
|
||||
return InteractionResult.SUCCESS;
|
||||
}
|
||||
|
||||
public void setController(BlockPos controllerPos) {
|
||||
// isUsedByController = true;
|
||||
controller = controllerPos;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
@SuppressWarnings("removal")
|
||||
public <T> LazyOptional<T> getCapability(@Nonnull Capability<T> cap, Direction side) {
|
||||
|
||||
|
||||
|
||||
if(controller!=null)
|
||||
refreshCapability();
|
||||
|
||||
|
||||
|
||||
if (cap == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY)
|
||||
return fluidCapability.cast();
|
||||
return super.getCapability(cap, side);
|
||||
}
|
||||
|
||||
private void refreshCapability() {
|
||||
|
||||
if (this.controller == null) {
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
LazyOptional<IFluidHandler> oldFluidCapability = fluidCapability;
|
||||
|
||||
if(diameter==1&&!isUsedByController){
|
||||
|
||||
fluidCapability = LazyOptional.of(() -> new CombinedTankWrapper(tankInventory));
|
||||
|
||||
oldFluidCapability.invalidate();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if(!isController) {
|
||||
if (controller != getBlockPos()) {
|
||||
if (level.getBlockEntity(controller) instanceof AirIntakeBlockEntity)
|
||||
fluidCapability = LazyOptional.of(() -> new CombinedTankWrapper(((AirIntakeBlockEntity) level.getBlockEntity(controller)).tankInventory));
|
||||
|
||||
}
|
||||
}else fluidCapability = LazyOptional.of(() -> new CombinedTankWrapper(tankInventory));
|
||||
|
||||
oldFluidCapability.invalidate();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public int getPossibleDiameter(){
|
||||
|
||||
if(controller !=this.getBlockPos())
|
||||
return 1;
|
||||
|
||||
|
||||
|
||||
BlockPos checkedPos = this.getBlockPos();
|
||||
Direction direction = this.getBlockState().getValue(FACING);
|
||||
|
||||
|
||||
|
||||
List<BlockPos> checkedPosses = new ArrayList<>();
|
||||
checkedPos = this.getBlockPos();
|
||||
|
||||
boolean canBeMedium = true;
|
||||
for(int x = 0;x < 2; x++){
|
||||
for(int z = 0;z < 2; z++){
|
||||
checkedPosses.add(checkedPos);
|
||||
if(direction.getAxis().isHorizontal()) {
|
||||
checkedPos = checkedPos.above();
|
||||
}else checkedPos = checkedPos.east();
|
||||
}
|
||||
if(direction.getAxis().isHorizontal()) {
|
||||
checkedPos = checkedPos.below(2);
|
||||
checkedPos = checkedPos.relative(direction.getClockWise());
|
||||
} else {
|
||||
checkedPos = checkedPos.west(2);
|
||||
checkedPos = checkedPos.south();
|
||||
|
||||
}
|
||||
}
|
||||
List<BlockPos> checkedPossesLarge = new ArrayList<>();
|
||||
checkedPos = this.getBlockPos();
|
||||
|
||||
boolean canBeLarge = true;
|
||||
for(int x = 0;x < 3; x++){
|
||||
for(int z = 0;z < 3; z++){
|
||||
checkedPossesLarge.add(checkedPos);
|
||||
if(direction.getAxis().isHorizontal()) {
|
||||
checkedPos = checkedPos.above();
|
||||
}else checkedPos = checkedPos.east();
|
||||
}
|
||||
if(direction.getAxis().isHorizontal()) {
|
||||
checkedPos = checkedPos.below(3);
|
||||
checkedPos = checkedPos.relative(direction.getClockWise());
|
||||
} else {
|
||||
checkedPos = checkedPos.west(3);
|
||||
checkedPos = checkedPos.south();
|
||||
|
||||
}
|
||||
}
|
||||
//LARGE
|
||||
for(BlockPos pos : checkedPossesLarge){
|
||||
if(!(level.getBlockEntity(pos) instanceof AirIntakeBlockEntity)) {
|
||||
canBeLarge = false;
|
||||
break;
|
||||
}
|
||||
|
||||
// ((AirIntakeBlockEntity) level.getBlockEntity(pos)).controller = this.getBlockPos();
|
||||
AirIntakeBlockEntity checkedBE = (AirIntakeBlockEntity) level.getBlockEntity(pos);
|
||||
|
||||
//if(checkedBE.diameter<3)
|
||||
// ((AirIntakeBlockEntity) level.getBlockEntity(pos)).isController = false;
|
||||
|
||||
if(pos!=this.getBlockPos())
|
||||
if(checkedBE.isController) {
|
||||
|
||||
|
||||
canBeLarge = false;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(checkedBE.getBlockState().getValue(FACING) != this.getBlockState().getValue(FACING)) {
|
||||
canBeLarge = false;
|
||||
break;
|
||||
}
|
||||
|
||||
//if(pos!=this.getBlockPos())
|
||||
// ((AirIntakeBlockEntity) level.getBlockEntity(pos)).isUsedByController = true;
|
||||
|
||||
|
||||
}
|
||||
//MEDIUM
|
||||
for(BlockPos pos : checkedPosses){
|
||||
if(!(level.getBlockEntity(pos) instanceof AirIntakeBlockEntity)) {
|
||||
canBeMedium = false;
|
||||
break;
|
||||
}
|
||||
|
||||
// ((AirIntakeBlockEntity) level.getBlockEntity(pos)).controller = this.getBlockPos();
|
||||
AirIntakeBlockEntity checkedBE = (AirIntakeBlockEntity) level.getBlockEntity(pos);
|
||||
|
||||
if(pos!=this.getBlockPos())
|
||||
if(checkedBE.isController) {
|
||||
canBeMedium = false;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if(checkedBE.getBlockState().getValue(FACING) != this.getBlockState().getValue(FACING)) {
|
||||
canBeMedium = false;
|
||||
break;
|
||||
}
|
||||
|
||||
//if(pos!=this.getBlockPos())
|
||||
// ((AirIntakeBlockEntity) level.getBlockEntity(pos)).isUsedByController = true;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
if(canBeLarge) {
|
||||
this.blockEntities.clear();
|
||||
for(BlockPos pos : checkedPossesLarge) {
|
||||
//if(((AirIntakeBlockEntity) level.getBlockEntity(pos)).isUsedByController&&((AirIntakeBlockEntity) level.getBlockEntity(pos)).controller!=this.getBlockPos()&&pos!=this.getBlockPos()) {
|
||||
// controller = this.getBlockPos();
|
||||
// isController = false;
|
||||
// return 1;
|
||||
//}
|
||||
|
||||
if((((AirIntakeBlockEntity) level.getBlockEntity(pos)).isUsedByController&&((AirIntakeBlockEntity) level.getBlockEntity(pos)).controller!=this.getBlockPos()&&pos!=this.getBlockPos())||isController) {
|
||||
|
||||
((AirIntakeBlockEntity) level.getBlockEntity(pos)).isUsedByController = true;
|
||||
((AirIntakeBlockEntity) level.getBlockEntity(pos)).isController = false;
|
||||
((AirIntakeBlockEntity) level.getBlockEntity(pos)).controller =this.getBlockPos();
|
||||
|
||||
}
|
||||
|
||||
((AirIntakeBlockEntity) level.getBlockEntity(pos)).setController(this.getBlockPos());
|
||||
this.blockEntities.add((AirIntakeBlockEntity) level.getBlockEntity(pos));
|
||||
}
|
||||
|
||||
controller = this.getBlockPos();
|
||||
isController = true;
|
||||
return 3;
|
||||
}
|
||||
|
||||
|
||||
if(canBeMedium) {
|
||||
this.blockEntities.clear();
|
||||
|
||||
|
||||
|
||||
for(BlockPos pos : checkedPosses) {
|
||||
if(((AirIntakeBlockEntity) level.getBlockEntity(pos)).isUsedByController&&((AirIntakeBlockEntity) level.getBlockEntity(pos)).controller!=this.getBlockPos()&&pos!=this.getBlockPos()) {
|
||||
controller = this.getBlockPos();
|
||||
isController = false;
|
||||
return 1;
|
||||
}
|
||||
((AirIntakeBlockEntity) level.getBlockEntity(pos)).setController(this.getBlockPos());
|
||||
this.blockEntities.add((AirIntakeBlockEntity) level.getBlockEntity(pos));
|
||||
}
|
||||
|
||||
controller = this.getBlockPos();
|
||||
isController = true;
|
||||
return 2;
|
||||
}
|
||||
|
||||
controller = this.getBlockPos();
|
||||
isController = false;
|
||||
return 1;
|
||||
}
|
||||
@Override
|
||||
protected AABB createRenderBoundingBox() {
|
||||
|
||||
|
||||
return new AABB(this.getBlockPos()).inflate(3);
|
||||
}
|
||||
@Override
|
||||
@SuppressWarnings("removal")
|
||||
public boolean addToGoggleTooltip(List<Component> tooltip, boolean isPlayerSneaking) {
|
||||
|
||||
|
||||
|
||||
//--Fluid Info--//
|
||||
LazyOptional<IFluidHandler> handler = this.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY);
|
||||
Optional<IFluidHandler> resolve = handler.resolve();
|
||||
if (!resolve.isPresent())
|
||||
return false;
|
||||
|
||||
IFluidHandler tank = resolve.get();
|
||||
if (tank.getTanks() == 0)
|
||||
return false;
|
||||
|
||||
LangBuilder mb = Lang.translate("generic.unit.millibuckets");
|
||||
|
||||
|
||||
boolean isEmpty = true;
|
||||
for (int i = 0; i < tank.getTanks(); i++) {
|
||||
FluidStack fluidStack = tank.getFluidInTank(i);
|
||||
if (fluidStack.isEmpty())
|
||||
continue;
|
||||
|
||||
Lang.fluidName(fluidStack)
|
||||
.style(ChatFormatting.GRAY)
|
||||
.forGoggles(tooltip, 1);
|
||||
|
||||
Lang.builder()
|
||||
.add(Lang.number(fluidStack.getAmount())
|
||||
.add(mb)
|
||||
.style(ChatFormatting.DARK_GREEN))
|
||||
.text(ChatFormatting.GRAY, " / ")
|
||||
.add(Lang.number(tank.getTankCapacity(i))
|
||||
.add(mb)
|
||||
.style(ChatFormatting.DARK_GRAY))
|
||||
.forGoggles(tooltip, 1);
|
||||
|
||||
isEmpty = false;
|
||||
}
|
||||
|
||||
if (tank.getTanks() > 1) {
|
||||
if (isEmpty)
|
||||
tooltip.remove(tooltip.size() - 1);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!isEmpty)
|
||||
return true;
|
||||
|
||||
Lang.translate("gui.goggles.fluid_container.capacity")
|
||||
.add(Lang.number(tank.getTankCapacity(0))
|
||||
.add(mb)
|
||||
.style(ChatFormatting.DARK_GREEN))
|
||||
.style(ChatFormatting.DARK_GRAY)
|
||||
.forGoggles(tooltip, 1);
|
||||
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
protected SmartFluidTank createInventory() {
|
||||
return new SmartFluidTank(8000, this::onFluidStackChanged){
|
||||
@Override
|
||||
public boolean isFluidValid(FluidStack stack) {
|
||||
return stack.getFluid().isSame(TFMGFluids.AIR.getSource());
|
||||
}
|
||||
@Override
|
||||
public FluidStack drain(FluidStack resource, FluidAction action) {
|
||||
return FluidStack.EMPTY;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
protected void onFluidStackChanged(FluidStack newFluidStack) {
|
||||
if (!hasLevel())
|
||||
return;
|
||||
|
||||
|
||||
|
||||
if (!level.isClientSide) {
|
||||
setChanged();
|
||||
sendData();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void read(CompoundTag compound, boolean clientPacket) {
|
||||
super.read(compound, clientPacket);
|
||||
|
||||
diameter = compound.getInt("Diameter");
|
||||
isController = compound.getBoolean("IsController");
|
||||
isUsedByController = compound.getBoolean("IsUsed");
|
||||
hasShaft = compound.getBoolean("HasShaft");
|
||||
tankInventory.readFromNBT(compound.getCompound("TankContent"));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(CompoundTag compound, boolean clientPacket) {
|
||||
super.write(compound, clientPacket);
|
||||
|
||||
|
||||
compound.putInt("Diameter", diameter);
|
||||
compound.putBoolean("IsController", isController);
|
||||
compound.putBoolean("IsUsed", isUsedByController);
|
||||
compound.putBoolean("HasShaft", hasShaft);
|
||||
compound.put("TankContent", tankInventory.writeToNBT(new CompoundTag()));
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.drmangotea.tfmg.blocks.engines.intake;
|
||||
|
||||
import com.simibubi.create.content.contraptions.piston.MechanicalPistonBlock;
|
||||
import com.simibubi.create.content.kinetics.motor.CreativeMotorBlock;
|
||||
import com.simibubi.create.foundation.data.SpecialBlockStateGen;
|
||||
import com.tterrag.registrate.providers.DataGenContext;
|
||||
import com.tterrag.registrate.providers.RegistrateBlockstateProvider;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraftforge.client.model.generators.ModelFile;
|
||||
|
||||
import static com.simibubi.create.foundation.data.AssetLookup.partialBaseModel;
|
||||
|
||||
public class AirIntakeGenerator extends SpecialBlockStateGen {
|
||||
@Override
|
||||
protected int getXRotation(BlockState state) {
|
||||
Direction facing = state.getValue(MechanicalPistonBlock.FACING);
|
||||
return facing.getAxis()
|
||||
.isVertical() ? facing == Direction.DOWN ? 180 : 0 : 90;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getYRotation(BlockState state) {
|
||||
Direction facing = state.getValue(MechanicalPistonBlock.FACING);
|
||||
return facing.getAxis()
|
||||
.isVertical() ? 0 : horizontalAngle(facing) + 180;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends Block> ModelFile getModel(DataGenContext<Block, T> ctx, RegistrateBlockstateProvider prov, BlockState state) {
|
||||
return state.getValue(AirIntakeBlock.INVISIBLE) ? partialBaseModel(ctx, prov, "empty")
|
||||
: partialBaseModel(ctx, prov);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,333 @@
|
||||
package com.drmangotea.tfmg.blocks.engines.intake;
|
||||
|
||||
import com.drmangotea.tfmg.registry.TFMGPartialModels;
|
||||
import com.jozufozu.flywheel.api.InstanceData;
|
||||
import com.jozufozu.flywheel.api.MaterialManager;
|
||||
import com.jozufozu.flywheel.api.instance.DynamicInstance;
|
||||
import com.jozufozu.flywheel.core.materials.model.ModelData;
|
||||
import com.jozufozu.flywheel.util.transform.TransformStack;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.simibubi.create.AllPartialModels;
|
||||
import com.simibubi.create.content.kinetics.base.KineticBlockEntityInstance;
|
||||
import com.simibubi.create.content.kinetics.base.flwdata.RotatingData;
|
||||
import com.simibubi.create.foundation.render.AllMaterialSpecs;
|
||||
import com.simibubi.create.foundation.utility.AngleHelper;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import static net.minecraft.world.level.block.state.properties.BlockStateProperties.FACING;
|
||||
|
||||
public class AirIntakeInstance extends KineticBlockEntityInstance<AirIntakeBlockEntity> implements DynamicInstance {
|
||||
|
||||
|
||||
private final ModelData frame;
|
||||
|
||||
private final ModelData frameClosed;
|
||||
|
||||
private ModelData chassisMedium;
|
||||
|
||||
private ModelData chassisLarge;
|
||||
|
||||
protected Optional<RotatingData> shaft;
|
||||
protected final RotatingData fan;
|
||||
protected final ModelData fan_medium;
|
||||
protected final ModelData fan_large;
|
||||
|
||||
final Direction direction;
|
||||
private final Direction opposite;
|
||||
|
||||
public AirIntakeInstance(MaterialManager materialManager, AirIntakeBlockEntity blockEntity) {
|
||||
super(materialManager, blockEntity);
|
||||
|
||||
direction = blockState.getValue(FACING);
|
||||
|
||||
opposite = direction.getOpposite();
|
||||
|
||||
fan = materialManager.defaultCutout()
|
||||
.material(AllMaterialSpecs.ROTATING)
|
||||
.getModel(TFMGPartialModels.AIR_INTAKE_FAN, blockState, opposite)
|
||||
.createInstance();
|
||||
fan_medium = getTransformMaterial()
|
||||
//.defaultCutout()
|
||||
//.material(AllMaterialSpecs.ROTATING)
|
||||
.getModel(TFMGPartialModels.AIR_INTAKE_FAN_MEDIUM, blockState, opposite)
|
||||
.createInstance();
|
||||
fan_large = getTransformMaterial()
|
||||
//.defaultCutout()
|
||||
//.material(AllMaterialSpecs.ROTATING)
|
||||
.getModel(TFMGPartialModels.AIR_INTAKE_FAN_LARGE, blockState, opposite)
|
||||
.createInstance();
|
||||
|
||||
|
||||
|
||||
|
||||
setup(fan, getFanSpeed());
|
||||
|
||||
//setup(fan_large, getFanSpeed());
|
||||
|
||||
|
||||
|
||||
frame = getTransformMaterial()
|
||||
.getModel(TFMGPartialModels.AIR_INTAKE_FRAME,blockState,blockEntity.getBlockState().getValue(FACING))
|
||||
.createInstance();
|
||||
frameClosed = getTransformMaterial()
|
||||
.getModel(TFMGPartialModels.AIR_INTAKE_FRAME_CLOSED,blockState,blockEntity.getBlockState().getValue(FACING))
|
||||
.createInstance();
|
||||
|
||||
chassisMedium = getTransformMaterial()
|
||||
.getModel(TFMGPartialModels.AIR_INTAKE_MEDIUM,blockState,blockEntity.getBlockState().getValue(FACING))
|
||||
.createInstance();
|
||||
chassisLarge = getTransformMaterial()
|
||||
.getModel(TFMGPartialModels.AIR_INTAKE_LARGE,blockState,blockEntity.getBlockState().getValue(FACING))
|
||||
.createInstance();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// if(direction.getAxis().isHorizontal()) {
|
||||
// float x = 0;
|
||||
// float z = 0;
|
||||
// if(direction == Direction.NORTH)
|
||||
// x=0.5f;
|
||||
// if(direction == Direction.SOUTH)
|
||||
// x=-0.5f;
|
||||
// if(direction == Direction.WEST)
|
||||
// z=-0.5f;
|
||||
// if(direction == Direction.EAST)
|
||||
// z=0.5f;
|
||||
//
|
||||
//
|
||||
// // fan_large.translate(x*2,1,z*2);
|
||||
// fan_medium.setPosition(getInstancePosition()).nudge(x,0.5f,z);
|
||||
// }else {
|
||||
// fan_medium.setPosition(getInstancePosition()).nudge(0.5f, 0, 0.5f);
|
||||
// //fan_large.translate(1,0,1);
|
||||
// }
|
||||
}
|
||||
@Override
|
||||
public void init() {
|
||||
|
||||
|
||||
|
||||
|
||||
RotatingData data = setup(getRotatingMaterial().getModel(AllPartialModels.SHAFT_HALF, blockState, blockState.getValue(FACING).getOpposite())
|
||||
.createInstance());
|
||||
|
||||
|
||||
shaft = Optional.of(data);
|
||||
|
||||
}
|
||||
|
||||
private float getFanSpeed() {
|
||||
float speed = blockEntity.getSpeed();
|
||||
if (speed > 0)
|
||||
speed = Mth.clamp(speed, 80, 64 * 20);
|
||||
if (speed < 0)
|
||||
speed = Mth.clamp(speed, -64 * 20, -80);
|
||||
return speed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
shaft.ifPresent(this::updateRotation);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void beginFrame() {
|
||||
|
||||
|
||||
PoseStack msFan = new PoseStack();
|
||||
TransformStack msrFan = TransformStack.cast(msFan);
|
||||
msrFan.translate(getInstancePosition());
|
||||
|
||||
PoseStack msFanMedium = new PoseStack();
|
||||
TransformStack msrFanMedium = TransformStack.cast(msFanMedium);
|
||||
msrFanMedium.translate(getInstancePosition());
|
||||
//msrFan.translate(0,0,0);
|
||||
|
||||
|
||||
|
||||
|
||||
if(direction.getAxis().isHorizontal()) {
|
||||
float x = 0;
|
||||
float z = 0;
|
||||
if(direction == Direction.NORTH)
|
||||
x=1f;
|
||||
if(direction == Direction.SOUTH)
|
||||
x=-1f;
|
||||
if(direction == Direction.WEST)
|
||||
z=-1f;
|
||||
if(direction == Direction.EAST)
|
||||
z=1f;
|
||||
|
||||
|
||||
msrFan.translate(x,1,z);
|
||||
msrFanMedium.translate(x/2,0.5,z/2);
|
||||
}else {
|
||||
msrFanMedium.translate(0.5,0,0.5);
|
||||
msrFan.translate(1,0,1);
|
||||
}
|
||||
msrFan.centre();
|
||||
msrFanMedium.centre();
|
||||
// msrFan.translateY(3);
|
||||
//msrFan.translateY(5);
|
||||
msrFan.rotate((double) blockEntity.angle,direction.getAxis());
|
||||
msrFanMedium.rotate((double) blockEntity.angle,direction.getAxis());
|
||||
//msrFan.translateY(-5);
|
||||
// msrFan.translateX(-1);
|
||||
msrFan.unCentre();
|
||||
msrFanMedium.unCentre();
|
||||
|
||||
|
||||
|
||||
if(!blockEntity.isUsedByController) {
|
||||
if(blockEntity.diameter ==1) {
|
||||
updateRotation(fan, getFanSpeed());
|
||||
fan_medium.setEmptyTransform();
|
||||
fan_large.setEmptyTransform();
|
||||
}
|
||||
if(blockEntity.diameter ==2) {
|
||||
//updateRotation(fan_medium, getFanSpeed());
|
||||
fan_medium.setTransform(msFanMedium);
|
||||
fan.delete();
|
||||
fan_large.setEmptyTransform();
|
||||
|
||||
}
|
||||
if(blockEntity.diameter ==3) {
|
||||
|
||||
fan_large.setTransform(msFan);
|
||||
|
||||
fan.delete();
|
||||
fan_medium.setEmptyTransform();
|
||||
}
|
||||
|
||||
}else {
|
||||
fan.delete();
|
||||
fan_medium.setEmptyTransform();
|
||||
fan_large.setEmptyTransform();
|
||||
}
|
||||
/////////////
|
||||
PoseStack ms = new PoseStack();
|
||||
TransformStack msr = TransformStack.cast(ms);
|
||||
|
||||
msr.translate(getInstancePosition());
|
||||
|
||||
|
||||
if(direction==Direction.NORTH)
|
||||
msr.translateZ(0.001);
|
||||
if(direction==Direction.SOUTH)
|
||||
msr.translateZ(-0.001);
|
||||
if(direction==Direction.WEST)
|
||||
msr.translateX(0.001);
|
||||
if(direction==Direction.EAST)
|
||||
msr.translateX(-0.001);
|
||||
if(direction==Direction.UP)
|
||||
msr.translateY(-0.001);
|
||||
if(direction==Direction.DOWN)
|
||||
msr.translateY(0.001);
|
||||
|
||||
if(blockEntity.hasShaft) {
|
||||
frame.setTransform(ms);
|
||||
frameClosed.setEmptyTransform();
|
||||
|
||||
} else {
|
||||
frameClosed.setTransform(ms);
|
||||
frame.setEmptyTransform();
|
||||
}
|
||||
PoseStack ms1 = new PoseStack();
|
||||
TransformStack msr1 = TransformStack.cast(ms1);
|
||||
|
||||
msr1.translate(getInstancePosition());
|
||||
|
||||
PoseStack ms2 = new PoseStack();
|
||||
TransformStack msr2 = TransformStack.cast(ms2);
|
||||
|
||||
msr2.translate(getInstancePosition());
|
||||
|
||||
if(direction.getAxis().isHorizontal()){
|
||||
msr1.translateY(1);
|
||||
if(direction == Direction.NORTH)
|
||||
msr1.translateX(1);
|
||||
if(direction == Direction.SOUTH)
|
||||
msr1.translateX(-1);
|
||||
if(direction == Direction.EAST)
|
||||
msr1.translateZ(1);
|
||||
if(direction == Direction.WEST)
|
||||
msr1.translateZ(-1);
|
||||
}else {
|
||||
|
||||
msr1.translateZ(1);
|
||||
msr1.translateX(1);
|
||||
if(direction!=Direction.DOWN)
|
||||
msr2.translateZ(1);
|
||||
msr2.translateX(1);
|
||||
|
||||
|
||||
}
|
||||
|
||||
if(blockEntity.diameter ==2){
|
||||
chassisMedium.setTransform(ms2);
|
||||
chassisLarge.setEmptyTransform();
|
||||
}
|
||||
|
||||
if(blockEntity.diameter ==3){
|
||||
chassisLarge.setTransform(ms1);
|
||||
chassisMedium.setEmptyTransform();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateLight() {
|
||||
BlockPos behind = pos.relative(opposite);
|
||||
|
||||
//AABB a = new AABB(pos);
|
||||
//a.inflate()
|
||||
//blockEntity.getLevel().getBlockStates(a);
|
||||
|
||||
|
||||
shaft.ifPresent(d -> relight(pos, d));
|
||||
relight(pos,frame);
|
||||
relight(pos,frameClosed);
|
||||
|
||||
relight(pos,chassisLarge);
|
||||
relight(pos,chassisMedium);
|
||||
|
||||
BlockPos inFront = pos.relative(direction);
|
||||
relight(pos, fan);
|
||||
relight(pos, fan_medium);
|
||||
relight(pos, fan_large);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
shaft.ifPresent(InstanceData::delete);
|
||||
fan.delete();
|
||||
fan_medium.delete();
|
||||
fan_large.delete();
|
||||
frame.delete();
|
||||
frameClosed.delete();
|
||||
chassisMedium.delete();
|
||||
chassisLarge.delete();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,169 @@
|
||||
package com.drmangotea.tfmg.blocks.engines.intake;
|
||||
|
||||
import com.drmangotea.tfmg.blocks.machines.metal_processing.blast_furnace.BlastFurnaceOutputBlockEntity;
|
||||
import com.drmangotea.tfmg.registry.TFMGPartialModels;
|
||||
import com.jozufozu.flywheel.backend.Backend;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||
import com.simibubi.create.AllPartialModels;
|
||||
import com.simibubi.create.content.fluids.hosePulley.HosePulleyBlockEntity;
|
||||
import com.simibubi.create.content.kinetics.base.KineticBlockEntityRenderer;
|
||||
import com.simibubi.create.content.kinetics.fan.EncasedFanBlockEntity;
|
||||
import com.simibubi.create.foundation.blockEntity.renderer.SafeBlockEntityRenderer;
|
||||
import com.simibubi.create.foundation.render.CachedBufferer;
|
||||
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
||||
import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
||||
import net.minecraft.client.renderer.LevelRenderer;
|
||||
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.util.Mth;
|
||||
|
||||
import static net.minecraft.world.level.block.state.properties.BlockStateProperties.FACING;
|
||||
|
||||
public class AirIntakeRenderer extends KineticBlockEntityRenderer<AirIntakeBlockEntity> {
|
||||
|
||||
|
||||
|
||||
public AirIntakeRenderer(BlockEntityRendererProvider.Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void renderSafe(AirIntakeBlockEntity be, float partialTicks, PoseStack ms, MultiBufferSource buffer,
|
||||
int light, int overlay) {
|
||||
if (Backend.canUseInstancing(be.getLevel())) return;
|
||||
|
||||
|
||||
Direction direction = be.getBlockState()
|
||||
.getValue(FACING);
|
||||
VertexConsumer vb = buffer.getBuffer(RenderType.cutoutMipped());
|
||||
|
||||
SuperByteBuffer frame;
|
||||
if (be.hasShaft) {
|
||||
frame = CachedBufferer.partialFacing(TFMGPartialModels.AIR_INTAKE_FRAME, be.getBlockState(), direction);
|
||||
} else
|
||||
frame = CachedBufferer.partialFacing(TFMGPartialModels.AIR_INTAKE_FRAME_CLOSED, be.getBlockState(), direction);
|
||||
///
|
||||
if (direction == Direction.NORTH)
|
||||
frame.translateZ(0.001);
|
||||
if (direction == Direction.SOUTH)
|
||||
frame.translateZ(-0.001);
|
||||
if (direction == Direction.WEST)
|
||||
frame.translateX(0.001);
|
||||
if (direction == Direction.EAST)
|
||||
frame.translateX(-0.001);
|
||||
if (direction == Direction.UP)
|
||||
frame.translateY(-0.001);
|
||||
if (direction == Direction.DOWN)
|
||||
frame.translateY(0.001);
|
||||
|
||||
frame.renderInto(ms, vb);
|
||||
|
||||
///
|
||||
if (be.diameter == 2) {
|
||||
SuperByteBuffer chassisMedium = CachedBufferer.partialFacing(TFMGPartialModels.AIR_INTAKE_MEDIUM, be.getBlockState(), direction);
|
||||
if(direction == Direction.UP)
|
||||
chassisMedium.translateZ(1);
|
||||
if(direction.getAxis().isVertical())
|
||||
chassisMedium.translateX(1);
|
||||
|
||||
|
||||
chassisMedium.renderInto(ms, vb);
|
||||
}
|
||||
|
||||
if (be.diameter == 3) {
|
||||
SuperByteBuffer chassisLarge = CachedBufferer.partialFacing(TFMGPartialModels.AIR_INTAKE_LARGE, be.getBlockState(), direction);
|
||||
|
||||
if (direction.getAxis().isHorizontal()) {
|
||||
chassisLarge.translateY(1);
|
||||
if (direction == Direction.NORTH)
|
||||
chassisLarge.translateX(1);
|
||||
if (direction == Direction.SOUTH)
|
||||
chassisLarge.translateX(-1);
|
||||
if (direction == Direction.EAST)
|
||||
chassisLarge.translateZ(1);
|
||||
if (direction == Direction.WEST)
|
||||
chassisLarge.translateZ(-1);
|
||||
} else {
|
||||
chassisLarge.translateZ(1);
|
||||
|
||||
chassisLarge.translateX(1);
|
||||
|
||||
|
||||
}
|
||||
|
||||
chassisLarge.renderInto(ms, vb);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/////
|
||||
int lightBehind = LevelRenderer.getLightColor(be.getLevel(), be.getBlockPos().relative(direction.getOpposite()));
|
||||
int lightInFront = LevelRenderer.getLightColor(be.getLevel(), be.getBlockPos().relative(direction));
|
||||
|
||||
SuperByteBuffer shaftHalf =
|
||||
CachedBufferer.partialFacing(AllPartialModels.SHAFT_HALF, be.getBlockState(), direction.getOpposite());
|
||||
|
||||
|
||||
|
||||
|
||||
SuperByteBuffer fanInner =
|
||||
CachedBufferer.partialFacing(AllPartialModels.ENCASED_FAN_INNER, be.getBlockState(), direction.getOpposite());
|
||||
|
||||
|
||||
|
||||
if (be.diameter == 2) {
|
||||
fanInner =
|
||||
CachedBufferer.partialFacing(TFMGPartialModels.AIR_INTAKE_FAN_MEDIUM, be.getBlockState(), direction.getOpposite());
|
||||
}
|
||||
|
||||
if (be.diameter == 3) {
|
||||
fanInner =
|
||||
CachedBufferer.partialFacing(TFMGPartialModels.AIR_INTAKE_FAN_LARGE, be.getBlockState(), direction.getOpposite());
|
||||
|
||||
}
|
||||
|
||||
|
||||
if(direction.getAxis().isHorizontal()) {
|
||||
float x = 0;
|
||||
float z = 0;
|
||||
if(direction == Direction.NORTH)
|
||||
x=1f;
|
||||
if(direction == Direction.SOUTH)
|
||||
x=-1f;
|
||||
if(direction == Direction.WEST)
|
||||
z=-1f;
|
||||
if(direction == Direction.EAST)
|
||||
z=1f;
|
||||
|
||||
if(be.diameter==3)
|
||||
fanInner.translate(x,1,z);
|
||||
if(be.diameter==2)
|
||||
fanInner.translate(x/2,0.5,z/2);
|
||||
}else {
|
||||
if(be.diameter==2)
|
||||
fanInner.translate(0.5,0,0.5);
|
||||
if(be.diameter==3)
|
||||
fanInner.translate(1,0,1);
|
||||
}
|
||||
|
||||
|
||||
float time = AnimationTickHolder.getRenderTime(be.getLevel());
|
||||
float speed = be.maxShaftSpeed * 2;
|
||||
if (speed > 0)
|
||||
speed = Mth.clamp(speed, 80, 64 * 20);
|
||||
if (speed < 0)
|
||||
speed = Mth.clamp(speed, -64 * 20, -80);
|
||||
float angle = (time * speed * 3 / 10f) % 360;
|
||||
angle = angle / 180f * (float) Math.PI;
|
||||
|
||||
standardKineticRotationTransform(shaftHalf, be, lightBehind).renderInto(ms, vb);
|
||||
if(!be.isUsedByController)
|
||||
kineticRotationTransform(fanInner, be, direction.getAxis(), angle, lightInFront).renderInto(ms, vb);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,590 @@
|
||||
package com.drmangotea.tfmg.blocks.engines.small;
|
||||
|
||||
|
||||
import com.drmangotea.tfmg.blocks.engines.small.turbine.TurbineEngineTileEntity;
|
||||
import com.drmangotea.tfmg.registry.TFMGBlocks;
|
||||
import com.drmangotea.tfmg.registry.TFMGFluids;
|
||||
import com.simibubi.create.AllSoundEvents;
|
||||
import com.simibubi.create.content.equipment.goggles.IHaveGoggleInformation;
|
||||
import com.simibubi.create.content.equipment.wrench.IWrenchable;
|
||||
import com.simibubi.create.content.kinetics.base.GeneratingKineticBlockEntity;
|
||||
import com.simibubi.create.foundation.blockEntity.behaviour.BlockEntityBehaviour;
|
||||
import com.simibubi.create.foundation.fluid.SmartFluidTank;
|
||||
import com.simibubi.create.foundation.utility.Lang;
|
||||
import com.simibubi.create.foundation.utility.LangBuilder;
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.NbtUtils;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
import net.minecraft.world.item.context.UseOnContext;
|
||||
import net.minecraft.world.level.block.DirectionalBlock;
|
||||
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.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.util.LazyOptional;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.IFluidTank;
|
||||
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
|
||||
import net.minecraftforge.fluids.capability.IFluidHandler;
|
||||
import net.minecraftforge.fluids.capability.templates.FluidTank;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import static com.simibubi.create.content.kinetics.base.DirectionalKineticBlock.FACING;
|
||||
|
||||
public abstract class AbstractEngineTileEntity extends GeneratingKineticBlockEntity implements IHaveGoggleInformation, IWrenchable {
|
||||
|
||||
protected LazyOptional<IFluidHandler> fluidCapability;
|
||||
protected FluidTank tankInventory;
|
||||
|
||||
|
||||
protected int soundTimer=0;
|
||||
|
||||
protected BlockPos lastKnownPos;
|
||||
|
||||
public int fuelConsumption =0;
|
||||
|
||||
public float stressTotal=0;
|
||||
public float speed=0;
|
||||
public float stressBase=0;
|
||||
|
||||
public int efficiency=1;
|
||||
public final int idealSpeed=12;
|
||||
|
||||
private int consumptionTimer=0;
|
||||
|
||||
|
||||
|
||||
|
||||
private static final int SYNC_RATE = 8;
|
||||
protected int syncCooldown;
|
||||
protected boolean queuedSync;
|
||||
|
||||
//
|
||||
int signal;
|
||||
boolean signalChanged;
|
||||
//
|
||||
|
||||
// protected ScrollValueBehaviour generatedSpeed;
|
||||
|
||||
public AbstractEngineTileEntity(BlockEntityType<?> type, BlockPos pos, BlockState state) {
|
||||
super(type, pos, state);
|
||||
tankInventory = createInventory();
|
||||
|
||||
fluidCapability = LazyOptional.of(() -> tankInventory);
|
||||
|
||||
signal = 0;
|
||||
setLazyTickRate(40);
|
||||
refreshCapability();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addBehaviours(List<BlockEntityBehaviour> behaviours) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialize() {
|
||||
super.initialize();
|
||||
sendData();
|
||||
if (!hasSource() || getGeneratedSpeed() > getTheoreticalSpeed())
|
||||
updateGeneratedRotation();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getGeneratedSpeed() {
|
||||
|
||||
|
||||
|
||||
if(!hasBackPart())
|
||||
return 0;
|
||||
if(isExhaustTankFull())
|
||||
return 0;
|
||||
|
||||
|
||||
|
||||
|
||||
if(!level.isClientSide){
|
||||
|
||||
|
||||
calculateEfficiency();
|
||||
fuelConsumption = (int)((speed/(efficiency/10)/6)+1);
|
||||
if(fuelConsumption<1)
|
||||
fuelConsumption=0;
|
||||
if(!tankInventory.isEmpty()) {
|
||||
|
||||
if(consumptionTimer>=5) {
|
||||
if(signal!=0)
|
||||
tankInventory.drain(fuelConsumption, IFluidHandler.FluidAction.EXECUTE);
|
||||
consumptionTimer=0;
|
||||
}
|
||||
consumptionTimer++;
|
||||
|
||||
|
||||
|
||||
|
||||
return convertToDirection(signal * signal, getBlockState().getValue(FACING));
|
||||
}}
|
||||
return 0;
|
||||
|
||||
|
||||
}
|
||||
|
||||
public boolean isExhaustTankFull(){
|
||||
if(!hasBackPart())
|
||||
return false;
|
||||
EngineBackBlockEntity back = (EngineBackBlockEntity) level.getBlockEntity(this.getBlockPos().relative(this.getBlockState().getValue(FACING).getOpposite()));
|
||||
return back.tankInventory.getFluidAmount()+7>=500;
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void calculateEfficiency(){
|
||||
|
||||
|
||||
if(signal==0||tankInventory.isEmpty()) {
|
||||
efficiency = 0;
|
||||
return;
|
||||
}
|
||||
efficiency=100;
|
||||
|
||||
if(signal>idealSpeed){
|
||||
efficiency=(100-(signal-idealSpeed)*5);
|
||||
}
|
||||
|
||||
if(signal<idealSpeed){
|
||||
efficiency=(100-(idealSpeed-signal)*3);
|
||||
}
|
||||
|
||||
|
||||
if(efficiency>100)
|
||||
efficiency=100;
|
||||
|
||||
}
|
||||
|
||||
public boolean hasBackPart(){
|
||||
BlockPos wantedLocation=this.getBlockPos();
|
||||
Direction direction = this.getBlockState().getValue(DirectionalBlock.FACING);
|
||||
|
||||
|
||||
if(direction == Direction.UP)
|
||||
wantedLocation=this.getBlockPos().below();
|
||||
if(direction == Direction.DOWN)
|
||||
wantedLocation=this.getBlockPos().above();
|
||||
if(direction == Direction.NORTH)
|
||||
wantedLocation=this.getBlockPos().south();
|
||||
if(direction == Direction.SOUTH)
|
||||
wantedLocation=this.getBlockPos().north();
|
||||
if(direction == Direction.WEST)
|
||||
wantedLocation=this.getBlockPos().east();
|
||||
if(direction == Direction.EAST)
|
||||
wantedLocation=this.getBlockPos().west();
|
||||
|
||||
|
||||
|
||||
if(!level.getBlockState(wantedLocation).is(TFMGBlocks.GASOLINE_ENGINE_BACK.get())) {
|
||||
return false;
|
||||
}else {
|
||||
if ( level.getBlockState(wantedLocation).getValue(DirectionalBlock.FACING) != direction)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addToGoggleTooltip(List<Component> tooltip, boolean isPlayerSneaking) {
|
||||
// boolean added = super.addToGoggleTooltip(tooltip, isPlayerSneaking);
|
||||
// if (!IRotate.StressImpact.isEnabled())
|
||||
// return added;
|
||||
//
|
||||
Lang.translate("goggles.engine_stats")
|
||||
.forGoggles(tooltip);
|
||||
if(!hasBackPart()){
|
||||
Lang.translate("goggles.engine.backpartmissing")
|
||||
.style(ChatFormatting.DARK_RED)
|
||||
.space()
|
||||
.forGoggles(tooltip);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
stressBase = calculateAddedStressCapacity();
|
||||
// if (Mth.equal(stressBase, 0))
|
||||
// return added;
|
||||
|
||||
|
||||
Lang.translate("tooltip.capacityProvided")
|
||||
.style(ChatFormatting.GRAY)
|
||||
.space()
|
||||
.forGoggles(tooltip);
|
||||
|
||||
speed = getTheoreticalSpeed();
|
||||
if (speed != getGeneratedSpeed() && speed != 0)
|
||||
// stressBase *= getGeneratedSpeed() / speed;
|
||||
speed = Math.abs(speed);
|
||||
|
||||
stressTotal = stressBase * speed;
|
||||
|
||||
Lang.number(stressTotal)
|
||||
.translate("generic.unit.stress")
|
||||
.style(ChatFormatting.DARK_AQUA)
|
||||
|
||||
.space()
|
||||
.add(Lang.translate("gui.goggles.at_current_speed")
|
||||
.style(ChatFormatting.DARK_GRAY))
|
||||
|
||||
.forGoggles(tooltip, 1);
|
||||
|
||||
Lang.translate("goggles.engine_redstone_input")
|
||||
.style(ChatFormatting.GRAY)
|
||||
.forGoggles(tooltip);
|
||||
Lang.translate("tooltip.engine_analog_strength", this.signal)
|
||||
.style(ChatFormatting.DARK_AQUA)
|
||||
.forGoggles(tooltip,1);
|
||||
|
||||
/////
|
||||
|
||||
Lang.translate("goggles.engine.efficiency")
|
||||
.style(ChatFormatting.GRAY)
|
||||
.forGoggles(tooltip);
|
||||
Lang.translate("goggles.get_engine_efficiency", this.efficiency)
|
||||
.style(ChatFormatting.DARK_AQUA)
|
||||
.add(Lang.translate("goggles.units.percent"))
|
||||
.forGoggles(tooltip,1);
|
||||
|
||||
|
||||
////////////////////////////////////////
|
||||
LazyOptional<IFluidHandler> handler = this.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY);
|
||||
Optional<IFluidHandler> resolve = handler.resolve();
|
||||
if (!resolve.isPresent())
|
||||
return false;
|
||||
|
||||
IFluidHandler tank = resolve.get();
|
||||
if (tank.getTanks() == 0)
|
||||
return false;
|
||||
|
||||
LangBuilder mb = Lang.translate("generic.unit.millibuckets");
|
||||
Lang.translate("goggles.fuel_container")
|
||||
.style(ChatFormatting.GRAY)
|
||||
.forGoggles(tooltip);
|
||||
|
||||
|
||||
boolean isEmpty = true;
|
||||
for (int i = 0; i < tank.getTanks(); i++) {
|
||||
FluidStack fluidStack = tank.getFluidInTank(i);
|
||||
if (fluidStack.isEmpty())
|
||||
continue;
|
||||
|
||||
Lang.fluidName(fluidStack)
|
||||
.style(ChatFormatting.GRAY)
|
||||
.forGoggles(tooltip, 1);
|
||||
|
||||
Lang.builder()
|
||||
.add(Lang.number(fluidStack.getAmount())
|
||||
.add(mb)
|
||||
.style(ChatFormatting.DARK_AQUA))
|
||||
.text(ChatFormatting.GRAY, " / ")
|
||||
.add(Lang.number(tank.getTankCapacity(i))
|
||||
.add(mb)
|
||||
.style(ChatFormatting.DARK_GRAY))
|
||||
.forGoggles(tooltip, 1);
|
||||
|
||||
isEmpty = false;
|
||||
}
|
||||
|
||||
if (tank.getTanks() > 1) {
|
||||
if (isEmpty)
|
||||
tooltip.remove(tooltip.size() - 1);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!isEmpty)
|
||||
return true;
|
||||
|
||||
Lang.translate("gui.goggles.fluid_container.capacity")
|
||||
.add(Lang.number(tank.getTankCapacity(0))
|
||||
.add(mb)
|
||||
.style(ChatFormatting.DARK_AQUA))
|
||||
.style(ChatFormatting.DARK_GRAY)
|
||||
.forGoggles(tooltip, 1);
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public InteractionResult onWrenched(BlockState state, UseOnContext context) {
|
||||
|
||||
|
||||
|
||||
|
||||
// this.getBlockState().setValue(EngineBlock.BACKPART,true);
|
||||
|
||||
return InteractionResult.SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////
|
||||
@Override
|
||||
public void write(CompoundTag compound, boolean clientPacket) {
|
||||
compound.putInt("Signal", signal);
|
||||
if (lastKnownPos != null)
|
||||
compound.put("LastKnownPos", NbtUtils.writeBlockPos(lastKnownPos));
|
||||
|
||||
|
||||
compound.put("TankContent", tankInventory.writeToNBT(new CompoundTag()));
|
||||
|
||||
|
||||
super.write(compound, clientPacket);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void read(CompoundTag compound, boolean clientPacket) {
|
||||
|
||||
|
||||
|
||||
lastKnownPos = null;
|
||||
|
||||
if (compound.contains("LastKnownPos"))
|
||||
lastKnownPos = NbtUtils.readBlockPos(compound.getCompound("LastKnownPos"));
|
||||
|
||||
|
||||
|
||||
|
||||
tankInventory.readFromNBT(compound.getCompound("TankContent"));
|
||||
if (tankInventory.getSpace() < 0)
|
||||
tankInventory.drain(-tankInventory.getSpace(), IFluidHandler.FluidAction.EXECUTE);
|
||||
|
||||
|
||||
|
||||
|
||||
signal = compound.getInt("Signal");
|
||||
super.read(compound, clientPacket);
|
||||
}
|
||||
|
||||
public float getModifier() {
|
||||
return getModifierForSignal(signal);
|
||||
}
|
||||
|
||||
public void neighbourChanged() {
|
||||
if (!hasLevel())
|
||||
return;
|
||||
int power = level.getBestNeighborSignal(worldPosition);
|
||||
if (power != signal)
|
||||
signalChanged = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void lazyTick() {
|
||||
super.lazyTick();
|
||||
neighbourChanged();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
super.tick();
|
||||
|
||||
///
|
||||
// if(signal!=0&&hasBackPart()&&tankInventory.getFluidAmount()!=0&&!overStressed&&isExhaustTankFull()) {
|
||||
|
||||
|
||||
soundTimer++;
|
||||
|
||||
// if(!isExhaustTankFull()) {
|
||||
if (soundTimer >= ((16-signal)/2)+1) {
|
||||
if(signal!=0&&
|
||||
hasBackPart()&&
|
||||
tankInventory.getFluidAmount()!=0 &&
|
||||
!overStressed
|
||||
|
||||
|
||||
){
|
||||
EngineBackBlockEntity back = (EngineBackBlockEntity) level.getBlockEntity(this.getBlockPos().relative(this.getBlockState().getValue(FACING).getOpposite()));
|
||||
if(back.tankInventory.getFluidAmount()+4<=500){
|
||||
|
||||
// if(this.getGeneratedSpeed()!=0) {
|
||||
if (level.isClientSide)
|
||||
makeSound();
|
||||
}
|
||||
}
|
||||
}
|
||||
// }
|
||||
|
||||
|
||||
///
|
||||
|
||||
if(!hasBackPart())
|
||||
return;
|
||||
if(!isExhaustTankFull()) {
|
||||
if(tankInventory.getFluidAmount()!=0) {
|
||||
|
||||
EngineBackBlockEntity back = (EngineBackBlockEntity) level.getBlockEntity(this.getBlockPos().relative(this.getBlockState().getValue(FACING).getOpposite()));
|
||||
if(back!=null) {
|
||||
if (efficiency != 0 && signal != 0 && !overStressed && !isExhaustTankFull())
|
||||
back.tankInventory.setFluid(new FluidStack(TFMGFluids.CARBON_DIOXIDE.getSource(), back.tankInventory.getFluidAmount() + 6));
|
||||
}
|
||||
}
|
||||
}
|
||||
updateGeneratedRotation();
|
||||
calculateEfficiency();
|
||||
|
||||
//if(signalChanged)
|
||||
|
||||
|
||||
stressBase = calculateAddedStressCapacity();
|
||||
speed = getTheoreticalSpeed();
|
||||
if (speed != getGeneratedSpeed() && speed != 0)
|
||||
stressBase *= getGeneratedSpeed() / speed;
|
||||
speed = Math.abs(speed);
|
||||
|
||||
stressTotal = stressBase * speed;
|
||||
// if (level.isClientSide)
|
||||
// return;
|
||||
if (signalChanged) {
|
||||
signalChanged = false;
|
||||
analogSignalChanged(level.getBestNeighborSignal(worldPosition));
|
||||
}
|
||||
if (syncCooldown > 0) {
|
||||
syncCooldown--;
|
||||
if (syncCooldown == 0 && queuedSync)
|
||||
sendData();
|
||||
}
|
||||
|
||||
if (lastKnownPos == null)
|
||||
lastKnownPos = getBlockPos();
|
||||
else if (!lastKnownPos.equals(worldPosition) && worldPosition != null) {
|
||||
onPositionChanged();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
private void makeSound(){
|
||||
soundTimer=0;
|
||||
if(this instanceof TurbineEngineTileEntity){
|
||||
AllSoundEvents.WHISTLE_CHIFF.playAt(level, worldPosition, 0.03f, .2f, false);
|
||||
}
|
||||
//else
|
||||
|
||||
// CISoundEvents.DIESEL_ENGINE_SOUNDS.playAt(level, worldPosition, 0.9f, .1f, false);
|
||||
|
||||
|
||||
}
|
||||
|
||||
protected void analogSignalChanged(int newSignal) {
|
||||
//removeSource();
|
||||
signal = newSignal;
|
||||
}
|
||||
|
||||
protected float getModifierForSignal(int newPower) {
|
||||
if (newPower == 0)
|
||||
return 1;
|
||||
return 1 + ((newPower + 1) / 16f);
|
||||
}
|
||||
/////////////////////
|
||||
|
||||
protected SmartFluidTank createInventory() {
|
||||
return new SmartFluidTank(1000, this::onFluidStackChanged){
|
||||
@Override
|
||||
public boolean isFluidValid(FluidStack stack) {
|
||||
return stack.getFluid().isSame(validFuel());
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private void onPositionChanged() {
|
||||
lastKnownPos = worldPosition;
|
||||
}
|
||||
|
||||
protected void onFluidStackChanged(FluidStack newFluidStack) {}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void sendData() {
|
||||
if (syncCooldown > 0) {
|
||||
queuedSync = true;
|
||||
return;
|
||||
}
|
||||
super.sendData();
|
||||
queuedSync = false;
|
||||
syncCooldown = SYNC_RATE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private void refreshCapability() {
|
||||
LazyOptional<IFluidHandler> oldCap = fluidCapability;
|
||||
fluidCapability = LazyOptional.of(() -> handlerForCapability());
|
||||
oldCap.invalidate();
|
||||
}
|
||||
|
||||
private IFluidHandler handlerForCapability() {
|
||||
return tankInventory;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public float getFillState() {
|
||||
return (float) tankInventory.getFluidAmount() / tankInventory.getCapacity();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public <T> LazyOptional<T> getCapability(@Nonnull Capability<T> cap, @Nullable Direction side) {
|
||||
if (!fluidCapability.isPresent())
|
||||
refreshCapability();
|
||||
if (cap == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY)
|
||||
return fluidCapability.cast();
|
||||
return super.getCapability(cap, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invalidate() {
|
||||
super.invalidate();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public IFluidTank getTankInventory() {
|
||||
return tankInventory;
|
||||
}
|
||||
|
||||
public Fluid validFuel(){
|
||||
return TFMGFluids.GASOLINE.get();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,260 @@
|
||||
package com.drmangotea.tfmg.blocks.engines.small;
|
||||
|
||||
import com.drmangotea.createindustry.content.oil.exhaust.ExhaustBlock;
|
||||
import com.drmangotea.createindustry.registry.CIFluids;
|
||||
import com.simibubi.create.content.equipment.goggles.IHaveGoggleInformation;
|
||||
import com.simibubi.create.foundation.blockEntity.SmartBlockEntity;
|
||||
import com.simibubi.create.foundation.blockEntity.behaviour.BlockEntityBehaviour;
|
||||
import com.simibubi.create.foundation.fluid.SmartFluidTank;
|
||||
import com.simibubi.create.foundation.utility.Lang;
|
||||
import com.simibubi.create.foundation.utility.LangBuilder;
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.chat.Component;
|
||||
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.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.util.LazyOptional;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.IFluidTank;
|
||||
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
|
||||
import net.minecraftforge.fluids.capability.IFluidHandler;
|
||||
import net.minecraftforge.fluids.capability.templates.FluidTank;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
public class EngineBackBlockEntity extends SmartBlockEntity implements IHaveGoggleInformation {
|
||||
|
||||
|
||||
|
||||
public int consumptionTimer=0;
|
||||
|
||||
protected LazyOptional<IFluidHandler> fluidCapability;
|
||||
public FluidTank tankInventory;
|
||||
|
||||
|
||||
|
||||
private static final int SYNC_RATE = 8;
|
||||
protected int syncCooldown;
|
||||
protected boolean queuedSync;
|
||||
|
||||
|
||||
|
||||
public EngineBackBlockEntity(BlockEntityType<?> type, BlockPos pos, BlockState state) {
|
||||
super(type, pos, state);
|
||||
tankInventory = createInventory();
|
||||
fluidCapability = LazyOptional.of(() -> tankInventory);
|
||||
|
||||
refreshCapability();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean addToGoggleTooltip(List<Component> tooltip, boolean isPlayerSneaking) {
|
||||
|
||||
LangBuilder mb = Lang.translate("generic.unit.millibuckets");
|
||||
Lang.translate("goggles.engine_exhaust_stats")
|
||||
.forGoggles(tooltip);
|
||||
|
||||
|
||||
/////////
|
||||
LazyOptional<IFluidHandler> handler = this.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY);
|
||||
Optional<IFluidHandler> resolve = handler.resolve();
|
||||
if (!resolve.isPresent())
|
||||
return false;
|
||||
|
||||
IFluidHandler tank = resolve.get();
|
||||
if (tank.getTanks() == 0)
|
||||
return false;
|
||||
|
||||
Lang.translate("goggles.pumpjack_fluid_storage")
|
||||
.style(ChatFormatting.GRAY)
|
||||
.forGoggles(tooltip);
|
||||
|
||||
|
||||
boolean isEmpty = true;
|
||||
for (int i = 0; i < tank.getTanks(); i++) {
|
||||
FluidStack fluidStack = tank.getFluidInTank(i);
|
||||
if (fluidStack.isEmpty())
|
||||
continue;
|
||||
|
||||
Lang.fluidName(fluidStack)
|
||||
.style(ChatFormatting.GRAY)
|
||||
.forGoggles(tooltip, 1);
|
||||
|
||||
Lang.builder()
|
||||
.add(Lang.number(fluidStack.getAmount())
|
||||
.add(mb)
|
||||
.style(ChatFormatting.GOLD))
|
||||
.text(ChatFormatting.GRAY, " / ")
|
||||
.add(Lang.number(tank.getTankCapacity(i))
|
||||
.add(mb)
|
||||
.style(ChatFormatting.DARK_GRAY))
|
||||
.forGoggles(tooltip, 1);
|
||||
|
||||
isEmpty = false;
|
||||
}
|
||||
|
||||
if (tank.getTanks() > 1) {
|
||||
if (isEmpty)
|
||||
tooltip.remove(tooltip.size() - 1);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!isEmpty)
|
||||
return true;
|
||||
|
||||
Lang.translate("gui.goggles.fluid_container.capacity")
|
||||
.add(Lang.number(tank.getTankCapacity(0))
|
||||
.add(mb)
|
||||
.style(ChatFormatting.GOLD))
|
||||
.style(ChatFormatting.DARK_GRAY)
|
||||
.forGoggles(tooltip, 1);
|
||||
|
||||
|
||||
return true;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
protected SmartFluidTank createInventory() {
|
||||
return new SmartFluidTank(1000, this::onFluidStackChanged){
|
||||
@Override
|
||||
public boolean isFluidValid(FluidStack stack) {
|
||||
return stack.getFluid().isSame(CIFluids.CARBON_DIOXIDE.getSource());
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
protected void onFluidStackChanged(FluidStack newFluidStack) {
|
||||
sendData();
|
||||
}
|
||||
public BlockEntity getFrontPart(){
|
||||
Direction direction = this.getBlockState().getValue(ExhaustBlock.FACING);
|
||||
|
||||
if(direction == Direction.UP)
|
||||
return level.getBlockEntity(this.getBlockPos().above());
|
||||
if(direction == Direction.DOWN)
|
||||
return level.getBlockEntity(this.getBlockPos().below());
|
||||
if(direction == Direction.NORTH)
|
||||
return level.getBlockEntity(this.getBlockPos().north());
|
||||
if(direction == Direction.SOUTH)
|
||||
return level.getBlockEntity(this.getBlockPos().south());
|
||||
if(direction == Direction.WEST)
|
||||
return level.getBlockEntity(this.getBlockPos().west());
|
||||
if(direction == Direction.EAST)
|
||||
return level.getBlockEntity(this.getBlockPos().east());
|
||||
|
||||
return this;
|
||||
}
|
||||
@Override
|
||||
public void tick() {
|
||||
super.tick();
|
||||
if (syncCooldown > 0) {
|
||||
syncCooldown--;
|
||||
if (syncCooldown == 0 && queuedSync)
|
||||
sendData();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void initialize() {
|
||||
super.initialize();
|
||||
sendData();
|
||||
if (level.isClientSide)
|
||||
invalidateRenderBoundingBox();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void sendData() {
|
||||
if (syncCooldown > 0) {
|
||||
queuedSync = true;
|
||||
return;
|
||||
}
|
||||
super.sendData();
|
||||
queuedSync = false;
|
||||
syncCooldown = SYNC_RATE;
|
||||
}
|
||||
|
||||
|
||||
private void refreshCapability() {
|
||||
LazyOptional<IFluidHandler> oldCap = fluidCapability;
|
||||
fluidCapability = LazyOptional.of(() -> handlerForCapability());
|
||||
oldCap.invalidate();
|
||||
}
|
||||
|
||||
private IFluidHandler handlerForCapability() {
|
||||
|
||||
return tankInventory;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
protected void read(CompoundTag compound, boolean clientPacket) {
|
||||
super.read(compound, clientPacket);
|
||||
|
||||
tankInventory.setCapacity(500);
|
||||
tankInventory.readFromNBT(compound.getCompound("TankContent"));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void write(CompoundTag compound, boolean clientPacket) {
|
||||
|
||||
compound.put("TankContent", tankInventory.writeToNBT(new CompoundTag()));
|
||||
super.write(compound, clientPacket);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public <T> LazyOptional<T> getCapability(@Nonnull Capability<T> cap, @Nullable Direction side) {
|
||||
if (!fluidCapability.isPresent())
|
||||
refreshCapability();
|
||||
if (cap == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY)
|
||||
return fluidCapability.cast();
|
||||
return super.getCapability(cap, side);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void addBehaviours(List<BlockEntityBehaviour> behaviours) {
|
||||
|
||||
}
|
||||
|
||||
public IFluidTank getTankInventory() {
|
||||
return tankInventory;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.drmangotea.tfmg.blocks.engines.small;
|
||||
|
||||
|
||||
|
||||
import com.drmangotea.tfmg.registry.TFMGShapes;
|
||||
import com.simibubi.create.content.equipment.wrench.IWrenchable;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.item.context.BlockPlaceContext;
|
||||
import net.minecraft.world.level.BlockGetter;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.DirectionalBlock;
|
||||
import net.minecraft.world.level.block.Mirror;
|
||||
import net.minecraft.world.level.block.Rotation;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.block.state.StateDefinition;
|
||||
import net.minecraft.world.phys.shapes.CollisionContext;
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
|
||||
abstract public class EngineBackPartBlock extends DirectionalBlock implements IWrenchable {
|
||||
public EngineBackPartBlock(Properties p_52591_) {
|
||||
super(p_52591_);
|
||||
this.registerDefaultState(this.stateDefinition.any().setValue(FACING, Direction.SOUTH));
|
||||
}
|
||||
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> p_55125_) {
|
||||
p_55125_.add(FACING);
|
||||
}
|
||||
@Override
|
||||
public VoxelShape getShape(BlockState pState, BlockGetter worldIn, BlockPos pos, CollisionContext context) {
|
||||
|
||||
if(pState.getValue(FACING).getAxis()== Direction.Axis.Y) {
|
||||
return TFMGShapes.ENGINE_BACK_VERTICAL.get(pState.getValue(FACING));
|
||||
}else
|
||||
return TFMGShapes.ENGINE_BACK.get(pState.getValue(FACING));
|
||||
}
|
||||
public BlockState rotate(BlockState p_55115_, Rotation p_55116_) {
|
||||
return p_55115_.setValue(FACING, p_55116_.rotate(p_55115_.getValue(FACING)));
|
||||
}
|
||||
|
||||
public BlockState mirror(BlockState p_55112_, Mirror p_55113_) {
|
||||
return p_55112_.rotate(p_55113_.getRotation(p_55112_.getValue(FACING)));
|
||||
}
|
||||
public BlockState getStateForPlacement(BlockPlaceContext p_55087_) {
|
||||
return this.defaultBlockState().setValue(FACING, p_55087_.getNearestLookingDirection().getOpposite().getOpposite());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.drmangotea.tfmg.blocks.engines.small;
|
||||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.simibubi.create.foundation.blockEntity.renderer.SafeBlockEntityRenderer;
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
|
||||
|
||||
public class EngineBackRenderer extends SafeBlockEntityRenderer<EngineBackBlockEntity> {
|
||||
|
||||
public EngineBackRenderer(BlockEntityRendererProvider.Context context) {}
|
||||
|
||||
|
||||
@Override
|
||||
protected void renderSafe(EngineBackBlockEntity te, float partialTicks, PoseStack ms, MultiBufferSource bufferSource, int light, int overlay) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
package com.drmangotea.tfmg.blocks.engines.small;
|
||||
|
||||
|
||||
import com.drmangotea.createindustry.registry.CIShapes;
|
||||
import com.simibubi.create.content.kinetics.base.DirectionalKineticBlock;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.Direction.Axis;
|
||||
import net.minecraft.world.item.context.BlockPlaceContext;
|
||||
import net.minecraft.world.level.BlockGetter;
|
||||
import net.minecraft.world.level.LevelReader;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.pathfinder.PathComputationType;
|
||||
import net.minecraft.world.phys.shapes.CollisionContext;
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
|
||||
abstract public class EngineBlock extends DirectionalKineticBlock {
|
||||
|
||||
|
||||
public EngineBlock(Properties properties) {
|
||||
super(properties);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
@Override
|
||||
public VoxelShape getShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context) {
|
||||
return AllShapes.MOTOR_BLOCK.get(state.getValue(FACING));
|
||||
}
|
||||
|
||||
*/ @Override
|
||||
public VoxelShape getShape(BlockState pState, BlockGetter worldIn, BlockPos pos, CollisionContext context) {
|
||||
|
||||
if(pState.getValue(FACING).getAxis()==Axis.Y) {
|
||||
return CIShapes.ENGINE_VERTICAL.get(pState.getValue(FACING));
|
||||
}else
|
||||
return CIShapes.ENGINE.get(pState.getValue(FACING));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public BlockState getStateForPlacement(BlockPlaceContext context) {
|
||||
Direction preferred = getPreferredFacing(context);
|
||||
if ((context.getPlayer() != null && context.getPlayer()
|
||||
.isShiftKeyDown()) || preferred == null)
|
||||
return super.getStateForPlacement(context);
|
||||
return defaultBlockState()
|
||||
.setValue(FACING, preferred)
|
||||
//.setValue(BACK_PART,false)
|
||||
;
|
||||
}
|
||||
|
||||
// IRotate:
|
||||
|
||||
@Override
|
||||
public boolean hasShaftTowards(LevelReader world, BlockPos pos, BlockState state, Direction face) {
|
||||
return face == state.getValue(FACING);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Axis getRotationAxis(BlockState state) {
|
||||
return state.getValue(FACING)
|
||||
.getAxis();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hideStressImpact() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPathfindable(BlockState state, BlockGetter reader, BlockPos pos, PathComputationType type) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.drmangotea.tfmg.blocks.engines.small;
|
||||
|
||||
import com.simibubi.create.AllPartialModels;
|
||||
import com.simibubi.create.content.kinetics.base.KineticBlockEntityRenderer;
|
||||
import com.simibubi.create.foundation.render.CachedBufferer;
|
||||
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
||||
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
|
||||
public class UniversalEngineRenderer extends KineticBlockEntityRenderer<AbstractEngineTileEntity> {
|
||||
|
||||
public UniversalEngineRenderer(BlockEntityRendererProvider.Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SuperByteBuffer getRotatedModel(AbstractEngineTileEntity be, BlockState state) {
|
||||
return CachedBufferer.partialFacing(AllPartialModels.SHAFT_HALF, state);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.drmangotea.tfmg.blocks.engines.small.gasoline;
|
||||
|
||||
|
||||
import com.drmangotea.tfmg.blocks.engines.small.EngineBackPartBlock;
|
||||
import com.drmangotea.tfmg.registry.TFMGBlockEntities;
|
||||
import com.simibubi.create.foundation.block.IBE;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
|
||||
public class GasolineEngineBackBlock extends EngineBackPartBlock implements IBE<GasolineEngineBackTileEntity> {
|
||||
public GasolineEngineBackBlock(Properties properties) {
|
||||
super(properties);
|
||||
|
||||
}
|
||||
@Override
|
||||
public Class<GasolineEngineBackTileEntity> getBlockEntityClass() {
|
||||
return GasolineEngineBackTileEntity.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockEntityType<GasolineEngineBackTileEntity> getBlockEntityType() {
|
||||
return TFMGBlockEntities.GASOLINE_ENGINE_BACK.get();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.drmangotea.tfmg.blocks.engines.small.gasoline;
|
||||
|
||||
|
||||
|
||||
import com.drmangotea.tfmg.blocks.engines.small.EngineBackBlockEntity;
|
||||
import com.simibubi.create.content.equipment.goggles.IHaveGoggleInformation;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
|
||||
public class GasolineEngineBackTileEntity extends EngineBackBlockEntity implements IHaveGoggleInformation {
|
||||
|
||||
|
||||
public GasolineEngineBackTileEntity(BlockEntityType<?> type, BlockPos pos, BlockState state) {
|
||||
super(type, pos, state);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.drmangotea.tfmg.blocks.engines.small.gasoline;
|
||||
|
||||
|
||||
import com.drmangotea.tfmg.blocks.engines.small.EngineBlock;
|
||||
import com.drmangotea.tfmg.registry.TFMGBlockEntities;
|
||||
import com.simibubi.create.foundation.block.IBE;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
|
||||
public class GasolineEngineBlock extends EngineBlock implements IBE<GasolineEngineTileEntity> {
|
||||
public GasolineEngineBlock(Properties properties) {
|
||||
super(properties);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Class<GasolineEngineTileEntity> getBlockEntityClass() {
|
||||
return GasolineEngineTileEntity.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockEntityType<GasolineEngineTileEntity> getBlockEntityType() {
|
||||
return TFMGBlockEntities.GASOLINE_ENGINE.get();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.drmangotea.tfmg.blocks.engines.small.gasoline;
|
||||
|
||||
import com.drmangotea.createindustry.content.blocks.engines.EngineBlock;
|
||||
import com.simibubi.create.foundation.data.AssetLookup;
|
||||
import com.simibubi.create.foundation.data.SpecialBlockStateGen;
|
||||
import com.tterrag.registrate.providers.DataGenContext;
|
||||
import com.tterrag.registrate.providers.RegistrateBlockstateProvider;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraftforge.client.model.generators.ModelFile;
|
||||
|
||||
;
|
||||
|
||||
public class GasolineEngineGenerator extends SpecialBlockStateGen {
|
||||
|
||||
@Override
|
||||
protected int getXRotation(BlockState state) {
|
||||
return state.getValue(EngineBlock.FACING) == Direction.DOWN ? 180 : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getYRotation(BlockState state) {
|
||||
return state.getValue(EngineBlock.FACING)
|
||||
.getAxis()
|
||||
.isVertical() ? 0 : horizontalAngle(state.getValue(EngineBlock.FACING));
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends Block> ModelFile getModel(DataGenContext<Block, T> ctx, RegistrateBlockstateProvider prov,
|
||||
BlockState state) {
|
||||
return state.getValue(EngineBlock.FACING)
|
||||
.getAxis()
|
||||
.isVertical() ? AssetLookup.partialBaseModel(ctx, prov, "vertical")
|
||||
: AssetLookup.partialBaseModel(ctx, prov);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.drmangotea.tfmg.blocks.engines.small.gasoline;
|
||||
|
||||
|
||||
import com.drmangotea.tfmg.blocks.engines.small.AbstractEngineTileEntity;
|
||||
import com.drmangotea.tfmg.registry.TFMGFluids;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.material.Fluid;
|
||||
|
||||
public class GasolineEngineTileEntity extends AbstractEngineTileEntity {
|
||||
|
||||
|
||||
public GasolineEngineTileEntity(BlockEntityType<?> type, BlockPos pos, BlockState state) {
|
||||
super(type, pos, state);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Fluid validFuel() {
|
||||
return TFMGFluids.GASOLINE.getSource();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.drmangotea.tfmg.blocks.engines.small.lpg;
|
||||
|
||||
|
||||
import com.drmangotea.tfmg.blocks.engines.small.EngineBackPartBlock;
|
||||
import com.drmangotea.tfmg.registry.TFMGBlockEntities;
|
||||
import com.simibubi.create.foundation.block.IBE;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
|
||||
public class LPGEngineBackBlock extends EngineBackPartBlock implements IBE<LPGEngineBackTileEntity> {
|
||||
public LPGEngineBackBlock(Properties properties) {
|
||||
super(properties);
|
||||
|
||||
}
|
||||
@Override
|
||||
public Class<LPGEngineBackTileEntity> getBlockEntityClass() {
|
||||
return LPGEngineBackTileEntity.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockEntityType<LPGEngineBackTileEntity> getBlockEntityType() {
|
||||
return TFMGBlockEntities.LPG_ENGINE_BACK.get();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.drmangotea.tfmg.blocks.engines.small.lpg;
|
||||
|
||||
|
||||
import com.drmangotea.tfmg.blocks.engines.small.EngineBackBlockEntity;
|
||||
import com.simibubi.create.content.equipment.goggles.IHaveGoggleInformation;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
|
||||
public class LPGEngineBackTileEntity extends EngineBackBlockEntity implements IHaveGoggleInformation {
|
||||
|
||||
|
||||
public LPGEngineBackTileEntity(BlockEntityType<?> type, BlockPos pos, BlockState state) {
|
||||
super(type, pos, state);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
super.tick();
|
||||
if (syncCooldown > 0) {
|
||||
syncCooldown--;
|
||||
if (syncCooldown == 0 && queuedSync)
|
||||
sendData();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.drmangotea.tfmg.blocks.engines.small.lpg;
|
||||
|
||||
|
||||
import com.drmangotea.tfmg.blocks.engines.small.EngineBlock;
|
||||
import com.drmangotea.tfmg.registry.TFMGBlockEntities;
|
||||
import com.simibubi.create.foundation.block.IBE;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
|
||||
public class LPGEngineBlock extends EngineBlock implements IBE<LPGEngineTileEntity> {
|
||||
public LPGEngineBlock(Properties properties) {
|
||||
super(properties);
|
||||
|
||||
}
|
||||
@Override
|
||||
public Class<LPGEngineTileEntity> getBlockEntityClass() {
|
||||
return LPGEngineTileEntity.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockEntityType<LPGEngineTileEntity> getBlockEntityType() {
|
||||
return TFMGBlockEntities.LPG_ENGINE.get();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.drmangotea.tfmg.blocks.engines.small.lpg;
|
||||
|
||||
|
||||
import com.drmangotea.tfmg.blocks.engines.small.AbstractEngineTileEntity;
|
||||
import com.drmangotea.tfmg.registry.TFMGBlocks;
|
||||
import com.drmangotea.tfmg.registry.TFMGFluids;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.level.block.DirectionalBlock;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.material.Fluid;
|
||||
|
||||
public class LPGEngineTileEntity extends AbstractEngineTileEntity {
|
||||
|
||||
|
||||
public LPGEngineTileEntity(BlockEntityType<?> type, BlockPos pos, BlockState state) {
|
||||
super(type, pos, state);
|
||||
|
||||
}
|
||||
@Override
|
||||
public boolean hasBackPart(){
|
||||
BlockPos wantedLocation=this.getBlockPos();
|
||||
Direction direction = this.getBlockState().getValue(DirectionalBlock.FACING);
|
||||
|
||||
|
||||
if(direction == Direction.UP)
|
||||
wantedLocation=this.getBlockPos().below();
|
||||
if(direction == Direction.DOWN)
|
||||
wantedLocation=this.getBlockPos().above();
|
||||
if(direction == Direction.NORTH)
|
||||
wantedLocation=this.getBlockPos().south();
|
||||
if(direction == Direction.SOUTH)
|
||||
wantedLocation=this.getBlockPos().north();
|
||||
if(direction == Direction.WEST)
|
||||
wantedLocation=this.getBlockPos().east();
|
||||
if(direction == Direction.EAST)
|
||||
wantedLocation=this.getBlockPos().west();
|
||||
|
||||
|
||||
|
||||
if(!level.getBlockState(wantedLocation).is(TFMGBlocks.LPG_ENGINE_BACK.get())) {
|
||||
return false;
|
||||
}else {
|
||||
if ( level.getBlockState(wantedLocation).getValue(DirectionalBlock.FACING) != direction)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public Fluid validFuel() {
|
||||
return TFMGFluids.LPG.getSource();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.drmangotea.tfmg.blocks.engines.small.turbine;
|
||||
|
||||
|
||||
import com.drmangotea.tfmg.blocks.engines.small.EngineBackPartBlock;
|
||||
import com.drmangotea.tfmg.registry.TFMGBlockEntities;
|
||||
import com.simibubi.create.foundation.block.IBE;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
|
||||
public class TurbineEngineBackBlock extends EngineBackPartBlock implements IBE<TurbineEngineBackTileEntity> {
|
||||
public TurbineEngineBackBlock(Properties properties) {
|
||||
super(properties);
|
||||
|
||||
}
|
||||
@Override
|
||||
public Class<TurbineEngineBackTileEntity> getBlockEntityClass() {
|
||||
return TurbineEngineBackTileEntity.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockEntityType<TurbineEngineBackTileEntity> getBlockEntityType() {
|
||||
return TFMGBlockEntities.TURBINE_ENGINE_BACK.get();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.drmangotea.tfmg.blocks.engines.small.turbine;
|
||||
|
||||
|
||||
import com.drmangotea.tfmg.blocks.engines.small.EngineBackBlockEntity;
|
||||
import com.simibubi.create.content.equipment.goggles.IHaveGoggleInformation;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
|
||||
public class TurbineEngineBackTileEntity extends EngineBackBlockEntity implements IHaveGoggleInformation {
|
||||
|
||||
|
||||
public TurbineEngineBackTileEntity(BlockEntityType<?> type, BlockPos pos, BlockState state) {
|
||||
super(type, pos, state);
|
||||
}
|
||||
@Override
|
||||
public void tick() {
|
||||
super.tick();
|
||||
if (syncCooldown > 0) {
|
||||
syncCooldown--;
|
||||
if (syncCooldown == 0 && queuedSync)
|
||||
sendData();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.drmangotea.tfmg.blocks.engines.small.turbine;
|
||||
|
||||
|
||||
import com.drmangotea.tfmg.blocks.engines.small.EngineBlock;
|
||||
import com.drmangotea.tfmg.registry.TFMGBlockEntities;
|
||||
import com.simibubi.create.foundation.block.IBE;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
|
||||
public class TurbineEngineBlock extends EngineBlock implements IBE<TurbineEngineTileEntity> {
|
||||
public TurbineEngineBlock(Properties properties) {
|
||||
super(properties);
|
||||
|
||||
}
|
||||
@Override
|
||||
public Class<TurbineEngineTileEntity> getBlockEntityClass() {
|
||||
return TurbineEngineTileEntity.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockEntityType<TurbineEngineTileEntity> getBlockEntityType() {
|
||||
return TFMGBlockEntities.TURBINE_ENGINE.get();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.drmangotea.tfmg.blocks.engines.small.turbine;
|
||||
|
||||
|
||||
import com.drmangotea.tfmg.blocks.engines.small.AbstractEngineTileEntity;
|
||||
import com.drmangotea.tfmg.registry.TFMGBlocks;
|
||||
import com.drmangotea.tfmg.registry.TFMGFluids;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.level.block.DirectionalBlock;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.material.Fluid;
|
||||
|
||||
public class TurbineEngineTileEntity extends AbstractEngineTileEntity {
|
||||
|
||||
|
||||
public TurbineEngineTileEntity(BlockEntityType<?> type, BlockPos pos, BlockState state) {
|
||||
super(type, pos, state);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasBackPart(){
|
||||
BlockPos wantedLocation=this.getBlockPos();
|
||||
Direction direction = this.getBlockState().getValue(DirectionalBlock.FACING);
|
||||
|
||||
|
||||
if(direction == Direction.UP)
|
||||
wantedLocation=this.getBlockPos().below();
|
||||
if(direction == Direction.DOWN)
|
||||
wantedLocation=this.getBlockPos().above();
|
||||
if(direction == Direction.NORTH)
|
||||
wantedLocation=this.getBlockPos().south();
|
||||
if(direction == Direction.SOUTH)
|
||||
wantedLocation=this.getBlockPos().north();
|
||||
if(direction == Direction.WEST)
|
||||
wantedLocation=this.getBlockPos().east();
|
||||
if(direction == Direction.EAST)
|
||||
wantedLocation=this.getBlockPos().west();
|
||||
|
||||
|
||||
|
||||
if(!level.getBlockState(wantedLocation).is(TFMGBlocks.TURBINE_ENGINE_BACK.get())) {
|
||||
return false;
|
||||
}else {
|
||||
if ( level.getBlockState(wantedLocation).getValue(DirectionalBlock.FACING) != direction)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public Fluid validFuel() {
|
||||
return TFMGFluids.KEROSENE.getSource();
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
package com.drmangotea.tfmg.blocks.gadgets.explosives.thermite_grenades;
|
||||
|
||||
public enum ChemicalColor {
|
||||
BASE,
|
||||
GREEN,
|
||||
BLUE
|
||||
}
|
||||
@@ -260,41 +260,7 @@ public class BlastFurnaceOutputBlockEntity extends TFMGMachineBlockEntity implem
|
||||
level.setBlock(posToSpawn3.above(), TFMGBlocks.MOLTEN_METAL.getDefaultState(),3);
|
||||
|
||||
}
|
||||
// if (timer<=0) {
|
||||
// posToSpawn = this.getBlockPos().relative(outputFacing.getOpposite()).above();
|
||||
// posToSpawn1 = this.getBlockPos().relative(outputFacing.getOpposite(),2).above();
|
||||
// posToSpawn2 = this.getBlockPos().relative(outputFacing.getOpposite()).above().relative(outputFacing.getClockWise());
|
||||
// posToSpawn3 = this.getBlockPos().relative(outputFacing.getOpposite(),2).above().relative(outputFacing.getClockWise());
|
||||
// posToSpawn4 = this.getBlockPos().relative(outputFacing.getOpposite()).above().relative(outputFacing.getCounterClockWise());
|
||||
// posToSpawn5 = this.getBlockPos().relative(outputFacing.getOpposite(),2).above().relative(outputFacing.getCounterClockWise());
|
||||
// if(level.getBlockState(posToSpawn).is(TFMGBlocks.MOLTEN_METAL.get()))
|
||||
// level.setBlock(posToSpawn, Blocks.AIR.defaultBlockState(),3);
|
||||
// if(level.getBlockState(posToSpawn1).is(TFMGBlocks.MOLTEN_METAL.get()))
|
||||
// level.setBlock(posToSpawn1, Blocks.AIR.defaultBlockState(),3);
|
||||
// if(level.getBlockState(posToSpawn2).is(TFMGBlocks.MOLTEN_METAL.get()))
|
||||
// level.setBlock(posToSpawn2, Blocks.AIR.defaultBlockState(),3);
|
||||
// if(level.getBlockState(posToSpawn3).is(TFMGBlocks.MOLTEN_METAL.get()))
|
||||
// level.setBlock(posToSpawn3, Blocks.AIR.defaultBlockState(),3);
|
||||
// if(level.getBlockState(posToSpawn4).is(TFMGBlocks.MOLTEN_METAL.get()))
|
||||
// level.setBlock(posToSpawn4, Blocks.AIR.defaultBlockState(),3);
|
||||
// if(level.getBlockState(posToSpawn5).is(TFMGBlocks.MOLTEN_METAL.get()))
|
||||
// level.setBlock(posToSpawn5, Blocks.AIR.defaultBlockState(),3);
|
||||
//
|
||||
// if(level.getBlockState(posToSpawn.above()).is(TFMGBlocks.MOLTEN_METAL.get()))
|
||||
// level.setBlock(posToSpawn.above(), Blocks.AIR.defaultBlockState(),3);
|
||||
// if(level.getBlockState(posToSpawn1.above()).is(TFMGBlocks.MOLTEN_METAL.get()))
|
||||
// level.setBlock(posToSpawn1.above(), Blocks.AIR.defaultBlockState(),3);
|
||||
// if(level.getBlockState(posToSpawn2.above()).is(TFMGBlocks.MOLTEN_METAL.get()))
|
||||
// level.setBlock(posToSpawn2.above(), Blocks.AIR.defaultBlockState(),3);
|
||||
// if(level.getBlockState(posToSpawn3.above()).is(TFMGBlocks.MOLTEN_METAL.get()))
|
||||
// level.setBlock(posToSpawn3.above(), Blocks.AIR.defaultBlockState(),3);
|
||||
// if(level.getBlockState(posToSpawn4.above()).is(TFMGBlocks.MOLTEN_METAL.get()))
|
||||
// level.setBlock(posToSpawn4.above(), Blocks.AIR.defaultBlockState(),3);
|
||||
// if(level.getBlockState(posToSpawn5.above()).is(TFMGBlocks.MOLTEN_METAL.get()))
|
||||
// level.setBlock(posToSpawn5.above(), Blocks.AIR.defaultBlockState(),3);
|
||||
|
||||
|
||||
// }
|
||||
}
|
||||
@Override
|
||||
protected AABB createRenderBoundingBox() {
|
||||
@@ -310,13 +276,6 @@ public class BlastFurnaceOutputBlockEntity extends TFMGMachineBlockEntity implem
|
||||
|
||||
if (level.isClientSide)
|
||||
return;
|
||||
// RecipeWrapper inventoryIn = new RecipeWrapper(inputInventory);
|
||||
// if (recipe == null || !recipe.matches(inventoryIn, level)) {
|
||||
// Optional<IndustrialBlastingRecipe> recipe = TFMGRecipeTypes.INDUSTRIAL_BLASTING.find(inventoryIn, level);
|
||||
// if (!recipe.isPresent())
|
||||
// return;
|
||||
// this.recipe = recipe.get();
|
||||
// }
|
||||
|
||||
tank1.getPrimaryHandler().setFluid(new FluidStack(recipe.getFluidResults().get(0).getFluid(), tank1.getPrimaryHandler().getFluidAmount()+recipe.getFluidResults().get(0).getAmount()));
|
||||
tank2.getPrimaryHandler().setFluid(new FluidStack(recipe.getFluidResults().get(1).getFluid(), tank2.getPrimaryHandler().getFluidAmount()+recipe.getFluidResults().get(1).getAmount()));
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.drmangotea.tfmg.blocks.gadgets.explosives.napalm;
|
||||
package com.drmangotea.tfmg.items.gadgets.explosives.napalm;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.sounds.SoundEvents;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.drmangotea.tfmg.blocks.gadgets.explosives.napalm;
|
||||
package com.drmangotea.tfmg.items.gadgets.explosives.napalm;
|
||||
|
||||
|
||||
import com.drmangotea.tfmg.base.spark.Spark;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.drmangotea.tfmg.blocks.gadgets.explosives.napalm;
|
||||
package com.drmangotea.tfmg.items.gadgets.explosives.napalm;
|
||||
|
||||
import com.drmangotea.tfmg.registry.TFMGBlocks;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.drmangotea.tfmg.items.gadgets.explosives.thermite_grenades;
|
||||
|
||||
public enum ChemicalColor {
|
||||
BASE,
|
||||
GREEN,
|
||||
BLUE
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.drmangotea.tfmg.blocks.gadgets.explosives.thermite_grenades;
|
||||
package com.drmangotea.tfmg.items.gadgets.explosives.thermite_grenades;
|
||||
|
||||
|
||||
import com.drmangotea.tfmg.base.spark.BlueSpark;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.drmangotea.tfmg.blocks.gadgets.explosives.thermite_grenades;
|
||||
package com.drmangotea.tfmg.items.gadgets.explosives.thermite_grenades;
|
||||
|
||||
import com.drmangotea.tfmg.registry.TFMGEntityTypes;
|
||||
import net.minecraft.sounds.SoundEvents;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.drmangotea.tfmg.blocks.gadgets.explosives.thermite_grenades;
|
||||
package com.drmangotea.tfmg.items.gadgets.explosives.thermite_grenades;
|
||||
|
||||
|
||||
import com.drmangotea.tfmg.registry.TFMGItems;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.drmangotea.tfmg.blocks.gadgets.explosives.thermite_grenades.fire;
|
||||
package com.drmangotea.tfmg.items.gadgets.explosives.thermite_grenades.fire;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import it.unimi.dsi.fastutil.objects.Object2IntMap;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.drmangotea.tfmg.blocks.gadgets.explosives.thermite_grenades.fire;
|
||||
package com.drmangotea.tfmg.items.gadgets.explosives.thermite_grenades.fire;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import it.unimi.dsi.fastutil.objects.Object2IntMap;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.drmangotea.tfmg.blocks.gadgets.explosives.thermite_grenades.fire;
|
||||
package com.drmangotea.tfmg.items.gadgets.explosives.thermite_grenades.fire;
|
||||
|
||||
import com.drmangotea.tfmg.CreateTFMG;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.drmangotea.tfmg.blocks.gadgets.quad_potato_cannon;
|
||||
package com.drmangotea.tfmg.items.gadgets.quad_potato_cannon;
|
||||
|
||||
|
||||
import com.drmangotea.tfmg.CreateTFMGClient;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.drmangotea.tfmg.blocks.gadgets.quad_potato_cannon;
|
||||
package com.drmangotea.tfmg.items.gadgets.quad_potato_cannon;
|
||||
|
||||
|
||||
import com.drmangotea.tfmg.CreateTFMGClient;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.drmangotea.tfmg.blocks.gadgets.quad_potato_cannon;
|
||||
package com.drmangotea.tfmg.items.gadgets.quad_potato_cannon;
|
||||
|
||||
|
||||
import com.drmangotea.tfmg.registry.TFMGItems;
|
||||
@@ -7,6 +7,18 @@ import com.drmangotea.tfmg.blocks.decoration.doors.TFMGSlidingDoorRenderer;
|
||||
import com.drmangotea.tfmg.blocks.deposits.FluidDepositBlockEntity;
|
||||
import com.drmangotea.tfmg.blocks.deposits.surface_scanner.SurfaceScannerBlockEntity;
|
||||
import com.drmangotea.tfmg.blocks.deposits.surface_scanner.SurfaceScannerRenderer;
|
||||
import com.drmangotea.tfmg.blocks.engines.diesel.DieselEngineBlockEntity;
|
||||
import com.drmangotea.tfmg.blocks.engines.diesel.DieselEngineInstance;
|
||||
import com.drmangotea.tfmg.blocks.engines.diesel.DieselEngineRenderer;
|
||||
import com.drmangotea.tfmg.blocks.engines.intake.AirIntakeBlockEntity;
|
||||
import com.drmangotea.tfmg.blocks.engines.intake.AirIntakeInstance;
|
||||
import com.drmangotea.tfmg.blocks.engines.intake.AirIntakeRenderer;
|
||||
import com.drmangotea.tfmg.blocks.engines.small.gasoline.GasolineEngineBackTileEntity;
|
||||
import com.drmangotea.tfmg.blocks.engines.small.gasoline.GasolineEngineTileEntity;
|
||||
import com.drmangotea.tfmg.blocks.engines.small.lpg.LPGEngineBackTileEntity;
|
||||
import com.drmangotea.tfmg.blocks.engines.small.lpg.LPGEngineTileEntity;
|
||||
import com.drmangotea.tfmg.blocks.engines.small.turbine.TurbineEngineBackTileEntity;
|
||||
import com.drmangotea.tfmg.blocks.engines.small.turbine.TurbineEngineTileEntity;
|
||||
import com.drmangotea.tfmg.blocks.machines.metal_processing.blast_furnace.BlastFurnaceOutputBlockEntity;
|
||||
import com.drmangotea.tfmg.blocks.machines.metal_processing.blast_furnace.BlastFurnaceRenderer;
|
||||
import com.drmangotea.tfmg.blocks.machines.metal_processing.blast_furnace.MoltenMetalBlockEntity;
|
||||
@@ -32,6 +44,7 @@ import com.drmangotea.tfmg.blocks.machines.oil_processing.pumpjack.machine_input
|
||||
import com.drmangotea.tfmg.blocks.pipes.normal.LockablePipeBlockEntity;
|
||||
import com.drmangotea.tfmg.blocks.tanks.SteelFluidTankRenderer;
|
||||
import com.drmangotea.tfmg.blocks.tanks.SteelTankBlockEntity;
|
||||
import com.drmangotea.tfmg.blocks.engines.small.UniversalEngineRenderer;
|
||||
import com.simibubi.create.content.fluids.pipes.SmartFluidPipeBlockEntity;
|
||||
import com.simibubi.create.content.fluids.pipes.StraightPipeBlockEntity;
|
||||
import com.simibubi.create.content.fluids.pipes.TransparentStraightPipeRenderer;
|
||||
@@ -198,6 +211,55 @@ public class TFMGBlockEntities {
|
||||
.validBlocks(TFMGBlocks.CASTING_SPOUT)
|
||||
.register();
|
||||
|
||||
public static final BlockEntityEntry<AirIntakeBlockEntity> AIR_INTAKE = REGISTRATE
|
||||
.blockEntity("air_intake", AirIntakeBlockEntity::new)
|
||||
.instance(() -> AirIntakeInstance::new, true)
|
||||
.renderer(()-> AirIntakeRenderer::new)
|
||||
.validBlocks(TFMGBlocks.AIR_INTAKE)
|
||||
.register();
|
||||
public static final BlockEntityEntry<DieselEngineBlockEntity> DIESEL_ENGINE = REGISTRATE
|
||||
.blockEntity("diesel_engine", DieselEngineBlockEntity::new)
|
||||
.instance(() -> DieselEngineInstance::new, false)
|
||||
.validBlocks(TFMGBlocks.DIESEL_ENGINE)
|
||||
.renderer(() -> DieselEngineRenderer::new)
|
||||
.register();
|
||||
|
||||
public static final BlockEntityEntry<GasolineEngineTileEntity> GASOLINE_ENGINE = REGISTRATE
|
||||
.blockEntity("gasoline_engine", GasolineEngineTileEntity::new)
|
||||
.instance(() -> HalfShaftInstance::new, false)
|
||||
.validBlocks(TFMGBlocks.GASOLINE_ENGINE)
|
||||
.renderer(() -> UniversalEngineRenderer::new)
|
||||
.register();
|
||||
|
||||
public static final BlockEntityEntry<GasolineEngineBackTileEntity> GASOLINE_ENGINE_BACK = REGISTRATE
|
||||
.blockEntity("gasoline_engine_back", GasolineEngineBackTileEntity::new)
|
||||
.validBlocks(TFMGBlocks.GASOLINE_ENGINE_BACK)
|
||||
.register();
|
||||
|
||||
public static final BlockEntityEntry<LPGEngineTileEntity> LPG_ENGINE = REGISTRATE
|
||||
.blockEntity("lpg_engine", LPGEngineTileEntity::new)
|
||||
.instance(() -> HalfShaftInstance::new, false)
|
||||
.validBlocks(TFMGBlocks.LPG_ENGINE)
|
||||
.renderer(() -> UniversalEngineRenderer::new)
|
||||
.register();
|
||||
public static final BlockEntityEntry<LPGEngineBackTileEntity> LPG_ENGINE_BACK = REGISTRATE
|
||||
.blockEntity("lpg_engine_back", LPGEngineBackTileEntity::new)
|
||||
.validBlocks(TFMGBlocks.LPG_ENGINE_BACK)
|
||||
.register();
|
||||
|
||||
public static final BlockEntityEntry<TurbineEngineTileEntity> TURBINE_ENGINE = REGISTRATE
|
||||
.blockEntity("turbine_engine", TurbineEngineTileEntity::new)
|
||||
.instance(() -> HalfShaftInstance::new, false)
|
||||
.validBlocks(TFMGBlocks.TURBINE_ENGINE)
|
||||
.renderer(() -> UniversalEngineRenderer::new)
|
||||
.register();
|
||||
public static final BlockEntityEntry<TurbineEngineBackTileEntity> TURBINE_ENGINE_BACK = REGISTRATE
|
||||
.blockEntity("turbine_engine_back", TurbineEngineBackTileEntity::new)
|
||||
.validBlocks(TFMGBlocks.TURBINE_ENGINE_BACK)
|
||||
.register();
|
||||
|
||||
|
||||
|
||||
|
||||
public static void register() {}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,17 @@ import com.drmangotea.tfmg.blocks.concrete.formwork.FormWorkBlock;
|
||||
import com.drmangotea.tfmg.blocks.concrete.formwork.FormWorkGenerator;
|
||||
import com.drmangotea.tfmg.blocks.decoration.doors.TFMGSlidingDoorBlock;
|
||||
import com.drmangotea.tfmg.blocks.deposits.FluidDepositBlock;
|
||||
import com.drmangotea.tfmg.blocks.gadgets.explosives.napalm.NapalmBombBlock;
|
||||
import com.drmangotea.tfmg.blocks.engines.diesel.DieselEngineBlock;
|
||||
import com.drmangotea.tfmg.blocks.engines.intake.AirIntakeBlock;
|
||||
import com.drmangotea.tfmg.blocks.engines.intake.AirIntakeGenerator;
|
||||
import com.drmangotea.tfmg.blocks.engines.small.gasoline.GasolineEngineBackBlock;
|
||||
import com.drmangotea.tfmg.blocks.engines.small.gasoline.GasolineEngineBlock;
|
||||
import com.drmangotea.tfmg.blocks.engines.small.gasoline.GasolineEngineGenerator;
|
||||
import com.drmangotea.tfmg.blocks.engines.small.lpg.LPGEngineBackBlock;
|
||||
import com.drmangotea.tfmg.blocks.engines.small.lpg.LPGEngineBlock;
|
||||
import com.drmangotea.tfmg.blocks.engines.small.turbine.TurbineEngineBackBlock;
|
||||
import com.drmangotea.tfmg.blocks.engines.small.turbine.TurbineEngineBlock;
|
||||
import com.drmangotea.tfmg.items.gadgets.explosives.napalm.NapalmBombBlock;
|
||||
import com.drmangotea.tfmg.blocks.machines.metal_processing.casting_basin.CastingBasinBlock;
|
||||
import com.drmangotea.tfmg.blocks.machines.metal_processing.casting_spout.CastingSpoutBlock;
|
||||
import com.drmangotea.tfmg.items.CoalCokeBlockItem;
|
||||
@@ -37,7 +47,9 @@ import com.drmangotea.tfmg.blocks.tanks.SteelTankBlock;
|
||||
import com.drmangotea.tfmg.blocks.tanks.SteelTankGenerator;
|
||||
import com.drmangotea.tfmg.blocks.tanks.SteelTankItem;
|
||||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.AllItems;
|
||||
import com.simibubi.create.AllSpriteShifts;
|
||||
import com.simibubi.create.AllTags;
|
||||
import com.simibubi.create.content.decoration.encasing.CasingBlock;
|
||||
import com.simibubi.create.content.decoration.encasing.EncasedCTBehaviour;
|
||||
import com.simibubi.create.content.decoration.encasing.EncasingRegistry;
|
||||
@@ -47,14 +59,13 @@ import com.simibubi.create.content.fluids.pipes.valve.FluidValveBlock;
|
||||
import com.simibubi.create.content.kinetics.BlockStressDefaults;
|
||||
import com.simibubi.create.content.processing.AssemblyOperatorBlockItem;
|
||||
import com.simibubi.create.foundation.data.*;
|
||||
import com.simibubi.create.foundation.utility.Couple;
|
||||
import com.tterrag.registrate.util.entry.BlockEntry;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.tags.BlockTags;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.SoundType;
|
||||
import net.minecraft.world.level.block.WallBlock;
|
||||
import net.minecraft.world.item.Rarity;
|
||||
import net.minecraft.world.level.block.*;
|
||||
import net.minecraft.world.level.block.state.BlockBehaviour;
|
||||
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
@@ -418,7 +429,16 @@ public static final BlockEntry<DistillationOutputBlock> STEEL_DISTILLATION_OUTPU
|
||||
///////
|
||||
|
||||
|
||||
|
||||
public static final BlockEntry<AirIntakeBlock> AIR_INTAKE = REGISTRATE.block("air_intake", AirIntakeBlock::new)
|
||||
.initialProperties(SharedProperties::copperMetal)
|
||||
.properties(BlockBehaviour.Properties::noOcclusion)
|
||||
.transform(pickaxeOnly())
|
||||
.addLayer(() -> RenderType::cutoutMipped)
|
||||
.blockstate(new AirIntakeGenerator()::generate)
|
||||
.item()
|
||||
.transform(customItemModel())
|
||||
.lang("Air Intake")
|
||||
.register();
|
||||
|
||||
|
||||
|
||||
@@ -536,6 +556,110 @@ public static final BlockEntry<DistillationOutputBlock> STEEL_DISTILLATION_OUTPU
|
||||
.noOcclusion())
|
||||
.register();
|
||||
|
||||
//-----------------------ENGINES---------------------------//
|
||||
public static final BlockEntry<GasolineEngineBlock> GASOLINE_ENGINE =
|
||||
REGISTRATE.block("gasoline_engine", GasolineEngineBlock::new)
|
||||
.initialProperties(SharedProperties::stone)
|
||||
.properties(p -> p.color(MaterialColor.COLOR_GRAY))
|
||||
.tag(AllTags.AllBlockTags.SAFE_NBT.tag)
|
||||
.properties(BlockBehaviour.Properties::noOcclusion)
|
||||
.transform(pickaxeOnly())
|
||||
.blockstate(new GasolineEngineGenerator()::generate)
|
||||
.transform(BlockStressDefaults.setCapacity(60.0))
|
||||
.transform(BlockStressDefaults.setGeneratorSpeed(() -> Couple.create(0, 256)))
|
||||
.item()
|
||||
.properties(p -> p.rarity(Rarity.UNCOMMON))
|
||||
.transform(customItemModel())
|
||||
.register();
|
||||
|
||||
public static final BlockEntry<GasolineEngineBackBlock> GASOLINE_ENGINE_BACK =
|
||||
REGISTRATE.block("gasoline_engine_back", GasolineEngineBackBlock::new)
|
||||
.initialProperties(SharedProperties::stone)
|
||||
.properties(p -> p.color(MaterialColor.COLOR_GRAY))
|
||||
.tag(AllTags.AllBlockTags.SAFE_NBT.tag)
|
||||
.properties(BlockBehaviour.Properties::noOcclusion)
|
||||
.transform(pickaxeOnly())
|
||||
.blockstate(new GasolineEngineGenerator()::generate)
|
||||
.transform(BlockStressDefaults.setCapacity(60.0))
|
||||
.transform(BlockStressDefaults.setGeneratorSpeed(() -> Couple.create(0, 256)))
|
||||
.item()
|
||||
.properties(p -> p.rarity(Rarity.UNCOMMON))
|
||||
.transform(customItemModel())
|
||||
.register();
|
||||
|
||||
|
||||
public static final BlockEntry<LPGEngineBlock> LPG_ENGINE =
|
||||
REGISTRATE.block("lpg_engine", LPGEngineBlock::new)
|
||||
.initialProperties(SharedProperties::stone)
|
||||
.properties(p -> p.color(MaterialColor.COLOR_GRAY))
|
||||
.tag(AllTags.AllBlockTags.SAFE_NBT.tag)
|
||||
.properties(BlockBehaviour.Properties::noOcclusion)
|
||||
.transform(pickaxeOnly())
|
||||
.blockstate(new GasolineEngineGenerator()::generate)
|
||||
.transform(BlockStressDefaults.setCapacity(60.0))
|
||||
.transform(BlockStressDefaults.setGeneratorSpeed(() -> Couple.create(0, 256)))
|
||||
.item()
|
||||
.properties(p -> p.rarity(Rarity.UNCOMMON))
|
||||
.transform(customItemModel())
|
||||
.register();
|
||||
|
||||
public static final BlockEntry<LPGEngineBackBlock> LPG_ENGINE_BACK =
|
||||
REGISTRATE.block("lpg_engine_back", LPGEngineBackBlock::new)
|
||||
.initialProperties(SharedProperties::stone)
|
||||
.properties(p -> p.color(MaterialColor.COLOR_GRAY))
|
||||
.tag(AllTags.AllBlockTags.SAFE_NBT.tag)
|
||||
.properties(BlockBehaviour.Properties::noOcclusion)
|
||||
.transform(pickaxeOnly())
|
||||
.blockstate(new GasolineEngineGenerator()::generate)
|
||||
.transform(BlockStressDefaults.setCapacity(60.0))
|
||||
.transform(BlockStressDefaults.setGeneratorSpeed(() -> Couple.create(0, 256)))
|
||||
.item()
|
||||
.properties(p -> p.rarity(Rarity.UNCOMMON))
|
||||
.transform(customItemModel())
|
||||
.register();
|
||||
|
||||
public static final BlockEntry<TurbineEngineBlock> TURBINE_ENGINE =
|
||||
REGISTRATE.block("turbine_engine", TurbineEngineBlock::new)
|
||||
.initialProperties(SharedProperties::stone)
|
||||
.properties(p -> p.color(MaterialColor.COLOR_GRAY))
|
||||
.tag(AllTags.AllBlockTags.SAFE_NBT.tag)
|
||||
.properties(BlockBehaviour.Properties::noOcclusion)
|
||||
.transform(pickaxeOnly())
|
||||
.blockstate(new GasolineEngineGenerator()::generate)
|
||||
.transform(BlockStressDefaults.setCapacity(60.0))
|
||||
.transform(BlockStressDefaults.setGeneratorSpeed(() -> Couple.create(0, 256)))
|
||||
.item()
|
||||
.properties(p -> p.rarity(Rarity.UNCOMMON))
|
||||
.transform(customItemModel())
|
||||
.register();
|
||||
|
||||
public static final BlockEntry<TurbineEngineBackBlock> TURBINE_ENGINE_BACK =
|
||||
REGISTRATE.block("turbine_engine_back", TurbineEngineBackBlock::new)
|
||||
.initialProperties(SharedProperties::stone)
|
||||
.properties(p -> p.color(MaterialColor.COLOR_GRAY))
|
||||
.tag(AllTags.AllBlockTags.SAFE_NBT.tag)
|
||||
.properties(BlockBehaviour.Properties::noOcclusion)
|
||||
.transform(pickaxeOnly())
|
||||
.blockstate(new GasolineEngineGenerator()::generate)
|
||||
.transform(BlockStressDefaults.setCapacity(60.0))
|
||||
.transform(BlockStressDefaults.setGeneratorSpeed(() -> Couple.create(0, 256)))
|
||||
.item()
|
||||
.properties(p -> p.rarity(Rarity.UNCOMMON))
|
||||
.transform(customItemModel())
|
||||
.register();
|
||||
|
||||
|
||||
|
||||
public static final BlockEntry<DieselEngineBlock> DIESEL_ENGINE =
|
||||
REGISTRATE.block("diesel_engine", DieselEngineBlock::new)
|
||||
.initialProperties(SharedProperties::copperMetal)
|
||||
.transform(pickaxeOnly())
|
||||
.blockstate((c, p) -> p.horizontalFaceBlock(c.get(), AssetLookup.partialBaseModel(c, p)))
|
||||
.transform(BlockStressDefaults.setCapacity(14.0))
|
||||
.transform(BlockStressDefaults.setGeneratorSpeed(DieselEngineBlock::getSpeedRange))
|
||||
.item()
|
||||
.transform(customItemModel())
|
||||
.register();
|
||||
|
||||
|
||||
|
||||
@@ -543,17 +667,121 @@ public static final BlockEntry<DistillationOutputBlock> STEEL_DISTILLATION_OUTPU
|
||||
static {
|
||||
REGISTRATE.creativeModeTab(() -> TFMGCreativeModeTabs.TFMG_BUILDING_BLOCKS);
|
||||
}
|
||||
public static final BlockEntry<Block> CONCRETE = REGISTRATE.block("concrete", Block::new)
|
||||
.initialProperties(() -> Blocks.STONE)
|
||||
.properties(p -> p.color(MaterialColor.COLOR_LIGHT_GRAY))
|
||||
.properties(p -> p.requiresCorrectToolForDrops())
|
||||
.transform(pickaxeOnly())
|
||||
.blockstate(simpleCubeAll("concrete"))
|
||||
.tag(BlockTags.NEEDS_STONE_TOOL)
|
||||
.transform(tagBlockAndItem("concrete"))
|
||||
.build()
|
||||
.lang("Concrete")
|
||||
.register();
|
||||
//public static final BlockEntry<Block> CONCRETE = REGISTRATE.block("concrete", Block::new)
|
||||
// .initialProperties(() -> Blocks.STONE)
|
||||
// .properties(p -> p.color(MaterialColor.COLOR_LIGHT_GRAY))
|
||||
// .properties(p -> p.requiresCorrectToolForDrops())
|
||||
// .transform(pickaxeOnly())
|
||||
// .blockstate(simpleCubeAll("concrete"))
|
||||
// .tag(BlockTags.NEEDS_STONE_TOOL)
|
||||
// .transform(tagBlockAndItem("concrete"))
|
||||
// .build()
|
||||
// .lang("Concrete")
|
||||
// .register();
|
||||
|
||||
|
||||
public static final BlockEntry<Block> CONCRETE_TEST = generateConcrete();
|
||||
|
||||
|
||||
public static BlockEntry<Block> generateConcrete(){
|
||||
|
||||
|
||||
generateColoredConcrete();
|
||||
|
||||
|
||||
|
||||
return REGISTRATE.block("concrete", Block::new)
|
||||
.initialProperties(() -> Blocks.STONE)
|
||||
.properties(p -> p.color(MaterialColor.COLOR_LIGHT_GRAY))
|
||||
.properties(p -> p.requiresCorrectToolForDrops())
|
||||
.transform(pickaxeOnly())
|
||||
.blockstate(simpleCubeAll("concrete"))
|
||||
.tag(BlockTags.NEEDS_STONE_TOOL)
|
||||
.transform(tagBlockAndItem("concrete"))
|
||||
.build()
|
||||
.lang("Concrete")
|
||||
.register();
|
||||
}
|
||||
//this saved so much time
|
||||
public static void generateColoredConcrete() {
|
||||
String[] colours = {"black", "white", "blue", "light_blue", "red", "green", "lime", "pink", "magenta", "yellow", "gray", "light_gray", "brown", "cyan", "purple", "orange"};
|
||||
|
||||
|
||||
for (String color : colours) {
|
||||
String firstLetter = color.substring(0, 1).toUpperCase();
|
||||
String colorWithoutC = color.substring(1);
|
||||
|
||||
String upperCaseColor = firstLetter + colorWithoutC;
|
||||
String light = "Light";
|
||||
if(upperCaseColor.contains(light)){
|
||||
String nameWithoutLight = upperCaseColor.substring(6);
|
||||
|
||||
String firstLetter2 = nameWithoutLight.substring(0, 1).toUpperCase();
|
||||
String colorWithoutC2 = nameWithoutLight.substring(1);
|
||||
|
||||
upperCaseColor = light+" "+firstLetter2+colorWithoutC2;
|
||||
|
||||
|
||||
}
|
||||
REGISTRATE.block(color + "_concrete", Block::new)
|
||||
.initialProperties(() -> Blocks.STONE)
|
||||
.properties(p -> p.color(MaterialColor.COLOR_LIGHT_GRAY))
|
||||
.properties(p -> p.requiresCorrectToolForDrops())
|
||||
.transform(pickaxeOnly())
|
||||
.blockstate(simpleCubeAll(color + "_concrete"))
|
||||
.tag(BlockTags.NEEDS_STONE_TOOL)
|
||||
.item()
|
||||
.build()
|
||||
.lang(upperCaseColor + " Concrete")
|
||||
.register();
|
||||
|
||||
|
||||
REGISTRATE.block(color + "_concrete_wall", WallBlock::new)
|
||||
.initialProperties(() -> Blocks.STONE)
|
||||
.properties(p -> p.color(MaterialColor.COLOR_LIGHT_GRAY))
|
||||
.properties(p -> p.requiresCorrectToolForDrops())
|
||||
.transform(pickaxeOnly())
|
||||
.blockstate((c, p) -> TFMGVanillaBlockStates.generateWallBlockState(c, p, color + "_concrete"))
|
||||
.tag(BlockTags.NEEDS_STONE_TOOL)
|
||||
.tag(BlockTags.WALLS)
|
||||
.item()
|
||||
.transform(b -> TFMGVanillaBlockStates.transformWallItem(b, color + "_concrete"))
|
||||
.build()
|
||||
.lang(upperCaseColor + " Concrete Wall")
|
||||
.register();
|
||||
|
||||
REGISTRATE.block(color + "_concrete_stairs", p -> new StairBlock(()-> TFMGBlocks.CONCRETE_TEST.get().defaultBlockState(),p))
|
||||
.initialProperties(() -> Blocks.STONE)
|
||||
.properties(p -> p.color(MaterialColor.COLOR_LIGHT_GRAY))
|
||||
.properties(p -> p.requiresCorrectToolForDrops())
|
||||
.transform(pickaxeOnly())
|
||||
.blockstate((c, p) -> TFMGVanillaBlockStates.generateStairBlockState(c, p, color + "_concrete"))
|
||||
.tag(BlockTags.NEEDS_STONE_TOOL)
|
||||
.tag(BlockTags.STAIRS)
|
||||
.item()
|
||||
.transform(b -> TFMGVanillaBlockStates.transformStairItem(b, color + "_concrete"))
|
||||
.build()
|
||||
.lang(upperCaseColor + " Concrete Stairs")
|
||||
.register();
|
||||
|
||||
|
||||
|
||||
REGISTRATE.block(color + "_concrete_slab", SlabBlock::new)
|
||||
.initialProperties(() -> Blocks.STONE)
|
||||
.properties(p -> p.color(MaterialColor.COLOR_LIGHT_GRAY))
|
||||
.properties(p -> p.requiresCorrectToolForDrops())
|
||||
.transform(pickaxeOnly())
|
||||
.blockstate((c, p) -> TFMGVanillaBlockStates.generateSlabBlockState(c, p, color + "_concrete"))
|
||||
.tag(BlockTags.NEEDS_STONE_TOOL)
|
||||
.tag(BlockTags.WALLS)
|
||||
.item()
|
||||
.transform(customItemModel(color+"_concrete_bottom"))
|
||||
.lang(upperCaseColor + " Concrete Slab")
|
||||
.register();
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public static void register() {}
|
||||
}
|
||||
|
||||
@@ -2,10 +2,10 @@ package com.drmangotea.tfmg.registry;
|
||||
|
||||
import com.drmangotea.tfmg.CreateTFMG;
|
||||
import com.drmangotea.tfmg.base.spark.*;
|
||||
import com.drmangotea.tfmg.blocks.gadgets.explosives.napalm.NapalmBombEntity;
|
||||
import com.drmangotea.tfmg.blocks.gadgets.explosives.napalm.NapalmBombRenderer;
|
||||
import com.drmangotea.tfmg.blocks.gadgets.explosives.thermite_grenades.ThermiteGrenade;
|
||||
import com.drmangotea.tfmg.blocks.gadgets.explosives.thermite_grenades.ThermiteGrenadeRenderer;
|
||||
import com.drmangotea.tfmg.items.gadgets.explosives.napalm.NapalmBombEntity;
|
||||
import com.drmangotea.tfmg.items.gadgets.explosives.napalm.NapalmBombRenderer;
|
||||
import com.drmangotea.tfmg.items.gadgets.explosives.thermite_grenades.ThermiteGrenade;
|
||||
import com.drmangotea.tfmg.items.gadgets.explosives.thermite_grenades.ThermiteGrenadeRenderer;
|
||||
import com.simibubi.create.foundation.data.CreateEntityBuilder;
|
||||
import com.simibubi.create.foundation.utility.Lang;
|
||||
import com.tterrag.registrate.util.entry.EntityEntry;
|
||||
|
||||
@@ -68,6 +68,11 @@ public class TFMGFluids {
|
||||
.lang("LPG")
|
||||
.register();
|
||||
|
||||
public static final FluidEntry<VirtualFluid> AIR =
|
||||
REGISTRATE.virtualFluid("air",LPG_RL,LPG_RL)
|
||||
.lang("Air")
|
||||
.register();
|
||||
|
||||
public static final FluidEntry<VirtualFluid> PROPANE =
|
||||
REGISTRATE.virtualFluid("propane",PROPANE_RL,PROPANE_RL)
|
||||
.lang("Propane")
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.drmangotea.tfmg.registry;
|
||||
|
||||
import com.drmangotea.tfmg.blocks.gadgets.explosives.thermite_grenades.ChemicalColor;
|
||||
import com.drmangotea.tfmg.blocks.gadgets.explosives.thermite_grenades.ThermiteGrenadeItem;
|
||||
import com.drmangotea.tfmg.blocks.gadgets.quad_potato_cannon.QuadPotatoCannonItem;
|
||||
import com.drmangotea.tfmg.items.gadgets.explosives.thermite_grenades.ChemicalColor;
|
||||
import com.drmangotea.tfmg.items.gadgets.explosives.thermite_grenades.ThermiteGrenadeItem;
|
||||
import com.drmangotea.tfmg.items.gadgets.quad_potato_cannon.QuadPotatoCannonItem;
|
||||
import com.drmangotea.tfmg.blocks.machines.metal_processing.casting_basin.CastingBasinBlockEntity;
|
||||
import com.drmangotea.tfmg.blocks.machines.metal_processing.casting_basin.CastingMoldItem;
|
||||
import com.drmangotea.tfmg.items.CoalCokeItem;
|
||||
@@ -13,7 +13,7 @@ import net.minecraft.tags.TagKey;
|
||||
import net.minecraft.world.item.Item;
|
||||
|
||||
import static com.drmangotea.tfmg.CreateTFMG.REGISTRATE;
|
||||
import static com.drmangotea.tfmg.blocks.gadgets.explosives.thermite_grenades.ChemicalColor.*;
|
||||
import static com.drmangotea.tfmg.items.gadgets.explosives.thermite_grenades.ChemicalColor.*;
|
||||
import static com.simibubi.create.AllTags.AllItemTags.CREATE_INGOTS;
|
||||
import static com.simibubi.create.AllTags.forgeItemTag;
|
||||
|
||||
|
||||
@@ -18,7 +18,13 @@ import java.util.Map;
|
||||
public class TFMGPartialModels {
|
||||
|
||||
public static final PartialModel
|
||||
|
||||
AIR_INTAKE_FAN = block("air_intake/fan"),
|
||||
AIR_INTAKE_FAN_MEDIUM = block("air_intake/fan_medium"),
|
||||
AIR_INTAKE_FAN_LARGE = block("air_intake/fan_large"),
|
||||
AIR_INTAKE_FRAME = block("air_intake/frame"),
|
||||
AIR_INTAKE_FRAME_CLOSED = block("air_intake/frame_closed"),
|
||||
AIR_INTAKE_MEDIUM = block("air_intake/block_medium"),
|
||||
AIR_INTAKE_LARGE = block("air_intake/block_large"),
|
||||
CASTING_SPOUT_CONNECTOR = block("casting_spout/connector"),
|
||||
CASTING_SPOUT_BOTTOM = block("casting_spout/bottom"),
|
||||
COKE_OVEN_DOOR_LEFT = block("coke_oven/door_left"),
|
||||
|
||||
@@ -35,7 +35,7 @@ public class TFMGLayeredPatterns {
|
||||
.layer(l -> l.weight(1)
|
||||
.passiveBlock())
|
||||
.layer(l -> l.weight(2)
|
||||
.block(TFMGBlocks.CONCRETE.get())
|
||||
.block(TFMGBlocks.CONCRETE_TEST.get())
|
||||
.size(1, 3))
|
||||
.layer(l -> l.weight(1)
|
||||
.block(Blocks.SMOOTH_BASALT)
|
||||
@@ -53,7 +53,7 @@ public class TFMGLayeredPatterns {
|
||||
.layer(l -> l.weight(1)
|
||||
.passiveBlock())
|
||||
.layer(l -> l.weight(2)
|
||||
.block(TFMGBlocks.CONCRETE.get())
|
||||
.block(TFMGBlocks.CONCRETE_TEST.get())
|
||||
.size(1, 3))
|
||||
.layer(l -> l.weight(1)
|
||||
.block(Blocks.TUFF)
|
||||
@@ -73,7 +73,7 @@ public class TFMGLayeredPatterns {
|
||||
.layer(l -> l.weight(2)
|
||||
.passiveBlock())
|
||||
.layer(l -> l.weight(2)
|
||||
.block(TFMGBlocks.CONCRETE.get())
|
||||
.block(TFMGBlocks.CONCRETE_TEST.get())
|
||||
.size(1, 2))
|
||||
.layer(l -> l.weight(3)
|
||||
.block(AllPaletteStoneTypes.SCORCHIA.getBaseBlock())
|
||||
|
||||
@@ -14,9 +14,7 @@ displayName="Create: The Factory Must Grow"
|
||||
|
||||
logoFile="logo.png"
|
||||
|
||||
#credits="Thanks for this example mod goes to Java"
|
||||
|
||||
authors="DrMangoTea, Pepagg, MilkFur"
|
||||
authors="DrMangoTea, Pepa, Milky"
|
||||
|
||||
description='''
|
||||
description soon
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
{
|
||||
"credit": "Made with Blockbench",
|
||||
"textures": {
|
||||
"0": "tfmg:block/air_intake/air_intake_small",
|
||||
"particle": "tfmg:block/air_intake/air_intake_small"
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"from": [0, 1, 0],
|
||||
"to": [16, 16, 2],
|
||||
"faces": {
|
||||
"north": {"uv": [8, 0, 16, 7.5], "texture": "#0"},
|
||||
"east": {"uv": [15, 0, 16, 7.5], "texture": "#0"},
|
||||
"south": {"uv": [8, 0, 16, 7.5], "texture": "#0"},
|
||||
"west": {"uv": [8, 0, 9, 7.5], "texture": "#0"},
|
||||
"up": {"uv": [0, 8, 8, 9], "texture": "#0"},
|
||||
"down": {"uv": [0, 7, 8, 8], "texture": "#0"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [0, 1, 14],
|
||||
"to": [16, 16, 16],
|
||||
"faces": {
|
||||
"north": {"uv": [8, 0, 16, 7.5], "texture": "#0"},
|
||||
"east": {"uv": [8, 0, 9, 7.5], "texture": "#0"},
|
||||
"south": {"uv": [8, 0, 16, 7.5], "texture": "#0"},
|
||||
"west": {"uv": [15, 0, 16, 7.5], "texture": "#0"},
|
||||
"up": {"uv": [0, 8, 8, 9], "rotation": 180, "texture": "#0"},
|
||||
"down": {"uv": [0, 7, 8, 8], "rotation": 180, "texture": "#0"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [0, 1, 2],
|
||||
"to": [2, 16, 14],
|
||||
"faces": {
|
||||
"north": {"uv": [15, 0, 16, 8], "texture": "#0"},
|
||||
"east": {"uv": [9, 0, 15, 8], "texture": "#0"},
|
||||
"south": {"uv": [8, 0, 9, 8], "texture": "#0"},
|
||||
"west": {"uv": [9, 0, 15, 7.5], "texture": "#0"},
|
||||
"up": {"uv": [1, 8, 7, 9], "rotation": 270, "texture": "#0"},
|
||||
"down": {"uv": [1, 7, 7, 8], "rotation": 90, "texture": "#0"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [14, 1, 2],
|
||||
"to": [16, 16, 14],
|
||||
"faces": {
|
||||
"north": {"uv": [8, 0, 9, 7.5], "texture": "#0"},
|
||||
"east": {"uv": [9, 0, 15, 7.5], "texture": "#0"},
|
||||
"south": {"uv": [15, 0, 16, 7.5], "texture": "#0"},
|
||||
"west": {"uv": [9, 0, 15, 7.5], "texture": "#0"},
|
||||
"up": {"uv": [1, 8, 7, 9], "rotation": 90, "texture": "#0"},
|
||||
"down": {"uv": [1, 7, 7, 8], "rotation": 270, "texture": "#0"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [2, 1, 2],
|
||||
"to": [14, 3, 14],
|
||||
"faces": {
|
||||
"north": {"uv": [0, 0, 12, 2], "texture": "#0"},
|
||||
"east": {"uv": [0, 0, 12, 2], "texture": "#0"},
|
||||
"south": {"uv": [0, 0, 12, 2], "texture": "#0"},
|
||||
"west": {"uv": [0, 0, 12, 2], "texture": "#0"},
|
||||
"up": {"uv": [1, 1, 7, 7], "texture": "#0"},
|
||||
"down": {"uv": [1, 1, 7, 7], "texture": "#0"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [2, 16, 2],
|
||||
"to": [14, 16, 14],
|
||||
"faces": {
|
||||
"north": {"uv": [0, 0, 12, 2], "texture": "#0"},
|
||||
"east": {"uv": [0, 0, 12, 2], "texture": "#0"},
|
||||
"south": {"uv": [0, 0, 12, 2], "texture": "#0"},
|
||||
"west": {"uv": [0, 0, 12, 2], "texture": "#0"},
|
||||
"up": {"uv": [1, 9, 7, 15], "texture": "#0"}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"parent": "block/air"
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
{
|
||||
"credit": "Made with Blockbench",
|
||||
"textures": {
|
||||
"0": "tfmg:block/air_intake/air_intake_large",
|
||||
"1": "tfmg:block/air_intake/inside_large",
|
||||
"2": "tfmg:block/air_intake/inputs",
|
||||
"particle": "tfmg:block/air_intake/air_intake_large"
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"from": [-16, -16, 1],
|
||||
"to": [32, 32, 1],
|
||||
"rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]},
|
||||
"faces": {
|
||||
"east": {"uv": [0, 0, 16, 0], "rotation": 270, "texture": "#1"},
|
||||
"south": {"uv": [0, 0, 16, 16], "rotation": 180, "texture": "#1"},
|
||||
"west": {"uv": [0, 0, 16, 0], "rotation": 90, "texture": "#1"},
|
||||
"up": {"uv": [0, 0, 16, 0], "rotation": 180, "texture": "#1"},
|
||||
"down": {"uv": [0, 0, 16, 0], "texture": "#1"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [31.999, -16, 1],
|
||||
"to": [31.999, 32, 16],
|
||||
"rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]},
|
||||
"faces": {
|
||||
"north": {"uv": [0, 0, 0, 16], "texture": "#0"},
|
||||
"south": {"uv": [0, 0, 0, 16], "rotation": 180, "texture": "#0"},
|
||||
"west": {"uv": [8, 5.33333, 16, 8], "rotation": 90, "texture": "#0"},
|
||||
"up": {"uv": [0, 0, 0, 15], "rotation": 180, "texture": "#0"},
|
||||
"down": {"uv": [0, 0, 0, 15], "texture": "#0"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [-16, -15.999, 1],
|
||||
"to": [32, -15.999, 16],
|
||||
"rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]},
|
||||
"faces": {
|
||||
"north": {"uv": [0, 0, 0, 16], "rotation": 90, "texture": "#0"},
|
||||
"east": {"uv": [0, 0, 0, 15], "rotation": 270, "texture": "#0"},
|
||||
"south": {"uv": [0, 0, 0, 16], "rotation": 90, "texture": "#0"},
|
||||
"west": {"uv": [0, 0, 0, 15], "rotation": 90, "texture": "#0"},
|
||||
"up": {"uv": [8, 5.33333, 16, 8], "rotation": 180, "texture": "#0"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [-16, 31.99, 1],
|
||||
"to": [32, 31.99, 16],
|
||||
"rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]},
|
||||
"faces": {
|
||||
"north": {"uv": [0, 0, 0, 16], "rotation": 90, "texture": "#0"},
|
||||
"east": {"uv": [0, 0, 0, 15], "rotation": 270, "texture": "#0"},
|
||||
"south": {"uv": [0, 0, 0, 16], "rotation": 90, "texture": "#0"},
|
||||
"west": {"uv": [0, 0, 0, 15], "rotation": 90, "texture": "#0"},
|
||||
"down": {"uv": [8, 5.33333, 16, 8], "texture": "#0"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [-15.999, -16, 1],
|
||||
"to": [-15.999, 32, 16],
|
||||
"rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]},
|
||||
"faces": {
|
||||
"north": {"uv": [0, 0, 0, 16], "texture": "#0"},
|
||||
"east": {"uv": [8, 5.33333, 16, 8], "rotation": 270, "texture": "#0"},
|
||||
"south": {"uv": [0, 0, 0, 16], "rotation": 180, "texture": "#0"},
|
||||
"up": {"uv": [0, 0, 0, 15], "rotation": 180, "texture": "#0"},
|
||||
"down": {"uv": [0, 0, 0, 15], "texture": "#0"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [-16, -16, 1],
|
||||
"to": [32, 32, 16],
|
||||
"rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]},
|
||||
"faces": {
|
||||
"north": {"uv": [0, 0, 16, 16], "texture": "#2"},
|
||||
"east": {"uv": [8, 5.33333, 16, 8], "rotation": 270, "texture": "#0"},
|
||||
"south": {"uv": [0, 8, 8, 16], "rotation": 180, "texture": "#0"},
|
||||
"west": {"uv": [8, 5.33333, 16, 8], "rotation": 90, "texture": "#0"},
|
||||
"up": {"uv": [8, 5.33333, 16, 8], "rotation": 180, "texture": "#0"},
|
||||
"down": {"uv": [8, 5.33333, 16, 8], "texture": "#0"}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
{
|
||||
"credit": "Made with Blockbench",
|
||||
"textures": {
|
||||
"0": "tfmg:block/air_intake/air_intake_medium",
|
||||
"1": "tfmg:block/air_intake/inputs",
|
||||
"2": "tfmg:block/air_intake/inside_medium",
|
||||
"particle": "tfmg:block/air_intake/air_intake_medium"
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"from": [-16, 0, 1],
|
||||
"to": [16, 32, 16],
|
||||
"rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]},
|
||||
"faces": {
|
||||
"north": {"uv": [5.33333, 5.33333, 16, 16], "texture": "#1"},
|
||||
"east": {"uv": [8, 4, 16, 7.75], "rotation": 270, "texture": "#0"},
|
||||
"south": {"uv": [0, 8, 8, 16], "rotation": 180, "texture": "#0"},
|
||||
"west": {"uv": [8, 4, 16, 7.75], "rotation": 90, "texture": "#0"},
|
||||
"up": {"uv": [8, 4, 16, 7.75], "rotation": 180, "texture": "#0"},
|
||||
"down": {"uv": [8, 4, 16, 7.75], "texture": "#0"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [-16, 0, 1],
|
||||
"to": [16, 32, 1],
|
||||
"rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]},
|
||||
"faces": {
|
||||
"east": {"uv": [0, 0, 16, 0], "rotation": 270, "texture": "#2"},
|
||||
"south": {"uv": [0, 0, 16, 16], "rotation": 180, "texture": "#2"},
|
||||
"west": {"uv": [0, 0, 16, 0], "rotation": 90, "texture": "#2"},
|
||||
"up": {"uv": [0, 0, 16, 0], "rotation": 180, "texture": "#2"},
|
||||
"down": {"uv": [0, 0, 16, 0], "texture": "#2"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [-15.99, 0, 1],
|
||||
"to": [-15.99, 32, 15],
|
||||
"rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]},
|
||||
"faces": {
|
||||
"north": {"uv": [0, 0, 16, 0], "rotation": 90, "texture": "#0"},
|
||||
"east": {"uv": [8, 4, 16, 7.75], "rotation": 270, "texture": "#0"},
|
||||
"south": {"uv": [0, 0, 16, 0], "rotation": 90, "texture": "#0"},
|
||||
"up": {"uv": [0, 0, 0, 14], "rotation": 180, "texture": "#0"},
|
||||
"down": {"uv": [0, 0, 0, 14], "texture": "#0"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [15.99, 0, 1],
|
||||
"to": [15.99, 32, 15],
|
||||
"rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]},
|
||||
"faces": {
|
||||
"north": {"uv": [0, 0, 16, 0], "rotation": 90, "texture": "#0"},
|
||||
"south": {"uv": [0, 0, 16, 0], "rotation": 90, "texture": "#0"},
|
||||
"west": {"uv": [8, 4, 16, 7.75], "rotation": 90, "texture": "#0"},
|
||||
"up": {"uv": [0, 0, 0, 14], "rotation": 180, "texture": "#0"},
|
||||
"down": {"uv": [0, 0, 0, 14], "texture": "#0"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [-16, 31.999, 1],
|
||||
"to": [16, 31.999, 15],
|
||||
"rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]},
|
||||
"faces": {
|
||||
"north": {"uv": [0, 0, 16, 0], "texture": "#0"},
|
||||
"east": {"uv": [0, 0, 0, 14], "rotation": 270, "texture": "#0"},
|
||||
"south": {"uv": [0, 0, 16, 0], "rotation": 180, "texture": "#0"},
|
||||
"west": {"uv": [0, 0, 0, 14], "rotation": 90, "texture": "#0"},
|
||||
"down": {"uv": [8, 4, 16, 7.75], "texture": "#0"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [-16, 0.001, 1],
|
||||
"to": [16, 0.001, 15],
|
||||
"rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]},
|
||||
"faces": {
|
||||
"north": {"uv": [0, 0, 16, 0], "texture": "#0"},
|
||||
"east": {"uv": [0, 0, 0, 14], "rotation": 270, "texture": "#0"},
|
||||
"south": {"uv": [0, 0, 16, 0], "rotation": 180, "texture": "#0"},
|
||||
"west": {"uv": [0, 0, 0, 14], "rotation": 90, "texture": "#0"},
|
||||
"up": {"uv": [8, 4, 16, 7.75], "rotation": 180, "texture": "#0"}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
{
|
||||
"credit": "Made with Blockbench",
|
||||
"textures": {
|
||||
"axis_top": "create:block/axis_top",
|
||||
"fan_blades": "create:block/fan_blades",
|
||||
"axis": "create:block/axis"
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"name": "Shaft",
|
||||
"from": [6, 6, 1.2],
|
||||
"to": [10, 10, 8],
|
||||
"faces": {
|
||||
"north": {"uv": [6, 6, 10, 10], "texture": "#axis_top"},
|
||||
"east": {"uv": [6, 0, 10, 6.8], "rotation": 90, "texture": "#axis"},
|
||||
"south": {"uv": [6, 6, 10, 10], "texture": "#axis_top"},
|
||||
"west": {"uv": [6, 0, 10, 6.8], "rotation": 90, "texture": "#axis"},
|
||||
"up": {"uv": [6, 0, 10, 6.8], "rotation": 90, "texture": "#axis"},
|
||||
"down": {"uv": [6, 0, 10, 6.8], "rotation": 90, "texture": "#axis"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Fan",
|
||||
"from": [1, 1, 4],
|
||||
"to": [15, 15, 12],
|
||||
"rotation": {"angle": 22.5, "axis": "z", "origin": [8, 8, 8]},
|
||||
"faces": {
|
||||
"north": {"uv": [1, 1, 15, 15], "texture": "#fan_blades"}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
{
|
||||
"credit": "Made with Blockbench",
|
||||
"textures": {
|
||||
"0": "tfmg:block/air_intake/air_intake_large",
|
||||
"particle": "tfmg:block/air_intake/air_intake_large",
|
||||
"axis": "create:block/axis",
|
||||
"axis_top": "create:block/axis_top"
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"name": "Fan",
|
||||
"from": [-12, -12, 4],
|
||||
"to": [28, 28, 12],
|
||||
"rotation": {"angle": 22.5, "axis": "z", "origin": [8, 8, 8]},
|
||||
"faces": {
|
||||
"north": {"uv": [8.5, 8.5, 15.5, 15.5], "texture": "#0"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Shaft",
|
||||
"from": [6, 6, 1.2],
|
||||
"to": [10, 10, 8],
|
||||
"faces": {
|
||||
"north": {"uv": [6, 6, 10, 10], "texture": "#axis_top"},
|
||||
"east": {"uv": [6, 0, 10, 6.8], "rotation": 90, "texture": "#axis"},
|
||||
"south": {"uv": [6, 6, 10, 10], "texture": "#axis_top"},
|
||||
"west": {"uv": [6, 0, 10, 6.8], "rotation": 90, "texture": "#axis"},
|
||||
"up": {"uv": [6, 0, 10, 6.8], "rotation": 90, "texture": "#axis"},
|
||||
"down": {"uv": [6, 0, 10, 6.8], "rotation": 90, "texture": "#axis"}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
{
|
||||
"credit": "Made with Blockbench",
|
||||
"textures": {
|
||||
"0": "tfmg:block/air_intake/air_intake_medium",
|
||||
"particle": "tfmg:block/air_intake/air_intake_medium",
|
||||
"axis": "create:block/axis",
|
||||
"axis_top": "create:block/axis_top"
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"name": "Fan",
|
||||
"from": [-6, -6, 4],
|
||||
"to": [22, 22, 12],
|
||||
"rotation": {"angle": 22.5, "axis": "z", "origin": [8, 8, 8]},
|
||||
"faces": {
|
||||
"north": {"uv": [8.5, 8.5, 15.5, 15.5], "texture": "#0"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Shaft",
|
||||
"from": [6, 6, 1.2],
|
||||
"to": [10, 10, 8],
|
||||
"faces": {
|
||||
"north": {"uv": [6, 6, 10, 10], "texture": "#axis_top"},
|
||||
"east": {"uv": [6, 0, 10, 6.8], "rotation": 90, "texture": "#axis"},
|
||||
"south": {"uv": [6, 6, 10, 10], "texture": "#axis_top"},
|
||||
"west": {"uv": [6, 0, 10, 6.8], "rotation": 90, "texture": "#axis"},
|
||||
"up": {"uv": [6, 0, 10, 6.8], "rotation": 90, "texture": "#axis"},
|
||||
"down": {"uv": [6, 0, 10, 6.8], "rotation": 90, "texture": "#axis"}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
{
|
||||
"credit": "Made with Blockbench",
|
||||
"textures": {
|
||||
"0": "tfmg:block/air_intake/inputs",
|
||||
"particle": "tfmg:block/air_intake/inputs"
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"from": [0, 0, 0],
|
||||
"to": [16, 2, 1],
|
||||
"faces": {
|
||||
"north": {"uv": [0, 0, 5.33333, 0.66666], "rotation": 180, "texture": "#0"},
|
||||
"east": {"uv": [0, 0, 0.33333, 0.33333], "rotation": 90, "texture": "#0"},
|
||||
"west": {"uv": [0, 0, 0.33333, 0.33333], "rotation": 270, "texture": "#0"},
|
||||
"up": {"uv": [0, 0, 5.33333, 0.33333], "texture": "#0"},
|
||||
"down": {"uv": [0, 0, 5.33333, 0.33333], "rotation": 180, "texture": "#0"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [0, 14, 0],
|
||||
"to": [16, 16, 1],
|
||||
"faces": {
|
||||
"north": {"uv": [0, 4.66667, 5.33333, 5.33333], "rotation": 180, "texture": "#0"},
|
||||
"east": {"uv": [0, 0, 0.33333, 0.33333], "rotation": 90, "texture": "#0"},
|
||||
"west": {"uv": [0, 0, 0.33333, 0.33333], "rotation": 270, "texture": "#0"},
|
||||
"up": {"uv": [0, 0, 5.33333, 0.33333], "texture": "#0"},
|
||||
"down": {"uv": [0, 0, 5.33333, 0.33333], "rotation": 180, "texture": "#0"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [0, 2, 0],
|
||||
"to": [2, 14, 1],
|
||||
"faces": {
|
||||
"north": {"uv": [0.66667, 0, 4.66667, 0.66666], "rotation": 90, "texture": "#0"},
|
||||
"east": {"uv": [0.66667, 0, 4.66667, 0.33333], "rotation": 90, "texture": "#0"},
|
||||
"west": {"uv": [0.66667, 0, 4.66667, 0.33333], "rotation": 270, "texture": "#0"},
|
||||
"up": {"uv": [0, 0, 0.33333, 0.33333], "texture": "#0"},
|
||||
"down": {"uv": [0, 0, 0.33333, 0.33333], "rotation": 180, "texture": "#0"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [14, 2, 0],
|
||||
"to": [16, 14, 1],
|
||||
"faces": {
|
||||
"north": {"uv": [0.66667, 0, 4.66667, 0.66666], "rotation": 270, "texture": "#0"},
|
||||
"east": {"uv": [0.66667, 0, 4.66667, 0.33333], "rotation": 90, "texture": "#0"},
|
||||
"west": {"uv": [0.66667, 0, 4.66667, 0.33333], "rotation": 270, "texture": "#0"},
|
||||
"up": {"uv": [0, 0, 0.33333, 0.33333], "texture": "#0"},
|
||||
"down": {"uv": [0, 0, 0.33333, 0.33333], "rotation": 180, "texture": "#0"}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"credit": "Made with Blockbench",
|
||||
"textures": {
|
||||
"0": "tfmg:block/air_intake/air_intake_small",
|
||||
"particle": "tfmg:block/air_intake/air_intake_small"
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"from": [0, 0, 0],
|
||||
"to": [16, 16, 1],
|
||||
"faces": {
|
||||
"north": {"uv": [0, 0, 8, 8], "texture": "#0"},
|
||||
"east": {"uv": [0, 0, 8, 0], "rotation": 270, "texture": "#0"},
|
||||
"west": {"uv": [0, 0, 8, 0.5], "rotation": 90, "texture": "#0"},
|
||||
"up": {"uv": [0, 0, 8, 0.5], "rotation": 180, "texture": "#0"},
|
||||
"down": {"uv": [0, 0, 8, 0.5], "texture": "#0"}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
{
|
||||
"credit": "Made with Blockbench",
|
||||
"parent": "block/block",
|
||||
"textures": {
|
||||
"0": "tfmg:block/air_intake/air_intake_small",
|
||||
"particle": "tfmg:block/air_intake/air_intake_small"
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"from": [0, 0, 0],
|
||||
"to": [16, 16, 2],
|
||||
"faces": {
|
||||
"north": {"uv": [8, 0, 16, 8], "texture": "#0"},
|
||||
"east": {"uv": [15, 0, 16, 8], "texture": "#0"},
|
||||
"south": {"uv": [8, 0, 16, 8], "texture": "#0"},
|
||||
"west": {"uv": [8, 0, 9, 8], "texture": "#0"},
|
||||
"up": {"uv": [0, 8, 8, 9], "texture": "#0"},
|
||||
"down": {"uv": [0, 7, 8, 8], "texture": "#0"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [0, 0, 14],
|
||||
"to": [16, 16, 16],
|
||||
"faces": {
|
||||
"north": {"uv": [8, 0, 16, 8], "texture": "#0"},
|
||||
"east": {"uv": [8, 0, 9, 8], "texture": "#0"},
|
||||
"south": {"uv": [8, 0, 16, 8], "texture": "#0"},
|
||||
"west": {"uv": [15, 0, 16, 8], "texture": "#0"},
|
||||
"up": {"uv": [0, 8, 8, 9], "rotation": 180, "texture": "#0"},
|
||||
"down": {"uv": [0, 7, 8, 8], "rotation": 180, "texture": "#0"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [0, 0, 2],
|
||||
"to": [2, 16, 14],
|
||||
"faces": {
|
||||
"north": {"uv": [15, 0, 16, 8], "texture": "#0"},
|
||||
"east": {"uv": [9, 0, 15, 8], "texture": "#0"},
|
||||
"south": {"uv": [8, 0, 9, 8], "texture": "#0"},
|
||||
"west": {"uv": [9, 0, 15, 8], "texture": "#0"},
|
||||
"up": {"uv": [1, 8, 7, 9], "rotation": 270, "texture": "#0"},
|
||||
"down": {"uv": [1, 7, 7, 8], "rotation": 90, "texture": "#0"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [14, 0, 2],
|
||||
"to": [16, 16, 14],
|
||||
"faces": {
|
||||
"north": {"uv": [8, 0, 9, 8], "texture": "#0"},
|
||||
"east": {"uv": [9, 0, 15, 8], "texture": "#0"},
|
||||
"south": {"uv": [15, 0, 16, 8], "texture": "#0"},
|
||||
"west": {"uv": [9, 0, 15, 8], "texture": "#0"},
|
||||
"up": {"uv": [1, 8, 7, 9], "rotation": 90, "texture": "#0"},
|
||||
"down": {"uv": [1, 7, 7, 8], "rotation": 270, "texture": "#0"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [2, 1, 2],
|
||||
"to": [14, 3, 14],
|
||||
"faces": {
|
||||
"north": {"uv": [0, 0, 12, 2], "texture": "#0"},
|
||||
"east": {"uv": [0, 0, 12, 2], "texture": "#0"},
|
||||
"south": {"uv": [0, 0, 12, 2], "texture": "#0"},
|
||||
"west": {"uv": [0, 0, 12, 2], "texture": "#0"},
|
||||
"up": {"uv": [1, 1, 7, 7], "texture": "#0"},
|
||||
"down": {"uv": [1, 1, 7, 7], "texture": "#0"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [2, 16, 2],
|
||||
"to": [14, 16, 14],
|
||||
"faces": {
|
||||
"north": {"uv": [0, 0, 12, 2], "texture": "#0"},
|
||||
"east": {"uv": [0, 0, 12, 2], "texture": "#0"},
|
||||
"south": {"uv": [0, 0, 12, 2], "texture": "#0"},
|
||||
"west": {"uv": [0, 0, 12, 2], "texture": "#0"},
|
||||
"up": {"uv": [1, 9, 7, 15], "texture": "#0"}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
After Width: | Height: | Size: 667 B |
|
After Width: | Height: | Size: 494 B |
|
After Width: | Height: | Size: 297 B |
|
After Width: | Height: | Size: 253 B |
|
After Width: | Height: | Size: 170 B |
|
After Width: | Height: | Size: 216 B |
|
After Width: | Height: | Size: 165 B |
|
After Width: | Height: | Size: 153 B |
|
After Width: | Height: | Size: 699 B |
|
After Width: | Height: | Size: 475 B |
|
After Width: | Height: | Size: 288 B |
|
After Width: | Height: | Size: 510 B |
|
After Width: | Height: | Size: 168 B |
|
After Width: | Height: | Size: 255 B |
|
After Width: | Height: | Size: 192 B |
|
After Width: | Height: | Size: 253 B |
|
After Width: | Height: | Size: 296 B |
|
Before Width: | Height: | Size: 378 B After Width: | Height: | Size: 378 B |
|
Before Width: | Height: | Size: 490 B After Width: | Height: | Size: 490 B |
|
Before Width: | Height: | Size: 503 B After Width: | Height: | Size: 503 B |
|
Before Width: | Height: | Size: 511 B After Width: | Height: | Size: 511 B |
|
Before Width: | Height: | Size: 472 B After Width: | Height: | Size: 472 B |
|
Before Width: | Height: | Size: 460 B After Width: | Height: | Size: 460 B |
|
Before Width: | Height: | Size: 583 B After Width: | Height: | Size: 583 B |
|
Before Width: | Height: | Size: 423 B After Width: | Height: | Size: 423 B |
|
Before Width: | Height: | Size: 528 B After Width: | Height: | Size: 528 B |