Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: auto register BlockItem's and inline item registration #415

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

300 changes: 147 additions & 153 deletions src/main/java/dev/galacticraft/mod/content/GCBlocks.java

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@

import com.mojang.serialization.MapCodec;
import dev.galacticraft.mod.content.GCBlocks;
import dev.galacticraft.mod.content.item.GCItems;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.server.level.ServerLevel;
Expand Down Expand Up @@ -113,7 +112,7 @@ protected BlockState getGrowIntoState(BlockState blockState, RandomSource random

@Override
public ItemStack getCloneItemStack(LevelReader blockGetter, BlockPos blockPos, BlockState blockState) {
return new ItemStack(GCItems.CAVERNOUS_VINES);
return new ItemStack(GCBlocks.CAVERNOUS_VINES);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,11 @@

import com.mojang.serialization.MapCodec;
import dev.galacticraft.mod.content.GCBlocks;
import dev.galacticraft.mod.content.item.GCItems;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.util.RandomSource;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelReader;
Expand Down Expand Up @@ -63,10 +61,10 @@ protected BlockState updateHeadAfterConvertedFromBody(BlockState blockState, Blo
return blockState2.setValue(POISONOUS, blockState.getValue(POISONOUS)).setValue(WATERLOGGED, blockState.getValue(WATERLOGGED));
}

@Override
public ItemStack getCloneItemStack(LevelReader levelReader, BlockPos blockPos, BlockState blockState) {
return new ItemStack(GCItems.CAVERNOUS_VINES);
}
// @Override
// public ItemStack getCloneItemStack(LevelReader levelReader, BlockPos blockPos, BlockState blockState) {
// return new ItemStack(GCBlocks.CAVERNOUS_VINES_PLANT);
// }

@Override
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import dev.galacticraft.api.rocket.RocketPrefabs;
import dev.galacticraft.mod.Constant;
import dev.galacticraft.mod.content.GCBlockRegistry;
import dev.galacticraft.mod.content.GCBlocks;
import dev.galacticraft.mod.storage.PlaceholderItemStorage;
import dev.galacticraft.mod.util.Translations;
import net.fabricmc.fabric.api.itemgroup.v1.FabricItemGroup;
Expand All @@ -45,6 +44,7 @@
import net.minecraft.world.item.DyeColor;
import net.minecraft.world.item.ItemStack;

import static dev.galacticraft.mod.content.GCBlocks.*;
import static dev.galacticraft.mod.content.item.GCItems.*;

public class GCCreativeModeTabs {
Expand Down Expand Up @@ -274,11 +274,11 @@ public class GCCreativeModeTabs {

public static final CreativeModeTab BLOCKS_GROUP = FabricItemGroup
.builder()
.icon(() -> new ItemStack(GCItems.MOON_TURF))
.icon(() -> new ItemStack(MOON_TURF))
.title(Component.translatable(Translations.ItemGroup.BLOCKS))
.displayItems((parameters, output) -> {
// DECORATION BLOCKS
for (GCBlockRegistry.DecorationSet decorationSet : GCBlocks.BLOCKS.getDecorations()) {
for (GCBlockRegistry.DecorationSet decorationSet : BLOCKS.getDecorations()) {
output.accept(decorationSet.item());
output.accept(decorationSet.slabItem());
output.accept(decorationSet.stairsItem());
Expand All @@ -290,8 +290,8 @@ public class GCCreativeModeTabs {
}

// TORCHES
output.accept(GLOWSTONE_TORCH);
output.accept(UNLIT_TORCH);
output.accept(GCItems.GLOWSTONE_TORCH);
output.accept(GCItems.UNLIT_TORCH);

// LANTERNS
output.accept(GLOWSTONE_LANTERN);
Expand All @@ -302,7 +302,7 @@ public class GCCreativeModeTabs {
output.accept(MOON_DIRT);
output.accept(MOON_DIRT_PATH);
output.accept(MOON_SURFACE_ROCK);
output.accept(GCBlocks.MOON_DUNGEON_BRICK);
output.accept(MOON_DUNGEON_BRICK);

output.accept(MOON_ROCK);
output.accept(MOON_ROCK_SLAB);
Expand Down Expand Up @@ -395,7 +395,7 @@ public class GCCreativeModeTabs {
output.accept(ROCKET_LAUNCH_PAD);

for (DyeColor color : DyeColor.values()) {
ItemStack stack = new ItemStack(GCBlocks.PARACHEST);
ItemStack stack = new ItemStack(PARACHEST);
stack.set(DataComponents.BASE_COLOR, color);
output.accept(stack);
}
Expand Down Expand Up @@ -433,27 +433,27 @@ public class GCCreativeModeTabs {

output.accept(GALENA_ORE);

output.accept(GCBlocks.OLIVINE_BASALT);
output.accept(GCBlocks.RICH_OLIVINE_BASALT);
output.accept(GCBlocks.OLIVINE_CLUSTER);
output.accept(OLIVINE_BASALT);
output.accept(RICH_OLIVINE_BASALT);
output.accept(OLIVINE_CLUSTER);

// COMPACT MINERAL BLOCKS
output.accept(MOON_CHEESE_WHEEL);
output.accept(SILICON_BLOCK);
output.accept(GCBlocks.ALUMINUM_BLOCK);
output.accept(ALUMINUM_BLOCK);
output.accept(METEORIC_IRON_BLOCK);
output.accept(DESH_BLOCK);
output.accept(GCBlocks.TIN_BLOCK);
output.accept(TIN_BLOCK);
output.accept(TITANIUM_BLOCK);
output.accept(LEAD_BLOCK);
output.accept(LUNAR_SAPPHIRE_BLOCK);
output.accept(GCBlocks.RAW_ALUMINUM_BLOCK);
output.accept(GCBlocks.RAW_METEORIC_IRON_BLOCK);
output.accept(GCBlocks.RAW_DESH_BLOCK);
output.accept(GCBlocks.RAW_TIN_BLOCK);
output.accept(GCBlocks.RAW_TITANIUM_BLOCK);
output.accept(GCBlocks.RAW_LEAD_BLOCK);
output.accept(GCBlocks.OLIVINE_BLOCK);
output.accept(RAW_ALUMINUM_BLOCK);
output.accept(RAW_METEORIC_IRON_BLOCK);
output.accept(RAW_DESH_BLOCK);
output.accept(RAW_TIN_BLOCK);
output.accept(RAW_TITANIUM_BLOCK);
output.accept(RAW_LEAD_BLOCK);
output.accept(OLIVINE_BLOCK);

// MOON VILLAGER SPECIAL
output.accept(LUNAR_CARTOGRAPHY_TABLE);
Expand All @@ -470,7 +470,7 @@ public class GCCreativeModeTabs {

public static final CreativeModeTab MACHINES_GROUP = FabricItemGroup
.builder()
.icon(() -> new ItemStack(GCItems.COAL_GENERATOR))
.icon(() -> new ItemStack(COAL_GENERATOR))
.title(Component.translatable(Translations.ItemGroup.MACHINES))
.displayItems((parameters, output) -> {
output.accept(CIRCUIT_FABRICATOR);
Expand Down
Loading