Skip to content

feat: magnetic crafting table - #587

Open
Kemmlow wants to merge 1 commit into
TeamGalacticraft:mainfrom
Kemmlow:main
Open

Kemmlow wants to merge 1 commit into
TeamGalacticraft:mainfrom
Kemmlow:main

Conversation

@Kemmlow

@Kemmlow Kemmlow commented Aug 11, 2026

Copy link
Copy Markdown

Closes #512.

  • Adds a Magnetic Crafting Table with a persistent 3×3 crafting grid.
  • Supports all six facing directions and wrench rotation.
  • Allows hopper/item-pipe insertion while preventing automated extraction.
  • Uses vanilla crafting, recipe-book, and shift-click behavior.
  • Ports the Galacticraft Legacy textures and recipe.
  • Adds JEI, REI, and EMI integration.
  • Omits Legacy autocrafting because vanilla now has the Crafter.

@LloydNA LloydNA left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@Roelymole Roelymole left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was away, so sorry it took me a little while to get to this.

I do have a few comments, but in general this is all looking very good!

protected void addTags(HolderLookup.Provider provider) {
this.tag(GCBlockTags.SEALABLE)
.add(GCBlocks.AIR_LOCK_SEAL)
.add(GCBlocks.MAGNETIC_CRAFTING_TABLE)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would have expected the magnetic crafting table to be sealable without being added to this list of exceptions.

Comment on lines +578 to +581
var textureMapping = new TextureMapping()
.put(TextureSlot.BOTTOM, TextureMapping.getBlockTexture(block, "_base"))
.put(TextureSlot.TOP, TextureMapping.getBlockTexture(block, "_top"))
.put(TextureSlot.SIDE, TextureMapping.getBlockTexture(block, "_side"));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest renaming the base texture to magnetic_crafting_table_bottom.png, then this can be simplified to TextureMapping.cubeBottomTop(block).

)
));
registry.register(SimpleTransferHandler.create(MagneticCraftingTableMenu.class, BuiltinPlugin.CRAFTING,
new SimpleTransferHandler.IntRange(1, 10)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be better to avoid hardcoding the start and end points of the range, especially since you have already defined constants with the values that are needed.

Suggested change
new SimpleTransferHandler.IntRange(1, 10)
new SimpleTransferHandler.IntRange(
MagneticCraftingTableMenu.CRAFT_SLOT_START,
MagneticCraftingTableMenu.CRAFT_SLOT_END
)

registration.addRecipeTransferHandler(FoodCannerMenu.class, null, GCJEIRecipeTypes.CANNING,
FoodCannerBlockEntity.INPUT_SLOT, FoodCannerBlockEntity.INPUT_LENGTH, FoodCannerBlockEntity.OUTPUT_SLOT + 1, 36);
registration.addRecipeTransferHandler(MagneticCraftingTableMenu.class, GCMenuTypes.MAGNETIC_CRAFTING_TABLE, RecipeTypes.CRAFTING,
1, 9, 10, 36);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be better to make use of the constants you have defined here as well rather than using 'magic numbers'.

They are unlikely to change in this case, but at the very least it would be more descriptive.

import java.util.List;
import java.util.stream.IntStream;

@SuppressWarnings("UnstableApiUsage")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps there was an instance of UnstableApiUsage that you were suppressing at some point, but there don't seem to be any now, so this should probably be removed.

@Override
public List<Slot> getCraftingSlots(MagneticCraftingTableMenu menu) {
List<Slot> slots = new ArrayList<>();
for (int slot = 1; slot < 10; ++slot) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similarly, it would be better to use the constants MagneticCraftingTableMenu.CRAFT_SLOT_START and MagneticCraftingTableMenu.CRAFT_SLOT_END here.

BlockEntity blockEntity = level.getBlockEntity(pos);
if (blockEntity instanceof MagneticCraftingTableBlockEntity craftingTable) {
player.openMenu(craftingTable);
player.awardStat(Stats.INTERACT_WITH_CRAFTING_TABLE);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be much better to add a stat dedicated to the magnetic crafting table. It should just be a case of adding a single line to GCStats and GCTranslationProvider, then rerunning the datagen Gradle task.

this.blockDesc(GCBlocks.FUEL_LOADER, "Loads fuel into a rocket placed on an adjacent launch pad.");
this.blockDesc(GCBlocks.GLOWSTONE_LANTERN, "Provides light, even in areas without oxygen.");
this.blockDesc(GCBlocks.GLOWSTONE_TORCH, "Provides light, even in areas without oxygen.");
this.blockDesc(GCBlocks.MAGNETIC_CRAFTING_TABLE, "Holds items in its crafting grid when closed. Hoppers can insert ingredients.");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not just hoppers that will be able to insert items, so it might be worth rewording this slightly.

// SPECIAL
public static final Block ROCKET_LAUNCH_PAD = BLOCKS.registerWithItem(Constant.Block.ROCKET_LAUNCH_PAD, new LaunchPadBlock(BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_LIGHT_GRAY).instrument(NoteBlockInstrument.BASEDRUM).strength(1.5F, 10.0F).requiresCorrectToolForDrops()));
public static final Block FUELING_PAD = BLOCKS.registerWithItem(Constant.Block.FUELING_PAD, new FuelPadBlock(BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_GRAY).instrument(NoteBlockInstrument.BASEDRUM).strength(1.5F, 10.0F).requiresCorrectToolForDrops()));
public static final Block MAGNETIC_CRAFTING_TABLE = BLOCKS.registerWithItem(Constant.Block.MAGNETIC_CRAFTING_TABLE, new MagneticCraftingTableBlock(BlockBehaviour.Properties.of().mapColor(MapColor.METAL).instrument(NoteBlockInstrument.BASEDRUM).strength(0.6F, 2.5F).sound(SoundType.METAL).requiresCorrectToolForDrops()));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The strength values seem a bit low, it might be worth playing around with them a bit to find something that feels a bit more balanced.

Comment on lines +584 to +606
generator.blockStateOutput.accept(MultiVariantGenerator.multiVariant(block).with(PropertyDispatch.property(MagneticCraftingTableBlock.FACING)
.select(Direction.DOWN, Variant.variant()
.with(VariantProperties.X_ROT, VariantProperties.Rotation.R180)
.with(VariantProperties.MODEL, model))
.select(Direction.UP, Variant.variant()
.with(VariantProperties.MODEL, model))
.select(Direction.NORTH, Variant.variant()
.with(VariantProperties.X_ROT, VariantProperties.Rotation.R90)
.with(VariantProperties.MODEL, model))
.select(Direction.SOUTH, Variant.variant()
.with(VariantProperties.X_ROT, VariantProperties.Rotation.R90)
.with(VariantProperties.Y_ROT, VariantProperties.Rotation.R180)
.with(VariantProperties.MODEL, model))
.select(Direction.WEST, Variant.variant()
.with(VariantProperties.X_ROT, VariantProperties.Rotation.R90)
.with(VariantProperties.Y_ROT, VariantProperties.Rotation.R270)
.with(VariantProperties.MODEL, model))
.select(Direction.EAST, Variant.variant()
.with(VariantProperties.X_ROT, VariantProperties.Rotation.R90)
.with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90)
.with(VariantProperties.MODEL, model))
));
generator.delegateItemModel(block, model);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are some helper functions that can be used to simplify this a great deal.

Suggested change
generator.blockStateOutput.accept(MultiVariantGenerator.multiVariant(block).with(PropertyDispatch.property(MagneticCraftingTableBlock.FACING)
.select(Direction.DOWN, Variant.variant()
.with(VariantProperties.X_ROT, VariantProperties.Rotation.R180)
.with(VariantProperties.MODEL, model))
.select(Direction.UP, Variant.variant()
.with(VariantProperties.MODEL, model))
.select(Direction.NORTH, Variant.variant()
.with(VariantProperties.X_ROT, VariantProperties.Rotation.R90)
.with(VariantProperties.MODEL, model))
.select(Direction.SOUTH, Variant.variant()
.with(VariantProperties.X_ROT, VariantProperties.Rotation.R90)
.with(VariantProperties.Y_ROT, VariantProperties.Rotation.R180)
.with(VariantProperties.MODEL, model))
.select(Direction.WEST, Variant.variant()
.with(VariantProperties.X_ROT, VariantProperties.Rotation.R90)
.with(VariantProperties.Y_ROT, VariantProperties.Rotation.R270)
.with(VariantProperties.MODEL, model))
.select(Direction.EAST, Variant.variant()
.with(VariantProperties.X_ROT, VariantProperties.Rotation.R90)
.with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90)
.with(VariantProperties.MODEL, model))
));
generator.delegateItemModel(block, model);
generator.blockStateOutput.accept(
MultiVariantGenerator.multiVariant(block, Variant.variant().with(VariantProperties.MODEL, model))
.with(generator.createColumnWithFacing())
);

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement the Magnetic Crafting Table

3 participants