Compare commits

..

10 commits

Author SHA1 Message Date
Mrbysco
8236527fb7 Tiny Torch 2024-03-03 20:52:31 +01:00
Mrbysco
c960149ca5 Rename invalid texture names 2024-03-03 19:02:53 +01:00
Mrbysco
f8c2f53b6a Re-add JEI support 2024-03-03 19:02:05 +01:00
Mrbysco
7af0f214f0 Add localization for the fluid types 2024-03-03 19:01:51 +01:00
Mrbysco
3a48ccdcb3 Move the fluid textures so that Minecraft picks them up 2024-03-03 19:01:42 +01:00
Mrbysco
3586ce0ade Remove commented out reference to blockstate and itemmodel generation since we have that 2024-03-03 19:00:03 +01:00
Mrbysco
4a183f1555 Remove properties that were only needed in 1.16 2024-03-03 17:54:41 +01:00
Mrbysco
4596da2df5 Move the RecipeType DeferredRegister 2024-03-03 17:52:22 +01:00
Mrbysco
80fb2273b5 Datagen the DamageType 2024-03-03 17:49:29 +01:00
Mrbysco
4384c932f9 Deferred register the RecipeTypes 2024-03-03 17:48:28 +01:00
68 changed files with 565 additions and 557 deletions

View file

