Skip to content
Open
Show file tree
Hide file tree
Changes from 2 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
9 changes: 9 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
1.21.1-2.0.1

- Complete Codebase Overhaul: Refactored and modernized the entire source structure for better maintainability
- Major UI Performance Overhaul: Replaced legacy texture-based rendering with optimized realtime code-based rendering
- Implemented smooth interpolation (lerping) for all UI bars, providing fluid visuals at high refresh rates
- Switched to native Minecraft furnace flame sprites (lit_progress) for improved visual consistency
- Enhanced Magmatic Generator with precise fluid color detection and lava-specific rendering fixes
- Optimized GPU overhead by reducing texture-binding calls, specifically targeting performance gains for integrated graphics (APUs)

1.21.1-1.6.3

- Fixed fuel validation for fluid generators
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ minecraft_version=1.21.1
# as they do not follow standard versioning conventions.
minecraft_version_range=[1.21.1, 1.22)
# The Neo version must agree with the Minecraft version to get a valid artifact
neo_version=21.1.176
neo_version=21.1.217
# The Neo version range can use any version of Neo as bounds
neo_version_range=[21.1.0,)
# The loader version range can only use the major version of FML as bounds
Expand Down
Empty file modified gradlew
100644 → 100755
Empty file.
4,101 changes: 4,101 additions & 0 deletions overhaul_code.txt

Large diffs are not rendered by default.

66 changes: 41 additions & 25 deletions src/main/java/cy/jdkdigital/generatorgalore/GeneratorGalore.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import cy.jdkdigital.generatorgalore.common.datamap.SolidFuelMap;
import cy.jdkdigital.generatorgalore.registry.GeneratorRegistry;
import cy.jdkdigital.generatorgalore.util.GeneratorUtil;
import cy.jdkdigital.generatorgalore.network.ModPackets;
import net.minecraft.core.particles.ParticleType;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.core.registries.Registries;
Expand All @@ -33,43 +34,52 @@
import net.neoforged.neoforge.common.conditions.ICondition;
import net.neoforged.neoforge.common.crafting.IngredientType;
import net.neoforged.neoforge.event.BuildCreativeModeTabContentsEvent;
import net.neoforged.neoforge.network.event.RegisterPayloadHandlersEvent;
import net.neoforged.neoforge.registries.DeferredHolder;
import net.neoforged.neoforge.registries.DeferredRegister;
import net.neoforged.neoforge.registries.NeoForgeRegistries;
import net.neoforged.neoforge.registries.datamaps.DataMapType;
import net.neoforged.neoforge.registries.datamaps.RegisterDataMapTypesEvent;
import net.minecraft.core.component.DataComponentType;
import net.minecraft.network.codec.ByteBufCodecs;
import net.minecraft.core.component.DataComponents;
import com.mojang.serialization.Codec;
import net.neoforged.neoforge.registries.DeferredRegister;
import net.neoforged.neoforge.fluids.FluidStack;
import java.util.function.Supplier;
import org.slf4j.Logger;