@ -27,10 +27,7 @@ minecraft {
runs {
client {
workingDirectory project.file('run')
property("minecraft.api.auth.host", "https://0.0.0.0")
property("minecraft.api.account.host", "https://0.0.0.0")
property("minecraft.api.session.host", "https://0.0.0.0")
property("minecraft.api.services.host", "https://0.0.0.0")
mods {
actuallyadditions {
source sourceSets.main

View file

@ -0,0 +1,2 @@
// 1.20.1 2024-03-03T17:49:23.1730309 Registries
020d2b1f1c21d6c6663ef8126a52e2b9deb0e52e data/actuallyadditions/damage_type/atomicreconstructor.json

View file

@ -1,4 +1,4 @@
// 1.20.1 2024-03-03T00:40:33.018052 Block States: actuallyadditions
// 1.20.1 2024-03-03T20:34:33.9679563 Block States: actuallyadditions
23a6aa86c3f14e6a61fc8b17b65063f1995c8592 assets/actuallyadditions/blockstates/atomic_reconstructor.json
88f479927d1abdf16e24a0950ccffa86b5af8b3f assets/actuallyadditions/blockstates/battery_box.json
5c96fc287e63f5bdd31864bdab698ce34817fd9d assets/actuallyadditions/blockstates/black_quartz_block.json
@ -113,7 +113,7 @@ b3d5e4a006bd2a2126ed81803a4cd7dc976542ae assets/actuallyadditions/blockstates/sh
c34fa31f1f9888dac79b210d8e78e818c6ce7d8c assets/actuallyadditions/blockstates/smooth_black_quartz_slab.json
c2f07f07d6dc0c8134e92e81f41eef9f9c2a1f18 assets/actuallyadditions/blockstates/smooth_black_quartz_stair.json
c04bbda2945960887da98121afe3b170abe3006f assets/actuallyadditions/blockstates/smooth_black_quartz_wall.json
c355c87874ca6b88b8bda48903cc1989808352da assets/actuallyadditions/blockstates/tiny_torch.json
c38128c6f6b0e4cc38f74e923736a8536d0b2456 assets/actuallyadditions/blockstates/tiny_torch.json
93868ba257844c7b666ce600799fcc0c89ca8dd9 assets/actuallyadditions/blockstates/vertical_digger.json
08797aa1d132142e78947b38bb1ce0e9e6260450 assets/actuallyadditions/blockstates/void_crystal_block.json
6072c1955309c670d75f3bdf9076ca7fafe7b5fd assets/actuallyadditions/blockstates/void_crystal_cluster.json

View file

@ -1,4 +1,4 @@
// 1.20.1 2024-03-03T00:40:33.0195512 Item Models: actuallyadditions
// 1.20.1 2024-03-03T20:47:45.1476512 Item Models: actuallyadditions
1966de13838437bc6035f3649976a44797cf5144 assets/actuallyadditions/models/item/advanced_coil.json
24594fc68e66011dc2d7b79b92c94b387e710318 assets/actuallyadditions/models/item/advanced_leaf_blower.json
ba2d814e269cdef72e1045f200b3c20ed6961517 assets/actuallyadditions/models/item/atomic_reconstructor.json
@ -211,7 +211,7 @@ f4f238229a72372ad2d6fd862a5f2b7789196f01 assets/actuallyadditions/models/item/st
0f91c0cf92a346bccd1142ac7b6ab37bee7822e5 assets/actuallyadditions/models/item/teleport_staff.json
86863a1c74a9bebd1ea7524e0ad3435f4e83cafb assets/actuallyadditions/models/item/tiny_charcoal.json
3b23a8a33dbe5fd8f965a8d76dbd181e7a52ca78 assets/actuallyadditions/models/item/tiny_coal.json
7d7f92fd44743414cc193cec9880c05530c597e0 assets/actuallyadditions/models/item/tiny_torch.json
cf9fefdbd60278e5c0eb3858789c1305037f517d assets/actuallyadditions/models/item/tiny_torch.json
37c33ee537ada74f1ba2bfe2b53ae42677be1dc9 assets/actuallyadditions/models/item/travelers_sack.json
3ac4b97ae2690d645087d6872d39d7f35070b947 assets/actuallyadditions/models/item/triple_battery.json
a2d656d1974443483eb69de4d8a738a6d02ea32a assets/actuallyadditions/models/item/vertical_digger.json

View file

@ -1,7 +1,22 @@
{
"variants": {
"": {
"facing=east": {
"model": "actuallyadditions:block/tiny_torch_wall"
},
"facing=north": {
"model": "actuallyadditions:block/tiny_torch_wall",
"y": 270
},
"facing=south": {
"model": "actuallyadditions:block/tiny_torch_wall",
"y": 90
},
"facing=up": {
"model": "actuallyadditions:block/tiny_torch"
},
"facing=west": {
"model": "actuallyadditions:block/tiny_torch_wall",
"y": 180
}
}
}

View file

@ -1,3 +1,6 @@
{
"parent": "actuallyadditions:block/tiny_torch"
"parent": "minecraft:item/generated",
"textures": {
"layer0": "actuallyadditions:block/tiny_torch"
}
}

View file

@ -0,0 +1,5 @@
{
"exhaustion": 0.0,
"message_id": "actuallyadditions.atomic_reconstructor",
"scaling": "when_caused_by_living_non_player"
}

View file

@ -13,11 +13,13 @@ import net.minecraft.data.PackOutput;
import net.minecraft.data.registries.VanillaRegistries;
import net.minecraft.world.damagesource.DamageType;
import net.minecraftforge.common.crafting.CraftingHelper;
import net.minecraftforge.common.data.DatapackBuiltinEntriesProvider;
import net.minecraftforge.common.data.ExistingFileHelper;
import net.minecraftforge.data.event.GatherDataEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import java.util.Set;
import java.util.concurrent.CompletableFuture;
@Mod.EventBusSubscriber(modid = ActuallyAdditions.MODID, bus = Mod.EventBusSubscriber.Bus.MOD)
@ -31,8 +33,6 @@ public class ActuallyAdditionsData {
CompletableFuture<HolderLookup.Provider> lookupProvider = CompletableFuture.supplyAsync(ActuallyAdditionsData::getProvider);
ExistingFileHelper helper = event.getExistingFileHelper();
// generator.addProvider(new GeneratorBlockStates(generator, helper));
// generator.addProvider(new GeneratorItemModels(generator, helper));
// generator.addProvider(new GeneratorLanguage(generator));
BlockTagsGenerator generatorBlockTags = new BlockTagsGenerator(packOutput, lookupProvider, helper);
@ -56,6 +56,9 @@ public class ActuallyAdditionsData {
generator.addProvider(true, new MiningLensGenerator(packOutput));
generator.addProvider(true, new SoundsGenerator(packOutput, helper));
generator.addProvider(event.includeServer(), new DatapackBuiltinEntriesProvider(
packOutput, lookupProvider, Set.of(ActuallyAdditions.MODID)));
}
private static HolderLookup.Provider getProvider() {

View file

@ -2,6 +2,8 @@ package de.ellpeck.actuallyadditions.data;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
import de.ellpeck.actuallyadditions.mod.blocks.BlockTinyTorch;
import net.minecraft.core.Direction;
import net.minecraft.data.PackOutput;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.block.Block;
@ -58,7 +60,7 @@ public class BlockStateGenerator extends BlockStateProvider {
standardBlock(ActuallyBlocks.BATTERY_BOX);
standardBlock(ActuallyBlocks.ITEM_INTERFACE_HOPPING);
standardBlock(ActuallyBlocks.EMPOWERER);
standardBlock(ActuallyBlocks.TINY_TORCH);
tinyTorchBlock(ActuallyBlocks.TINY_TORCH);
standardBlock(ActuallyBlocks.SHOCK_SUPPRESSOR);
standardBlock(ActuallyBlocks.DISPLAY_STAND);
standardBlock(ActuallyBlocks.PLAYER_INTERFACE);
@ -236,8 +238,8 @@ public class BlockStateGenerator extends BlockStateProvider {
private void fullyDirectionalBlock(Supplier<Block> block) {
ResourceLocation name = ForgeRegistries.BLOCKS.getKey(block.get());
ModelFile model = new ModelFile.UncheckedModelFile(modLoc("block/" + name.toString().split(":")[1]));
ModelFile verModel = new ModelFile.UncheckedModelFile(modLoc("block/" + name.toString().split(":")[1] + "_ver"));
ModelFile model = new ModelFile.UncheckedModelFile(modLoc("block/" + name.getPath()));
ModelFile verModel = new ModelFile.UncheckedModelFile(modLoc("block/" + name.getPath() + "_ver"));
assert name != null;
directionalBlock(block.get(), model);
@ -245,9 +247,29 @@ public class BlockStateGenerator extends BlockStateProvider {
private void horizontallyDirectionalBlock(Supplier<Block> block) {
ResourceLocation name = ForgeRegistries.BLOCKS.getKey(block.get());
ModelFile model = new ModelFile.UncheckedModelFile(modLoc("block/" + name.toString().split(":")[1]));
ModelFile model = new ModelFile.UncheckedModelFile(modLoc("block/" + name.getPath()));
assert name != null;
horizontalBlock(block.get(), model);
}
private void tinyTorchBlock(Supplier<Block> block) {
assert block.get() instanceof BlockTinyTorch;
ResourceLocation name = ForgeRegistries.BLOCKS.getKey(block.get());
ModelFile model = new ModelFile.UncheckedModelFile(modLoc("block/" + name.getPath()));
ModelFile wallModel = new ModelFile.UncheckedModelFile(modLoc("block/" + name.getPath() + "_wall"));
assert name != null;
getVariantBuilder(block.get())
.partialState().with(BlockTinyTorch.FACING, Direction.UP)
.modelForState().modelFile(model).addModel()
.partialState().with(BlockTinyTorch.FACING, Direction.EAST)
.modelForState().modelFile(wallModel).addModel()
.partialState().with(BlockTinyTorch.FACING, Direction.NORTH)
.modelForState().modelFile(wallModel).rotationY(270).addModel()
.partialState().with(BlockTinyTorch.FACING, Direction.SOUTH)
.modelForState().modelFile(wallModel).rotationY(90).addModel()
.partialState().with(BlockTinyTorch.FACING, Direction.WEST)
.modelForState().modelFile(wallModel).rotationY(180).addModel();
}
}

View file

@ -49,7 +49,8 @@ public class ItemModelGenerator extends ItemModelProvider {
ActuallyBlocks.CANOLA.get(),
ActuallyBlocks.RICE.get(),
ActuallyBlocks.FLAX.get(),
ActuallyBlocks.COFFEE.get()
ActuallyBlocks.COFFEE.get(),
ActuallyBlocks.TINY_TORCH.get()
);
// Blocks
@ -69,6 +70,9 @@ public class ItemModelGenerator extends ItemModelProvider {
.texture("layer0", modLoc("item/" + wormpath))
.override().predicate(new ResourceLocation(ActuallyAdditions.MODID, "snail"), 1F)
.model(getBuilder("snail").parent(getExistingFile(mcLoc("item/handheld"))).texture("layer0", "item/snail")).end();*/
String torchPath = ForgeRegistries.ITEMS.getKey(ActuallyBlocks.TINY_TORCH.getItem()).getPath();
singleTexture(torchPath, mcLoc("item/generated"), "layer0", modLoc("block/" + torchPath));
}
private void generateBucket(FluidAA fluidSupplier) {

View file

@ -11,245 +11,132 @@
package de.ellpeck.actuallyadditions.mod.blocks;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockBase;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.util.RandomSource;
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.LevelReader;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.Mirror;
import net.minecraft.world.level.block.Rotation;
import net.minecraft.world.level.block.SoundType;
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.material.PushReaction;
import net.minecraft.world.phys.AABB;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape;
import org.jetbrains.annotations.Nullable;
public class BlockTinyTorch extends BlockBase {
//Thanks to xdjackiexd for these.
//Man, I hate numbers.
private static final AABB STANDING_AABB = new AABB(0.4375D, 0.0D, 0.4375D, 0.5625D, 0.3125D, 0.5625D);
private static final AABB TORCH_NORTH_AABB = new AABB(0.4375D, 0.25D, 0.8125D, 0.5625D, 0.5625D, 1.0D);
private static final AABB TORCH_SOUTH_AABB = new AABB(0.4375D, 0.25D, 0.0D, 0.5625D, 0.5625D, 0.1875D);
private static final AABB TORCH_WEST_AABB = new AABB(0.8125D, 0.25D, 0.4375D, 1.0D, 0.5625D, 0.5625D);
private static final AABB TORCH_EAST_AABB = new AABB(0.0D, 0.25D, 0.4375D, 0.1875D, 0.5625D, 0.5625D);
public static final DirectionProperty FACING = DirectionProperty.create("facing", Direction.NORTH, Direction.EAST, Direction.SOUTH, Direction.WEST, Direction.UP);
public BlockTinyTorch() {
super(Properties.of().pushReaction(PushReaction.DESTROY).sound(SoundType.WOOD).strength(0.0F, 0.8F));
// TorchBlock
// this.setDefaultState(this.blockState.getBaseState().withProperty(BlockTorch.FACING, Direction.UP));
// this.setTickRandomly(true);
this.registerDefaultState(this.stateDefinition.any().setValue(FACING, Direction.UP));
}
// TODO: [port] add back
//
// @Override
// public AxisAlignedBB getBoundingBox(BlockState state, IBlockAccess source, BlockPos pos) {
// switch (state.getValue(BlockTorch.FACING)) {
// case EAST:
// return TORCH_EAST_AABB;
// case WEST:
// return TORCH_WEST_AABB;
// case SOUTH:
// return TORCH_SOUTH_AABB;
// case NORTH:
// return TORCH_NORTH_AABB;
// default:
// return STANDING_AABB;
// }
// }
//
// @Nullable
// @Override
// public AxisAlignedBB getCollisionBoundingBox(BlockState blockState, IBlockAccess worldIn, BlockPos pos) {
// return NULL_AABB;
// }
//
// @Override
// public boolean isOpaqueCube(BlockState state) {
// return false;
// }
//
// @Override
// public boolean isFullCube(BlockState state) {
// return false;
// }
//
// @Override
// public boolean isNormalCube(BlockState state) {
// return false;
// }
//
// @Override
// public BlockFaceShape getBlockFaceShape(IBlockAccess world, BlockState state, BlockPos pos, Direction facing) {
// return BlockFaceShape.UNDEFINED;
// }
//
// private boolean canPlaceOn(World worldIn, BlockPos pos) {
// BlockState state = worldIn.getBlockState(pos);
// return state.isSideSolid(worldIn, pos, Direction.UP) || state.getBlock().canPlaceTorchOnTop(state, worldIn, pos);
// }
//
// @Override
// public boolean canPlaceBlockAt(World worldIn, BlockPos pos) {
// for (Direction enumfacing : BlockTorch.FACING.getAllowedValues()) {
// if (this.canPlaceAt(worldIn, pos, enumfacing)) {
// return true;
// }
// }
//
// return false;
// }
//
// private boolean canPlaceAt(World worldIn, BlockPos pos, Direction facing) {
// BlockPos blockpos = pos.offset(facing.getOpposite());
// boolean flag = facing.getAxis().isHorizontal();
// return flag && worldIn.isSideSolid(blockpos, facing, true) || facing.equals(Direction.UP) && this.canPlaceOn(worldIn, blockpos);
// }
//
// @Override
// public BlockState getStateForPlacement(World worldIn, BlockPos pos, Direction facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) {
// if (this.canPlaceAt(worldIn, pos, facing)) {
// return this.getDefaultState().withProperty(BlockTorch.FACING, facing);
// } else {
// for (Direction enumfacing : Direction.Plane.HORIZONTAL) {
// if (worldIn.isSideSolid(pos.offset(enumfacing.getOpposite()), enumfacing, true)) {
// return this.getDefaultState().withProperty(BlockTorch.FACING, enumfacing);
// }
// }
//
// return this.getDefaultState();
// }
// }
//
// @Override
// public void onBlockAdded(World worldIn, BlockPos pos, BlockState state) {
// this.checkForDrop(worldIn, pos, state);
// }
//
// @Override
// public void neighborChanged(BlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos otherPos) {
// this.onNeighborChangeInternal(worldIn, pos, state);
// }
//
// protected boolean onNeighborChangeInternal(World worldIn, BlockPos pos, BlockState state) {
// if (!this.checkForDrop(worldIn, pos, state)) {
// return true;
// } else {
// Direction enumfacing = state.getValue(BlockTorch.FACING);
// Direction.Axis axis = enumfacing.getAxis();
// Direction enumfacing1 = enumfacing.getOpposite();
// boolean flag = false;
//
// if (axis.isHorizontal() && !worldIn.isSideSolid(pos.offset(enumfacing1), enumfacing, true)) {
// flag = true;
// } else if (axis.isVertical() && !this.canPlaceOn(worldIn, pos.offset(enumfacing1))) {
// flag = true;
// }
//
// if (flag) {
// this.dropBlockAsItem(worldIn, pos, state, 0);
// worldIn.setBlockState(pos, Blocks.AIR.getDefaultState());
// return true;
// } else {
// return false;
// }
// }
// }
//
// protected boolean checkForDrop(World worldIn, BlockPos pos, BlockState state) {
// if (state.getBlock() == this && this.canPlaceAt(worldIn, pos, state.getValue(BlockTorch.FACING))) {
// return true;
// } else {
// if (worldIn.getBlockState(pos).getBlock() == this) {
// this.dropBlockAsItem(worldIn, pos, state, 0);
// worldIn.setBlockState(pos, Blocks.AIR.getDefaultState());
// }
//
// return false;
// }
// }
//
// @Override
// @OnlyIn(Dist.CLIENT)
// public void randomDisplayTick(BlockState stateIn, World worldIn, BlockPos pos, Random rand) {
// if (rand.nextBoolean()) {
// Direction enumfacing = stateIn.getValue(BlockTorch.FACING);
// double d0 = pos.getX() + 0.5D;
// double d1 = pos.getY() + 0.4D;
// double d2 = pos.getZ() + 0.5D;
//
// if (enumfacing.getAxis().isHorizontal()) {
// Direction enumfacing1 = enumfacing.getOpposite();
// worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0 + 0.35D * enumfacing1.getXOffset(), d1 + 0.22D, d2 + 0.35D * enumfacing1.getZOffset(), 0.0D, 0.0D, 0.0D);
// worldIn.spawnParticle(EnumParticleTypes.FLAME, d0 + 0.35D * enumfacing1.getXOffset(), d1 + 0.22D, d2 + 0.35D * enumfacing1.getZOffset(), 0.0D, 0.0D, 0.0D);
// } else {
// worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0, d1, d2, 0.0D, 0.0D, 0.0D);
// worldIn.spawnParticle(EnumParticleTypes.FLAME, d0, d1, d2, 0.0D, 0.0D, 0.0D);
// }
// }
// }
//
// @Override
// public BlockState getStateFromMeta(int meta) {
// BlockState iblockstate = this.getDefaultState();
//
// switch (meta) {
// case 1:
// iblockstate = iblockstate.withProperty(BlockTorch.FACING, Direction.EAST);
// break;
// case 2:
// iblockstate = iblockstate.withProperty(BlockTorch.FACING, Direction.WEST);
// break;
// case 3:
// iblockstate = iblockstate.withProperty(BlockTorch.FACING, Direction.SOUTH);
// break;
// case 4:
// iblockstate = iblockstate.withProperty(BlockTorch.FACING, Direction.NORTH);
// break;
// case 5:
// default:
// iblockstate = iblockstate.withProperty(BlockTorch.FACING, Direction.UP);
// }
//
// return iblockstate;
// }
//
// @Override
// public BlockRenderLayer getRenderLayer() {
// return BlockRenderLayer.CUTOUT;
// }
//
// @Override
// public int getMetaFromState(BlockState state) {
// int i = 0;
//
// switch (state.getValue(BlockTorch.FACING)) {
// case EAST:
// i = i | 1;
// break;
// case WEST:
// i = i | 2;
// break;
// case SOUTH:
// i = i | 3;
// break;
// case NORTH:
// i = i | 4;
// break;
// case DOWN:
// case UP:
// default:
// i = i | 5;
// }
//
// return i;
// }
//
// @Override
// public BlockState withRotation(BlockState state, Rotation rot) {
// return state.withProperty(BlockTorch.FACING, rot.rotate(state.getValue(BlockTorch.FACING)));
// }
//
// @Override
// public BlockState withMirror(BlockState state, Mirror mirrorIn) {
// return state.withRotation(mirrorIn.toRotation(state.getValue(BlockTorch.FACING)));
// }
//
// @Override
// protected BlockStateContainer createBlockState() {
// return new BlockStateContainer(this, BlockTorch.FACING);
// }
@Override
public int getLightEmission(BlockState state, BlockGetter level, BlockPos pos) {
return 8;
}
@Override
public VoxelShape getShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context) {
switch (state.getValue(FACING)) {
case EAST:
return VoxelShapes.TinyTorchShapes.TORCH_EAST_AABB;
case WEST:
return VoxelShapes.TinyTorchShapes.TORCH_WEST_AABB;
case SOUTH:
return VoxelShapes.TinyTorchShapes.TORCH_SOUTH_AABB;
case NORTH:
return VoxelShapes.TinyTorchShapes.TORCH_NORTH_AABB;
default:
return VoxelShapes.TinyTorchShapes.STANDING_AABB;
}
}
@Override
public BlockState updateShape(BlockState state, Direction direction, BlockState neighborState,
LevelAccessor levelAccessor, BlockPos pos, BlockPos neighborPos) {
return !this.canSurvive(state, levelAccessor, pos)
? Blocks.AIR.defaultBlockState()
: super.updateShape(state, direction, neighborState, levelAccessor, pos, neighborPos);
}
@Override
public boolean canSurvive(BlockState state, LevelReader levelReader, BlockPos pos) {
Direction direction = state.getValue(FACING);
if (direction == Direction.UP) {
return canSupportCenter(levelReader, pos.below(), Direction.UP);
} else {
BlockPos blockpos = pos.relative(direction.getOpposite());
BlockState blockstate = levelReader.getBlockState(blockpos);
return blockstate.isFaceSturdy(levelReader, blockpos, direction);
}
}
@Nullable
@Override
public BlockState getStateForPlacement(BlockPlaceContext context) {
LevelReader levelreader = context.getLevel();
BlockState state = this.defaultBlockState();
Direction facing = context.getClickedFace();
BlockPos pos = context.getClickedPos();
if (this.canSurvive(state, levelreader, pos)) {
return state.setValue(BlockTinyTorch.FACING, facing);
} else {
Direction[] adirection = context.getNearestLookingDirections();
for(Direction direction : adirection) {
if (direction.getAxis().isHorizontal()) {
Direction direction1 = direction.getOpposite();
state = state.setValue(FACING, direction1);
if (state.canSurvive(levelreader, pos)) {
return state;
}
}
}
return state;
}
}
@Override
public BlockState rotate(BlockState state, Rotation rotation) {
return state.setValue(FACING, rotation.rotate(state.getValue(FACING)));
}
@Override
public BlockState mirror(BlockState state, Mirror mirror) {
return state.rotate(mirror.getRotation(state.getValue(FACING)));
}
@Override
public void animateTick(BlockState state, Level level, BlockPos pos, RandomSource randomSource) {
if (randomSource.nextBoolean()) {
Direction direction = state.getValue(FACING);
double d0 = pos.getX() + 0.5D;
double d1 = pos.getY() + 0.4D;
double d2 = pos.getZ() + 0.5D;
if (direction.getAxis().isHorizontal()) {
Direction opposite = direction.getOpposite();
level.addParticle(ParticleTypes.SMOKE, d0 + 0.35D * opposite.getStepX(), d1 + 0.22D, d2 + 0.35D * opposite.getStepZ(), 0.0D, 0.0D, 0.0D);
level.addParticle(ParticleTypes.FLAME, d0 + 0.35D * opposite.getStepX(), d1 + 0.22D, d2 + 0.35D * opposite.getStepZ(), 0.0D, 0.0D, 0.0D);
} else {
level.addParticle(ParticleTypes.SMOKE, d0, d1, d2, 0.0D, 0.0D, 0.0D);
level.addParticle(ParticleTypes.FLAME, d0, d1, d2, 0.0D, 0.0D, 0.0D);
}
}
}
@Override
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> stateBuilder) {
stateBuilder.add(FACING);
}
}

View file

@ -1,6 +1,7 @@
package de.ellpeck.actuallyadditions.mod.blocks;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.phys.AABB;
import net.minecraft.world.phys.shapes.BooleanOp;
import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
@ -145,6 +146,14 @@ public class VoxelShapes {
static final VoxelShape SHAPE_W = Stream.of(Block.box(15, 1, 1, 16, 15, 15), Block.box(11, 3, 3, 15, 13, 13), Block.box(6, 7, 7, 12, 9, 9)).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get();
}
static final class TinyTorchShapes {
static final VoxelShape STANDING_AABB = Block.box(7, 0, 7, 9, 5, 9);
static final VoxelShape TORCH_NORTH_AABB = Block.box(7, 4, 13, 9, 9, 16);
static final VoxelShape TORCH_SOUTH_AABB = Block.box(7, 4, 0, 9, 9, 3);
static final VoxelShape TORCH_WEST_AABB = Block.box(13, 4, 7, 16, 9, 9);
static final VoxelShape TORCH_EAST_AABB = Block.box(0, 4, 7, 3, 9, 9);
}
public static class ShapeBuilder {
Stream.Builder<VoxelShape> shapes = Stream.builder();

View file

@ -13,6 +13,7 @@ public class ActuallyRecipes {
public static void init(IEventBus bus) {
SERIALIZERS.register(bus);
Types.RECIPE_TYPES.register(bus);
}
public static final RegistryObject<RecipeSerializer<?>> KEEP_DATA_SHAPED_RECIPE = SERIALIZERS.register(RecipeKeepDataShaped.NAME, RecipeKeepDataShaped.Serializer::new);
@ -29,14 +30,16 @@ public class ActuallyRecipes {
public static class Types {
public static final RecipeType<LaserRecipe> LASER = RecipeType.register(ActuallyAdditions.MODID + ":laser");
public static final RecipeType<EmpowererRecipe> EMPOWERING = RecipeType.register(ActuallyAdditions.MODID + ":empower");
public static final RecipeType<CrushingRecipe> CRUSHING = RecipeType.register(ActuallyAdditions.MODID + ":crushing");
public static final RecipeType<SolidFuelRecipe> SOLID_FUEL = RecipeType.register(ActuallyAdditions.MODID + ":solid_fuel");
public static final RecipeType<LiquidFuelRecipe> LIQUID_FUEL = RecipeType.register(ActuallyAdditions.MODID + ":liquid_fuel");
public static final RecipeType<PressingRecipe> PRESSING = RecipeType.register(ActuallyAdditions.MODID + ":pressing");
public static final RecipeType<FermentingRecipe> FERMENTING = RecipeType.register(ActuallyAdditions.MODID + ":fermenting");
public static final RecipeType<ColorChangeRecipe> COLOR_CHANGE = RecipeType.register(ActuallyAdditions.MODID + ":color_change");
public static final RecipeType<MiningLensRecipe> MINING_LENS = RecipeType.register(ActuallyAdditions.MODID + ":mining_lens");
public static final DeferredRegister<RecipeType<?>> RECIPE_TYPES = DeferredRegister.create(ForgeRegistries.RECIPE_TYPES, ActuallyAdditions.MODID);
public static final RegistryObject<RecipeType<LaserRecipe>> LASER = RECIPE_TYPES.register("laser", () -> new RecipeType<>() {});
public static final RegistryObject<RecipeType<EmpowererRecipe>> EMPOWERING = RECIPE_TYPES.register("empower", () -> new RecipeType<>() {});
public static final RegistryObject<RecipeType<CrushingRecipe>> CRUSHING = RECIPE_TYPES.register("crushing", () -> new RecipeType<>() {});
public static final RegistryObject<RecipeType<SolidFuelRecipe>> SOLID_FUEL = RECIPE_TYPES.register("solid_fuel", () -> new RecipeType<>() {});
public static final RegistryObject<RecipeType<LiquidFuelRecipe>> LIQUID_FUEL = RECIPE_TYPES.register("liquid_fuel", () -> new RecipeType<>() {});
public static final RegistryObject<RecipeType<PressingRecipe>> PRESSING = RECIPE_TYPES.register("pressing", () -> new RecipeType<>() {});
public static final RegistryObject<RecipeType<FermentingRecipe>> FERMENTING = RECIPE_TYPES.register("fermenting", () -> new RecipeType<>() {});
public static final RegistryObject<RecipeType<ColorChangeRecipe>> COLOR_CHANGE = RECIPE_TYPES.register("color_change", () -> new RecipeType<>() {});
public static final RegistryObject<RecipeType<MiningLensRecipe>> MINING_LENS = RECIPE_TYPES.register("mining_lens", () -> new RecipeType<>() {});
}
}

View file

@ -83,7 +83,7 @@ public class ColorChangeRecipe implements Recipe<Container> {
@Override
public RecipeType<?> getType() {
return ActuallyRecipes.Types.COLOR_CHANGE;
return ActuallyRecipes.Types.COLOR_CHANGE.get();
}
public static class Serializer implements RecipeSerializer<ColorChangeRecipe> {

View file

@ -94,7 +94,7 @@ public class CrushingRecipe implements Recipe<Container> {
@Override
@Nonnull
public RecipeType<?> getType() {
return ActuallyRecipes.Types.CRUSHING;
return ActuallyRecipes.Types.CRUSHING.get();
}
public ItemStack getOutputOne() {

View file

@ -117,7 +117,7 @@ public class EmpowererRecipe implements Recipe<Container> {
@Override
@Nonnull
public RecipeType<?> getType() {
return ActuallyRecipes.Types.EMPOWERING;
return ActuallyRecipes.Types.EMPOWERING.get();
}
public Ingredient getInput() {

View file

@ -117,7 +117,7 @@ public class FermentingRecipe implements Recipe<Container> {
@Nonnull
@Override
public RecipeType<?> getType() {
return ActuallyRecipes.Types.FERMENTING;
return ActuallyRecipes.Types.FERMENTING.get();
}
public static class Serializer implements RecipeSerializer<FermentingRecipe> {

View file

@ -90,7 +90,7 @@ public class LaserRecipe implements Recipe<Container> {
@Override
public RecipeType<?> getType() {
return ActuallyRecipes.Types.LASER;
return ActuallyRecipes.Types.LASER.get();
}
public static Optional<LaserRecipe> getRecipeForStack(ItemStack stack) {

View file

@ -103,7 +103,7 @@ public class LiquidFuelRecipe implements Recipe<Container> {
@Nonnull
@Override
public RecipeType<?> getType() {
return ActuallyRecipes.Types.LIQUID_FUEL;
return ActuallyRecipes.Types.LIQUID_FUEL.get();
}
public static class Serializer implements RecipeSerializer<LiquidFuelRecipe> {

View file

@ -89,7 +89,7 @@ public class MiningLensRecipe implements Recipe<Container>, WeightedEntry {
@Override
public RecipeType<?> getType() {
return ActuallyRecipes.Types.MINING_LENS;
return ActuallyRecipes.Types.MINING_LENS.get();
}
public static class Serializer implements RecipeSerializer<MiningLensRecipe> {

View file

@ -74,7 +74,7 @@ public class PressingRecipe implements Recipe<Container> {
@Override
public RecipeType<?> getType() {
return ActuallyRecipes.Types.PRESSING;
return ActuallyRecipes.Types.PRESSING.get();
}
public static class Serializer implements RecipeSerializer<PressingRecipe> {

View file

@ -77,7 +77,7 @@ public class SolidFuelRecipe implements Recipe<SingleItem> {
@Override
public RecipeType<?> getType() {
return ActuallyRecipes.Types.SOLID_FUEL;
return ActuallyRecipes.Types.SOLID_FUEL.get();
}
public static class Serializer implements RecipeSerializer<SolidFuelRecipe> {

View file

@ -56,8 +56,8 @@ public class FluidAA implements Supplier<Fluid> {
public FluidAA(String fluidName, String textureName) {
this.name = fluidName;
this.stillTexture = new ResourceLocation(ActuallyAdditions.MODID,textureName + "_still");
this.flowingTexture = new ResourceLocation(ActuallyAdditions.MODID,textureName + "_flowing");
this.stillTexture = new ResourceLocation(ActuallyAdditions.MODID, "block/" + textureName + "_still");
this.flowingTexture = new ResourceLocation(ActuallyAdditions.MODID, "block/" + textureName + "_flowing");
this.fluidType = InitFluids.FLUID_TYPES.register(name, () -> new FluidType(createTypeProperties()) {
@Override
public void initializeClient(Consumer<IClientFluidTypeExtensions> consumer) {

View file

@ -1,97 +1,77 @@
///*
// * This file ("EmpowererRecipeCategory.java") is part of the Actually Additions mod for Minecraft.
// * It is created and owned by Ellpeck and distributed
// * under the Actually Additions License to be found at
// * http://ellpeck.de/actaddlicense
// * View the source code at https://github.com/Ellpeck/ActuallyAdditions
// *
// * © 2015-2017 Ellpeck
// */
//
//package de.ellpeck.actuallyadditions.mod.jei;
//
//import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
//import de.ellpeck.actuallyadditions.mod.crafting.EmpowererRecipe;
//import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
//import mezz.jei.api.constants.VanillaTypes;
//import mezz.jei.api.gui.IRecipeLayout;
//import mezz.jei.api.gui.drawable.IDrawable;
//import mezz.jei.api.gui.drawable.IDrawableStatic;
//import mezz.jei.api.helpers.IGuiHelper;
//import mezz.jei.api.ingredients.IIngredients;
//import mezz.jei.api.recipe.category.IRecipeCategory;
//import net.minecraft.client.resources.language.I18n;
//import net.minecraft.resources.ResourceLocation;
//import net.minecraft.world.item.ItemStack;
//
//import java.util.ArrayList;
//import java.util.Arrays;
//
//public class EmpowererRecipeCategory implements IRecipeCategory<EmpowererRecipe> {
//
// public static final ResourceLocation ID = new ResourceLocation(ActuallyAdditions.MODID, "empowerer_jei");
//
// private final IDrawableStatic background;
//
// public EmpowererRecipeCategory(IGuiHelper helper) {
// this.background = helper.drawableBuilder(AssetUtil.getGuiLocation("gui_nei_empowerer"), 0, 0, 135, 80).setTextureSize(256,256).build();
// }
//
// @Override
// public ResourceLocation getUid() {
// return ID;
// }
//
// @Override
// public Class<? extends EmpowererRecipe> getRecipeClass() {
// return EmpowererRecipe.class;
// }
//
// @Override
// public String getTitle() {
// return I18n.get("container.actuallyadditions.empowerer");
// }
//
// @Override
// public IDrawable getBackground() {
// return background;
// }
//
// @Override
// public IDrawable getIcon() {
// return null;
// }
//
// @Override
// public void setIngredients(EmpowererRecipe empowererRecipe, IIngredients ingredients) {
// ArrayList<ItemStack> input = new ArrayList<>();
// input.addAll(Arrays.asList(empowererRecipe.getInput().getItems()));
// input.addAll(Arrays.asList(empowererRecipe.getStandOne().getItems()));
// input.addAll(Arrays.asList(empowererRecipe.getStandTwo().getItems()));
// input.addAll(Arrays.asList(empowererRecipe.getStandThree().getItems()));
// input.addAll(Arrays.asList(empowererRecipe.getStandFour().getItems()));
// ingredients.setInputs(VanillaTypes.ITEM, input);
// ingredients.setOutput(VanillaTypes.ITEM, empowererRecipe.getOutput());
// }
//
// @Override
// public void setRecipe(IRecipeLayout recipeLayout, EmpowererRecipe recipe, IIngredients ingredients) {
// recipeLayout.getItemStacks().init(0, true, 31, 31);
// recipeLayout.getItemStacks().set(0, Arrays.asList(recipe.getInput().getItems()));
//
// recipeLayout.getItemStacks().init(1, true, 1, 31);
// recipeLayout.getItemStacks().set(1, Arrays.asList(recipe.getStandOne().getItems()));
//
// recipeLayout.getItemStacks().init(2, true, 31, 1);
// recipeLayout.getItemStacks().set(2, Arrays.asList(recipe.getStandTwo().getItems()));
//
// recipeLayout.getItemStacks().init(3, true, 61, 31);
// recipeLayout.getItemStacks().set(3, Arrays.asList(recipe.getStandThree().getItems()));
//
// recipeLayout.getItemStacks().init(4, true, 31, 61);
// recipeLayout.getItemStacks().set(4, Arrays.asList(recipe.getStandFour().getItems()));
//
// recipeLayout.getItemStacks().init(5, false, 112, 31);
// recipeLayout.getItemStacks().set(5, recipe.getResultItem());
// }
//}
/*
* This file ("EmpowererRecipeCategory.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
* http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
* © 2015-2017 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.jei;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.crafting.EmpowererRecipe;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import mezz.jei.api.gui.builder.IRecipeLayoutBuilder;
import mezz.jei.api.gui.drawable.IDrawable;
import mezz.jei.api.gui.drawable.IDrawableStatic;
import mezz.jei.api.helpers.IGuiHelper;
import mezz.jei.api.recipe.IFocusGroup;
import mezz.jei.api.recipe.RecipeIngredientRole;
import mezz.jei.api.recipe.RecipeType;
import mezz.jei.api.recipe.category.IRecipeCategory;
import net.minecraft.client.Minecraft;
import net.minecraft.client.multiplayer.ClientLevel;
import net.minecraft.core.RegistryAccess;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
public class EmpowererRecipeCategory implements IRecipeCategory<EmpowererRecipe> {
public static final ResourceLocation ID = new ResourceLocation(ActuallyAdditions.MODID, "empowerer_jei");
private final IDrawableStatic background;
public EmpowererRecipeCategory(IGuiHelper helper) {
this.background = helper.drawableBuilder(AssetUtil.getGuiLocation("gui_nei_empowerer"), 0, 0, 135, 80).setTextureSize(256,256).build();
}
@Override
public RecipeType<EmpowererRecipe> getRecipeType() {
return JEIActuallyAdditionsPlugin.EMPOWERER;
}
@Override
public Component getTitle() {
return Component.translatable("container.actuallyadditions.empowerer");
}
@Override
public IDrawable getBackground() {
return background;
}
@Override
public IDrawable getIcon() {
return null;
}
@Override
public void setRecipe(IRecipeLayoutBuilder builder, EmpowererRecipe recipe, IFocusGroup focuses) {
Minecraft minecraft = Minecraft.getInstance();
ClientLevel level = minecraft.level;
if (level == null) {
throw new NullPointerException("level must not be null.");
}
RegistryAccess registryAccess = level.registryAccess();
builder.addSlot(RecipeIngredientRole.INPUT, 32, 32).addIngredients(recipe.getInput());
builder.addSlot(RecipeIngredientRole.INPUT, 2, 32).addIngredients(recipe.getStandOne());
builder.addSlot(RecipeIngredientRole.INPUT, 32, 2).addIngredients(recipe.getStandTwo());
builder.addSlot(RecipeIngredientRole.INPUT, 62, 32).addIngredients(recipe.getStandThree());
builder.addSlot(RecipeIngredientRole.INPUT, 32, 62).addIngredients(recipe.getStandFour());
builder.addSlot(RecipeIngredientRole.OUTPUT, 113, 32).addItemStack(recipe.getResultItem(registryAccess));
}
}

View file

@ -1,84 +1,88 @@
//package de.ellpeck.actuallyadditions.mod.jei;
package de.ellpeck.actuallyadditions.mod.jei;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.crafting.FermentingRecipe;
import de.ellpeck.actuallyadditions.mod.inventory.gui.FluidDisplay;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import mezz.jei.api.gui.builder.IRecipeLayoutBuilder;
import mezz.jei.api.gui.drawable.IDrawable;
import mezz.jei.api.gui.drawable.IDrawableStatic;
import mezz.jei.api.gui.ingredient.IRecipeSlotsView;
import mezz.jei.api.helpers.IGuiHelper;
import mezz.jei.api.recipe.IFocusGroup;
import mezz.jei.api.recipe.RecipeIngredientRole;
import mezz.jei.api.recipe.RecipeType;
import mezz.jei.api.recipe.category.IRecipeCategory;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidType;
public class FermentingCategory implements IRecipeCategory<FermentingRecipe> {
private final IDrawableStatic background;
private final IDrawableStatic fluidBackground;
public FermentingCategory(IGuiHelper guiHelper) {
background = guiHelper.drawableBuilder(new ResourceLocation(ActuallyAdditions.MODID, "textures/gui/gui_fermenting_barrel.png"), 41, 4, 94, 86).setTextureSize(256,256).build();
fluidBackground = guiHelper.drawableBuilder(AssetUtil.GUI_INVENTORY_LOCATION, 0, 171, 18, 85).build();
}
@Override
public RecipeType<FermentingRecipe> getRecipeType() {
return JEIActuallyAdditionsPlugin.FERMENTING;
}
@Override
public Component getTitle() {
return Component.literal("Fermenting Recipe");
}
@Override
public IDrawable getBackground() {
return background;
}
@Override
public IDrawable getIcon() {
return null;
}
@Override
public void setRecipe(IRecipeLayoutBuilder builder, FermentingRecipe recipe, IFocusGroup focuses) {
// int maxFluid = Math.max(FluidType.BUCKET_VOLUME, Math.max(recipe.getInput().getAmount(), recipe.getOutput().getAmount()));
// recipe.setInputDisplay(new FluidDisplay(19, 1, recipe.getInput(), maxFluid, false));
// recipe.setOutputDisplay(new FluidDisplay(19+38, 1, recipe.getOutput(), maxFluid, false));
FluidStack input = recipe.getInput();
int height = (int)(83D / 1000 * input.getAmount());
int offset = 83 - height;
builder.addSlot(RecipeIngredientRole.INPUT, 20, 1 + offset)
.addFluidStack(input.getFluid(), input.getAmount())
.setFluidRenderer(input.getAmount(), false, 16, height)
.setBackground(fluidBackground, -1, -1 - offset);
FluidStack output = recipe.getOutput();
height = (int)(83D / 1000 * input.getAmount());
offset = 83 - height;;
builder.addSlot(RecipeIngredientRole.OUTPUT, 20+38, 1 + offset)
.addFluidStack(output.getFluid(), output.getAmount())
.setFluidRenderer(output.getAmount(), false, 16, height)
.setBackground(fluidBackground, -1, -1 - offset);
}
@Override
public void draw(FermentingRecipe recipe, IRecipeSlotsView recipeSlotsView, GuiGraphics guiGraphics, double mouseX, double mouseY) {
// IRecipeCategory.super.draw(recipe, recipeSlotsView, guiGraphics, mouseX, mouseY);
// recipe.getInputDisplay().ifPresent(display -> {
// display.draw(guiGraphics);
// display.render(guiGraphics, (int) mouseX, (int) mouseY);
// });
//
//import com.mojang.blaze3d.vertex.PoseStack;
//import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
//import de.ellpeck.actuallyadditions.mod.crafting.FermentingRecipe;
//import de.ellpeck.actuallyadditions.mod.inventory.gui.FluidDisplay;
//import mezz.jei.api.constants.VanillaTypes;
//import mezz.jei.api.gui.IRecipeLayout;
//import mezz.jei.api.gui.drawable.IDrawable;
//import mezz.jei.api.gui.drawable.IDrawableStatic;
//import mezz.jei.api.helpers.IGuiHelper;
//import mezz.jei.api.ingredients.IIngredients;
//import mezz.jei.api.recipe.category.IRecipeCategory;
//import net.minecraft.resources.ResourceLocation;
//import net.minecraftforge.fluids.FluidAttributes;
//
//import javax.annotation.Nonnull;
//
//public class FermentingCategory implements IRecipeCategory<FermentingRecipe> {
// public static final ResourceLocation ID = new ResourceLocation(ActuallyAdditions.MODID, "fermenting_jei");
//
// private final IDrawableStatic background;
//
// public FermentingCategory(IGuiHelper guiHelper) {
// background = guiHelper.drawableBuilder(new ResourceLocation(ActuallyAdditions.MODID, "textures/gui/gui_fermenting_barrel.png"), 41, 4, 94, 86).setTextureSize(256,256).build();
// }
//
// @Override
// public ResourceLocation getUid() {
// return ID;
// }
//
// @Override
// public Class<? extends FermentingRecipe> getRecipeClass() {
// return FermentingRecipe.class;
// }
//
// @Override
// public String getTitle() {
// return "Fermenting Recipe";
// }
//
// @Override
// public IDrawable getBackground() {
// return background;
// }
//
// @Override
// public IDrawable getIcon() {
// return null;
// }
//
// @Override
// public void setIngredients(@Nonnull FermentingRecipe fermentingRecipe, @Nonnull IIngredients ingredients) {
// ingredients.setInput(VanillaTypes.FLUID, fermentingRecipe.getInput());
// ingredients.setOutput(VanillaTypes.FLUID, fermentingRecipe.getOutput());
// }
//
// @Override
// public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull FermentingRecipe fermentingRecipe, @Nonnull IIngredients ingredients) {
// int maxFluid = Math.max(FluidType.BUCKET_VOLUME, Math.max(fermentingRecipe.getInput().getAmount(), fermentingRecipe.getOutput().getAmount()));
//
// fermentingRecipe.setInputDisplay(new FluidDisplay(19, 1, fermentingRecipe.getInput(), maxFluid, false));
// fermentingRecipe.setOutputDisplay(new FluidDisplay(19+38, 1, fermentingRecipe.getOutput(), maxFluid, false));
// }
//
// @Override
// public void draw(FermentingRecipe recipe, PoseStack matrixStack, double mouseX, double mouseY) {
// IRecipeCategory.super.draw(recipe, matrixStack, mouseX, mouseY);
//
// recipe.getInputDisplay().ifPresent(display -> {
// display.draw(matrixStack);
// display.render(matrixStack, (int) mouseX, (int) mouseY);
// });
//
// recipe.getOutputDisplay().ifPresent(display -> {
// display.draw(matrixStack);
// display.render(matrixStack, (int) mouseX, (int) mouseY);
// });
//
//
// //TODO draw the progress indicator, scaled to the recipe duration.
// }
//}
// recipe.getOutputDisplay().ifPresent(display -> {
// display.draw(guiGraphics);
// display.render(guiGraphics, (int) mouseX, (int) mouseY);
// });
//TODO draw the progress indicator, scaled to the recipe duration.
}
}

View file

@ -11,11 +11,17 @@
package de.ellpeck.actuallyadditions.mod.jei;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
import de.ellpeck.actuallyadditions.mod.crafting.ActuallyRecipes;
import de.ellpeck.actuallyadditions.mod.crafting.EmpowererRecipe;
import de.ellpeck.actuallyadditions.mod.crafting.FermentingRecipe;
import de.ellpeck.actuallyadditions.mod.crafting.LaserRecipe;
import de.ellpeck.actuallyadditions.mod.items.ActuallyItems;
import mezz.jei.api.IModPlugin;
import mezz.jei.api.JeiPlugin;
import mezz.jei.api.constants.RecipeTypes;
import mezz.jei.api.helpers.IJeiHelpers;
import mezz.jei.api.recipe.RecipeType;
import mezz.jei.api.registration.IRecipeCatalystRegistration;
import mezz.jei.api.registration.IRecipeCategoryRegistration;
import mezz.jei.api.registration.IRecipeRegistration;
@ -32,13 +38,17 @@ public class JEIActuallyAdditionsPlugin implements IModPlugin {
return ID;
}
public static final RecipeType<FermentingRecipe> FERMENTING = RecipeType.create(ActuallyAdditions.MODID, "fermenting", FermentingRecipe.class);
public static final RecipeType<LaserRecipe> LASER = RecipeType.create(ActuallyAdditions.MODID, "laser", LaserRecipe.class);
public static final RecipeType<EmpowererRecipe> EMPOWERER = RecipeType.create(ActuallyAdditions.MODID, "empowerer", EmpowererRecipe.class);
@Override
public void registerCategories(IRecipeCategoryRegistration registry) {
IJeiHelpers helpers = registry.getJeiHelpers();
// registry.addRecipeCategories(new FermentingCategory(helpers.getGuiHelper())); //TODO: re-enable after refactor jei compat
// registry.addRecipeCategories(new LaserRecipeCategory(helpers.getGuiHelper())); //TODO: re-enable after refactor jei compat
// registry.addRecipeCategories(new EmpowererRecipeCategory(helpers.getGuiHelper())); //TODO: re-enable after refactor jei compat
registry.addRecipeCategories(new FermentingCategory(helpers.getGuiHelper())); //TODO: re-enable after refactor jei compat
registry.addRecipeCategories(new LaserRecipeCategory(helpers.getGuiHelper())); //TODO: re-enable after refactor jei compat
registry.addRecipeCategories(new EmpowererRecipeCategory(helpers.getGuiHelper())); //TODO: re-enable after refactor jei compat
//registry.addRecipeCategories(new CoffeeMachineRecipeCategory(helpers.getGuiHelper()), new CompostRecipeCategory(helpers.getGuiHelper()), new CrusherRecipeCategory(helpers.getGuiHelper()), new ReconstructorRecipeCategory(helpers.getGuiHelper()), new EmpowererRecipeCategory(helpers.getGuiHelper()), new BookletRecipeCategory(helpers.getGuiHelper()));
}
@ -46,9 +56,9 @@ public class JEIActuallyAdditionsPlugin implements IModPlugin {
@Override
public void registerRecipeCatalysts(IRecipeCatalystRegistration registry) {
registry.addRecipeCatalyst(new ItemStack(ActuallyItems.CRAFTER_ON_A_STICK.get()), RecipeTypes.CRAFTING);
// registry.addRecipeCatalyst(new ItemStack(ActuallyBlocks.FERMENTING_BARREL.getItem()), FermentingCategory.ID); //TODO: re-enable after refactor jei compat
// registry.addRecipeCatalyst(new ItemStack(ActuallyBlocks.ATOMIC_RECONSTRUCTOR.getItem()), LaserRecipeCategory.ID); //TODO: re-enable after refactor jei compat
// registry.addRecipeCatalyst(new ItemStack(ActuallyBlocks.EMPOWERER.getItem()), EmpowererRecipeCategory.ID); //TODO: re-enable after refactor jei compat
registry.addRecipeCatalyst(new ItemStack(ActuallyBlocks.FERMENTING_BARREL.getItem()), FERMENTING); //TODO: re-enable after refactor jei compat
registry.addRecipeCatalyst(new ItemStack(ActuallyBlocks.ATOMIC_RECONSTRUCTOR.getItem()), LASER); //TODO: re-enable after refactor jei compat
registry.addRecipeCatalyst(new ItemStack(ActuallyBlocks.EMPOWERER.getItem()), EMPOWERER); //TODO: re-enable after refactor jei compat
// registry.addRecipeCatalyst(new ItemStack(ActuallyBlocks.blockFurnaceDouble.get()), VanillaRecipeCategoryUid.SMELTING);
// registry.addRecipeCatalyst(new ItemStack(ActuallyBlocks.blockGrinder.get()), CrusherRecipeCategory.NAME);
@ -64,9 +74,9 @@ public class JEIActuallyAdditionsPlugin implements IModPlugin {
public void registerRecipes(IRecipeRegistration registry) {
Level level = Minecraft.getInstance().level;
// registry.addRecipes(level.getRecipeManager().getAllRecipesFor(ActuallyRecipes.Types.FERMENTING), FermentingCategory.ID); //TODO: re-enable after refactor jei compat
// registry.addRecipes(level.getRecipeManager().getAllRecipesFor(ActuallyRecipes.Types.LASER), LaserRecipeCategory.ID); //TODO: re-enable after refactor jei compat
// registry.addRecipes(level.getRecipeManager().getAllRecipesFor(ActuallyRecipes.Types.EMPOWERING), EmpowererRecipeCategory.ID); //TODO: re-enable after refactor jei compat
registry.addRecipes(FERMENTING, level.getRecipeManager().getAllRecipesFor(ActuallyRecipes.Types.FERMENTING.get())); //TODO: re-enable after refactor jei compat
registry.addRecipes(LASER, level.getRecipeManager().getAllRecipesFor(ActuallyRecipes.Types.LASER.get())); //TODO: re-enable after refactor jei compat
registry.addRecipes(EMPOWERER, level.getRecipeManager().getAllRecipesFor(ActuallyRecipes.Types.EMPOWERING.get())); //TODO: re-enable after refactor jei compat
//registry.addRecipes(ActuallyAdditionsAPI.BOOKLET_PAGES_WITH_ITEM_OR_FLUID_DATA, BookletRecipeCategory.NAME);

View file

@ -1,83 +1,72 @@
///*
// * This file ("ReconstructorRecipeCategory.java") is part of the Actually Additions mod for Minecraft.
// * It is created and owned by Ellpeck and distributed
// * under the Actually Additions License to be found at
// * http://ellpeck.de/actaddlicense
// * View the source code at https://github.com/Ellpeck/ActuallyAdditions
// *
// * © 2015-2017 Ellpeck
// */
//
//package de.ellpeck.actuallyadditions.mod.jei;
//
//import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
//import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
//import de.ellpeck.actuallyadditions.mod.crafting.LaserRecipe;
//import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
//import mezz.jei.api.constants.VanillaTypes;
//import mezz.jei.api.gui.IRecipeLayout;
//import mezz.jei.api.gui.drawable.IDrawable;
//import mezz.jei.api.gui.drawable.IDrawableStatic;
//import mezz.jei.api.helpers.IGuiHelper;
//import mezz.jei.api.ingredients.IIngredients;
//import mezz.jei.api.recipe.category.IRecipeCategory;
//import net.minecraft.network.chat.TranslatableComponent;
//import net.minecraft.resources.ResourceLocation;
//import net.minecraft.world.item.ItemStack;
//
//import javax.annotation.Nonnull;
//import java.util.Arrays;
//
//public class LaserRecipeCategory implements IRecipeCategory<LaserRecipe> {
//
// public static final ResourceLocation ID = new ResourceLocation(ActuallyAdditions.MODID, "laser_jei");
// private final IDrawableStatic background;
// private final ItemStack RECONSTRUCTOR = new ItemStack(ActuallyBlocks.ATOMIC_RECONSTRUCTOR.getItem());
//
// public LaserRecipeCategory(IGuiHelper helper) {
// this.background = helper.drawableBuilder(AssetUtil.getGuiLocation("gui_nei_atomic_reconstructor"), 0, 0, 96, 60).setTextureSize(256,256).build();
// }
//
// @Override
// public ResourceLocation getUid() {
// return ID;
// }
//
// @Override
// public Class<? extends LaserRecipe> getRecipeClass() {
// return LaserRecipe.class;
// }
//
// @Override
// public String getTitle() {
// return Component.translatable("container.actuallyadditions.reconstructor").getString();
// }
//
// @Override
// public IDrawable getBackground() {
// return this.background;
// }
//
// @Override
// public IDrawable getIcon() {
// return null;
// }
//
// @Override
// public void setIngredients(LaserRecipe laserRecipe, IIngredients ingredients) {
// ingredients.setInputs(VanillaTypes.ITEM, Arrays.asList(laserRecipe.getInput().getItems()));
// ingredients.setOutput(VanillaTypes.ITEM, laserRecipe.getResultItem());
// }
//
// @Override
// public void setRecipe(@Nonnull IRecipeLayout layout, @Nonnull LaserRecipe laserRecipe, @Nonnull IIngredients iIngredients) {
// layout.getItemStacks().init(0, true, 4, 18);
// layout.getItemStacks().set(0, iIngredients.getInputs(VanillaTypes.ITEM).get(0));
//
// layout.getItemStacks().init(1, false, 34, 19);
// layout.getItemStacks().set(1, RECONSTRUCTOR);
//
// layout.getItemStacks().init(2, false, 66, 18);
// layout.getItemStacks().set(2, iIngredients.getOutputs(VanillaTypes.ITEM).get(0));
// }
//}
/*
* This file ("ReconstructorRecipeCategory.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
* http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
* © 2015-2017 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.jei;
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
import de.ellpeck.actuallyadditions.mod.crafting.LaserRecipe;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import mezz.jei.api.gui.builder.IRecipeLayoutBuilder;
import mezz.jei.api.gui.drawable.IDrawable;
import mezz.jei.api.gui.drawable.IDrawableStatic;
import mezz.jei.api.helpers.IGuiHelper;
import mezz.jei.api.recipe.IFocusGroup;
import mezz.jei.api.recipe.RecipeIngredientRole;
import mezz.jei.api.recipe.RecipeType;
import mezz.jei.api.recipe.category.IRecipeCategory;
import net.minecraft.client.Minecraft;
import net.minecraft.client.multiplayer.ClientLevel;
import net.minecraft.core.RegistryAccess;
import net.minecraft.network.chat.Component;
import net.minecraft.world.item.ItemStack;
public class LaserRecipeCategory implements IRecipeCategory<LaserRecipe> {
private final IDrawableStatic background;
private final ItemStack RECONSTRUCTOR = new ItemStack(ActuallyBlocks.ATOMIC_RECONSTRUCTOR.getItem());
public LaserRecipeCategory(IGuiHelper helper) {
this.background = helper.drawableBuilder(AssetUtil.getGuiLocation("gui_nei_atomic_reconstructor"), 0, 0, 96, 60).setTextureSize(256,256).build();
}
@Override
public RecipeType<LaserRecipe> getRecipeType() {
return JEIActuallyAdditionsPlugin.LASER;
}
@Override
public Component getTitle() {
return Component.translatable("container.actuallyadditions.reconstructor");
}
@Override
public IDrawable getBackground() {
return this.background;
}
@Override
public IDrawable getIcon() {
return null;
}
@Override
public void setRecipe(IRecipeLayoutBuilder builder, LaserRecipe recipe, IFocusGroup focuses) {
Minecraft minecraft = Minecraft.getInstance();
ClientLevel level = minecraft.level;
if (level == null) {
throw new NullPointerException("level must not be null.");
}
RegistryAccess registryAccess = level.registryAccess();
builder.addSlot(RecipeIngredientRole.INPUT, 5, 19).addIngredients(recipe.getInput());
builder.addSlot(RecipeIngredientRole.INPUT, 35, 20).addItemStack(RECONSTRUCTOR);
builder.addSlot(RecipeIngredientRole.OUTPUT, 66, 19).addItemStack(recipe.getResultItem(registryAccess));
}
}

View file

@ -45,7 +45,7 @@ public class TileEntityEmpowerer extends TileEntityInventoryBase {
}
public static boolean isPossibleInput(ItemStack stack) {
for (EmpowererRecipe r : ServerLifecycleHooks.getCurrentServer().getRecipeManager().getAllRecipesFor(ActuallyRecipes.Types.EMPOWERING)) {
for (EmpowererRecipe r : ServerLifecycleHooks.getCurrentServer().getRecipeManager().getAllRecipesFor(ActuallyRecipes.Types.EMPOWERING.get())) {
if (r.getInput().test(stack)) {
return true;
}
@ -55,7 +55,7 @@ public class TileEntityEmpowerer extends TileEntityInventoryBase {
@Nullable
public static EmpowererRecipe findMatchingRecipe(ItemStack base, ItemStack stand1, ItemStack stand2, ItemStack stand3, ItemStack stand4) {
for (EmpowererRecipe r : ServerLifecycleHooks.getCurrentServer().getRecipeManager().getAllRecipesFor(ActuallyRecipes.Types.EMPOWERING)) {
for (EmpowererRecipe r : ServerLifecycleHooks.getCurrentServer().getRecipeManager().getAllRecipesFor(ActuallyRecipes.Types.EMPOWERING.get())) {
if (r.matches(base, stand1, stand2, stand3, stand4)) {
return r;
}

View file

@ -19,30 +19,30 @@ public class ResourceReloader implements ResourceManagerReloadListener {
public void onResourceManagerReload(ResourceManager pResourceManager) {
RecipeManager recipeManager = data.getRecipeManager();
ActuallyAdditionsAPI.EMPOWERER_RECIPES.clear();
ActuallyAdditionsAPI.EMPOWERER_RECIPES.addAll(recipeManager.getAllRecipesFor(ActuallyRecipes.Types.EMPOWERING));
ActuallyAdditionsAPI.EMPOWERER_RECIPES.addAll(recipeManager.getAllRecipesFor(ActuallyRecipes.Types.EMPOWERING.get()));
ActuallyAdditionsAPI.SOLID_FUEL_RECIPES.clear();
ActuallyAdditionsAPI.SOLID_FUEL_RECIPES.addAll(recipeManager.getAllRecipesFor(ActuallyRecipes.Types.SOLID_FUEL));
ActuallyAdditionsAPI.SOLID_FUEL_RECIPES.addAll(recipeManager.getAllRecipesFor(ActuallyRecipes.Types.SOLID_FUEL.get()));
ActuallyAdditionsAPI.LIQUID_FUEL_RECIPES.clear();
ActuallyAdditionsAPI.LIQUID_FUEL_RECIPES.addAll(recipeManager.getAllRecipesFor(ActuallyRecipes.Types.LIQUID_FUEL));
ActuallyAdditionsAPI.LIQUID_FUEL_RECIPES.addAll(recipeManager.getAllRecipesFor(ActuallyRecipes.Types.LIQUID_FUEL.get()));
ActuallyAdditionsAPI.PRESSING_RECIPES.clear();
ActuallyAdditionsAPI.PRESSING_RECIPES.addAll(recipeManager.getAllRecipesFor(ActuallyRecipes.Types.PRESSING));
ActuallyAdditionsAPI.PRESSING_RECIPES.addAll(recipeManager.getAllRecipesFor(ActuallyRecipes.Types.PRESSING.get()));
ActuallyAdditionsAPI.FERMENTING_RECIPES.clear();
ActuallyAdditionsAPI.FERMENTING_RECIPES.addAll(recipeManager.getAllRecipesFor(ActuallyRecipes.Types.FERMENTING));
ActuallyAdditionsAPI.FERMENTING_RECIPES.addAll(recipeManager.getAllRecipesFor(ActuallyRecipes.Types.FERMENTING.get()));
ActuallyAdditionsAPI.CONVERSION_LASER_RECIPES.clear();
ActuallyAdditionsAPI.CONVERSION_LASER_RECIPES.addAll(recipeManager.getAllRecipesFor(ActuallyRecipes.Types.LASER));
ActuallyAdditionsAPI.CONVERSION_LASER_RECIPES.addAll(recipeManager.getAllRecipesFor(ActuallyRecipes.Types.LASER.get()));
ActuallyAdditionsAPI.COLOR_CHANGE_RECIPES.clear();
ActuallyAdditionsAPI.COLOR_CHANGE_RECIPES.addAll(recipeManager.getAllRecipesFor(ActuallyRecipes.Types.COLOR_CHANGE));
ActuallyAdditionsAPI.COLOR_CHANGE_RECIPES.addAll(recipeManager.getAllRecipesFor(ActuallyRecipes.Types.COLOR_CHANGE.get()));
ActuallyAdditionsAPI.MINING_LENS_RECIPES.clear();
ActuallyAdditionsAPI.MINING_LENS_RECIPES.addAll(recipeManager.getAllRecipesFor(ActuallyRecipes.Types.MINING_LENS));
ActuallyAdditionsAPI.MINING_LENS_RECIPES.addAll(recipeManager.getAllRecipesFor(ActuallyRecipes.Types.MINING_LENS.get()));
ActuallyAdditionsAPI.CRUSHER_RECIPES.clear();
ActuallyAdditionsAPI.CRUSHER_RECIPES.addAll(recipeManager.getAllRecipesFor(ActuallyRecipes.Types.CRUSHING));
ActuallyAdditionsAPI.CRUSHER_RECIPES.addAll(recipeManager.getAllRecipesFor(ActuallyRecipes.Types.CRUSHING.get()));
}
}

View file

@ -19,6 +19,10 @@
"fluid.actuallyadditions.canola_oil": "Canola Oil",
"fluid.actuallyadditions.crystallized_oil": "Crystallized Oil",
"fluid.actuallyadditions.empowered_oil": "Empowered Oil",
"fluid_type.actuallyadditions.refined_canola_oil": "Refined Canola Oil",
"fluid_type.actuallyadditions.canola_oil": "Canola Oil",
"fluid_type.actuallyadditions.crystallized_oil": "Crystallized Oil",
"fluid_type.actuallyadditions.empowered_oil": "Empowered Oil",
"_comment": "Entities",
"entity.Villager.actuallyadditions.jammer": "Jam Guy",
"entity.Villager.actuallyadditions.crystallizer": "Crystallizer",
@ -213,7 +217,7 @@
"block.actuallyadditions.booklet_stand": "Wall-Mount Manual (wip)",
"block.actuallyadditions.display_stand": "Display Stand",
"block.actuallyadditions.shock_suppressor": "Shock Absorber (wip)",
"block.actuallyadditions.tiny_torch": "Tiny Torch (wip)",
"block.actuallyadditions.tiny_torch": "Tiny Torch",
"block.actuallyadditions.empowerer": "Empowerer",
"block.actuallyadditions.distributor_item": "Item Distributor (wip)",
"block.actuallyadditions.bio_reactor": "Bio Reactor (wip)",

View file

@ -1,5 +1,5 @@
{
"textures": {
"particle": "actuallyadditions:fluid/canola_oil_still"
"particle": "actuallyadditions:block/fluid/canola_oil_still"
}
}

View file

@ -1,5 +1,5 @@
{
"textures": {
"particle": "actuallyadditions:fluid/crystallized_oil_still"
"particle": "actuallyadditions:block/fluid/crystallized_oil_still"
}
}

View file

@ -1,5 +1,5 @@
{
"textures": {
"particle": "actuallyadditions:fluid/empowered_oil_still"
"particle": "actuallyadditions:block/fluid/empowered_oil_still"
}
}

View file

@ -1,5 +1,5 @@
{
"textures": {
"particle": "actuallyadditions:fluid/refined_canola_oil_still"
"particle": "actuallyadditions:block/fluid/refined_canola_oil_still"
}
}

View file

@ -0,0 +1,34 @@
{
"ambientocclusion": false,
"textures": {
"particle": "actuallyadditions:block/tiny_torch",
"torch": "actuallyadditions:block/tiny_torch"
},
"render_type": "minecraft:cutout",
"elements": [
{ "from": [ 7, 0, 7 ],
"to": [ 9, 5, 9 ],
"shade": false,
"faces": {
"down": { "uv": [ 7, 13, 9, 15 ], "texture": "#torch" },
"up": { "uv": [ 7, 11, 9, 13 ], "texture": "#torch" }
}
},
{ "from": [ 7, 0, 0 ],
"to": [ 9, 16, 16 ],
"shade": false,
"faces": {
"west": { "uv": [ 0, 0, 16, 16 ], "texture": "#torch" },
"east": { "uv": [ 0, 0, 16, 16 ], "texture": "#torch" }
}
},
{ "from": [ 0, 0, 7 ],
"to": [ 16, 16, 9 ],
"shade": false,
"faces": {
"north": { "uv": [ 0, 0, 16, 16 ], "texture": "#torch" },
"south": { "uv": [ 0, 0, 16, 16 ], "texture": "#torch" }
}
}
]
}

View file

@ -0,0 +1,37 @@
{
"ambientocclusion": false,
"textures": {
"particle": "actuallyadditions:block/tiny_torch",
"torch": "actuallyadditions:block/tiny_torch"
},
"render_type": "minecraft:cutout",
"elements": [
{ "from": [ -1, 3.5, 7 ],
"to": [ 1, 8.5, 9 ],
"rotation": { "origin": [ 0, 3.5, 8 ], "axis": "z", "angle": -22.5 },
"shade": false,
"faces": {
"down": { "uv": [ 7, 13, 9, 15 ], "texture": "#torch" },
"up": { "uv": [ 7, 11, 9, 13 ], "texture": "#torch" }
}
},
{ "from": [ -1, 3.5, 0 ],
"to": [ 1, 19.5, 16 ],
"rotation": { "origin": [ 0, 3.5, 8 ], "axis": "z", "angle": -22.5 },
"shade": false,
"faces": {
"west": { "uv": [ 0, 0, 16, 16 ], "texture": "#torch" },
"east": { "uv": [ 0, 0, 16, 16 ], "texture": "#torch" }
}
},
{ "from": [ -8, 3.5, 7 ],
"to": [ 8, 19.5, 9 ],
"rotation": { "origin": [ 0, 3.5, 8 ], "axis": "z", "angle": -22.5 },
"shade": false,
"faces": {
"north": { "uv": [ 0, 0, 16, 16 ], "texture": "#torch" },
"south": { "uv": [ 0, 0, 16, 16 ], "texture": "#torch" }
}
}
]
}