@Mod(GeneratorGalore.MODID)
public class GeneratorGalore
{
public class GeneratorGalore {
public static final String MODID = "generatorgalore";
public static final Logger LOGGER = LogUtils.getLogger();

public static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(Registries.BLOCK, GeneratorGalore.MODID);
public static final DeferredRegister<Item> ITEMS = DeferredRegister.create(Registries.ITEM, GeneratorGalore.MODID);
public static final DeferredRegister<MenuType<?>> CONTAINER_TYPES = DeferredRegister.create(Registries.MENU, GeneratorGalore.MODID);
public static final DeferredRegister<BlockEntityType<?>> BLOCK_ENTITIES = DeferredRegister.create(Registries.BLOCK_ENTITY_TYPE, GeneratorGalore.MODID);
public static final DeferredRegister<RecipeSerializer<?>> RECIPE_SERIALIZERS = DeferredRegister.create(Registries.RECIPE_SERIALIZER, GeneratorGalore.MODID);
public static final DeferredRegister<RecipeType<?>> RECIPE_TYPES = DeferredRegister.create(Registries.RECIPE_TYPE, GeneratorGalore.MODID);
public static final DeferredRegister<ParticleType<?>> PARTICLE_TYPES = DeferredRegister.create(Registries.PARTICLE_TYPE, GeneratorGalore.MODID);
public static final DeferredRegister<CreativeModeTab> CREATIVE_MODE_TABS = DeferredRegister.create(Registries.CREATIVE_MODE_TAB, GeneratorGalore.MODID);
public static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(Registries.BLOCK, MODID);
public static final DeferredRegister<Item> ITEMS = DeferredRegister.create(Registries.ITEM, MODID);
public static final DeferredRegister<MenuType<?>> CONTAINER_TYPES = DeferredRegister.create(Registries.MENU, MODID);
public static final DeferredRegister<BlockEntityType<?>> BLOCK_ENTITIES = DeferredRegister.create(Registries.BLOCK_ENTITY_TYPE, MODID);
public static final DeferredRegister<RecipeSerializer<?>> RECIPE_SERIALIZERS = DeferredRegister.create(Registries.RECIPE_SERIALIZER, MODID);
public static final DeferredRegister<RecipeType<?>> RECIPE_TYPES = DeferredRegister.create(Registries.RECIPE_TYPE, MODID);
public static final DeferredRegister<ParticleType<?>> PARTICLE_TYPES = DeferredRegister.create(Registries.PARTICLE_TYPE, MODID);
public static final DeferredRegister<CreativeModeTab> CREATIVE_MODE_TABS = DeferredRegister.create(Registries.CREATIVE_MODE_TAB, MODID);
public static final DeferredRegister<MapCodec<? extends ICondition>> CONDITION_CODECS = DeferredRegister.create(NeoForgeRegistries.Keys.CONDITION_CODECS, MODID);
public static final DeferredRegister<IngredientType<?>> INGREDIENT_TYPES = DeferredRegister.create(NeoForgeRegistries.Keys.INGREDIENT_TYPES, MODID);

public static DeferredHolder<CreativeModeTab, CreativeModeTab> TAB = CREATIVE_MODE_TABS.register(MODID, () -> {
return CreativeModeTab.builder()
.withTabsBefore(CreativeModeTabs.SPAWN_EGGS)
.icon(() -> new ItemStack(BuiltInRegistries.ITEM.get(ResourceLocation.fromNamespaceAndPath(MODID, "iron_generator"))))
.title(Component.literal("Generator Galore"))
.build();
});
public static final DeferredHolder<CreativeModeTab, CreativeModeTab> TAB = CREATIVE_MODE_TABS.register(MODID, () -> CreativeModeTab.builder()
.withTabsBefore(CreativeModeTabs.SPAWN_EGGS)
.icon(() -> new ItemStack(GeneratorRegistry.generators.get(ResourceLocation.fromNamespaceAndPath(MODID, "iron")).getBlockSupplier().get()))
.title(Component.literal("Generator Galore"))
.build());

public static final DeferredHolder<MapCodec<? extends ICondition>, MapCodec<GeneratorExistsCondition>> GENERATOR_EXISTS_CONDITION = CONDITION_CODECS.register("generator_exists", () -> GeneratorExistsCondition.CODEC);
public static final DataMapType<Block, FluidFuelMap> FLUID_FUEL_MAP = DataMapType.builder(ResourceLocation.fromNamespaceAndPath(MODID, "fluid_fuel_map"), Registries.BLOCK, FluidFuelMap.CODEC).synced(FluidFuelMap.CODEC, false).build();
public static final DataMapType<Block, SolidFuelMap> SOLID_FUEL_MAP = DataMapType.builder(ResourceLocation.fromNamespaceAndPath(MODID, "solid_fuel_map"), Registries.BLOCK, SolidFuelMap.CODEC).synced(SolidFuelMap.CODEC, false).build();

public static final DeferredHolder<IngredientType<?>, IngredientType<PotionComponentIngredient>> POTIOM_INGREDIENT_TYPE = INGREDIENT_TYPES.register("component", () -> new IngredientType<>(PotionComponentIngredient.CODEC));

public static final DeferredRegister<DataComponentType<?>> DATA_COMPONENTS = DeferredRegister.create(Registries.DATA_COMPONENT_TYPE, MODID);
public static final Supplier<DataComponentType<Integer>> ENERGY_COMPONENT = DATA_COMPONENTS.register("energy_storage", () -> DataComponentType.<Integer>builder().persistent(Codec.INT).networkSynchronized(ByteBufCodecs.VAR_INT).build());
public static final Supplier<DataComponentType<FluidStack>> FLUID_COMPONENT = DATA_COMPONENTS.register("fluid_storage", () -> DataComponentType.<FluidStack>builder().persistent(FluidStack.CODEC).networkSynchronized(FluidStack.STREAM_CODEC).build());

public GeneratorGalore(IEventBus modEventBus, ModContainer modContainer) {
GeneratorRegistry.discoverGenerators();

Expand All @@ -83,20 +93,26 @@ public GeneratorGalore(IEventBus modEventBus, ModContainer modContainer) {
CREATIVE_MODE_TABS.register(modEventBus);
CONDITION_CODECS.register(modEventBus);
INGREDIENT_TYPES.register(modEventBus);
DATA_COMPONENTS.register(modEventBus);

modContainer.registerConfig(ModConfig.Type.SERVER, Config.SERVER_CONFIG);
modContainer.registerConfig(ModConfig.Type.CLIENT, Config.CLIENT_CONFIG);
}

@EventBusSubscriber(bus = EventBusSubscriber.Bus.MOD, modid = MODID)
public static class EventHandler
{
public static class EventHandler {

@SubscribeEvent
public static void registerPayloadHandlers(RegisterPayloadHandlersEvent event) {
ModPackets.registerPackets(event);
}

@SubscribeEvent
public static void buildContents(BuildCreativeModeTabContentsEvent event) {
if (event.getTab().equals(TAB.get())) {
for (DeferredHolder<Item, ? extends Item> item: GeneratorGalore.ITEMS.getEntries()) {
event.accept(item.get());
}
if (event.getTabKey() == TAB.getKey()) {
GeneratorRegistry.generators.values().forEach(generatorObject -> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

do upgrade items and 8x/64x generators not get excluded by this change?

Copy link
Author

@hypopheria2k hypopheria2k Jan 9, 2026

Choose a reason for hiding this comment

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

You're absolutely right!
I'm sorry for the oversight! I completely missed the detail about filtering the 8x and 64x variants in the Creative Tab earlier.

I have now fixed the filtering logic and also resolved the compilation errors by moving the event listeners to the constructor and using the correct registry access. The Creative Tab will now only show the base generators and the upgrades, while the 8x/64x block variants are correctly hidden.

I'm pushing the fix to my branch right now so it's included in the PR.

Changes in addCreative:

private void addCreative(BuildCreativeModeTabContentsEvent event) {
    if (event.getTabKey().equals(TAB.getKey())) {
            ITEMS.getEntries().forEach(itemHolder -> {
            String path = itemHolder.getId().getPath();
            // Filter: Only add items that don't end with _8x or _64x
            if (!path.endsWith("_8x") && !path.endsWith("_64x")) {
                event.accept(itemHolder.get());
            }
        });
    }
}

event.accept(generatorObject.getBlockSupplier().get());
});
}
}

Expand Down Expand Up @@ -127,4 +143,4 @@ public static void registerCapabilities(RegisterCapabilitiesEvent event) {
});
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public class Generator extends BaseEntityBlock
.apply(builder, Generator::new)
);

GeneratorObject generator;
private final GeneratorObject generator;
private final int modifier;

public Generator(Properties properties, GeneratorObject generator, int modifier) {
Expand Down Expand Up @@ -120,31 +120,13 @@ protected ItemInteractionResult useItemOn(ItemStack pStack, BlockState pState, L
protected InteractionResult useWithoutItem(BlockState pState, Level pLevel, BlockPos pPos, Player pPlayer, BlockHitResult pHitResult) {
if (pLevel.getBlockEntity(pPos) instanceof GeneratorBlockEntity generatorBlockEntity) {
if (!pLevel.isClientSide) {
generatorBlockEntity.refreshConnectedTileEntityCache();
pPlayer.openMenu(generatorBlockEntity, packetBuffer -> packetBuffer.writeBlockPos(pPos));
}
return InteractionResult.SUCCESS_NO_ITEM_USED;
}
return super.useWithoutItem(pState, pLevel, pPos, pPlayer, pHitResult);
}

@Override
public void onPlace(BlockState state, Level level, BlockPos pos, BlockState newState, boolean something) {
BlockEntity generatorTile = level.getBlockEntity(pos);
if (generatorTile instanceof GeneratorBlockEntity generatorBlockEntity) {
generatorBlockEntity.refreshConnectedTileEntityCache();
}
super.onPlace(state, level, pos, newState, something);
}

@Override
public BlockState updateShape(BlockState state, Direction direction, BlockState newState, LevelAccessor level, BlockPos pos, BlockPos facingPos) {
BlockEntity generatorTile = level.getBlockEntity(pos);
if (generatorTile instanceof GeneratorBlockEntity generatorBlockEntity) {
generatorBlockEntity.refreshConnectedTileEntityCache();
}
return super.updateShape(state, direction, newState, level, pos, facingPos);
}

@Override
public void animateTick(BlockState pState, Level level, BlockPos pos, RandomSource random) {
Expand All @@ -161,7 +143,7 @@ public void animateTick(BlockState pState, Level level, BlockPos pos, RandomSour
level.addParticle(ParticleTypes.SMOKE, d0, d1, d2, 0.0D, 0.0D, 0.0D);
break;
case ENCHANTMENT:
// level.addParticle(ModParticles.RISING_ENCHANT_PARTICLE.get(), (double) pos.getX() + 0.5D, (double) pos.getY() + 1.0D, (double) pos.getZ() + 0.5D, random.nextFloat() / 2.0F, 5.0E-5D, random.nextFloat() / 2.0F);
// Enchantment particle effect disabled for now
break;
default:
level.addParticle(ParticleTypes.LAVA, (double) pos.getX() + 0.5D, (double) pos.getY() + 1.0D, (double) pos.getZ() + 0.5D, random.nextFloat() / 2.0F, 5.0E-5D, random.nextFloat() / 2.0F);
Expand Down
Loading