Skip to content

Commit

Permalink
quick fix dedicated server crash
Browse files Browse the repository at this point in the history
  • Loading branch information
Corosauce committed Oct 22, 2023
1 parent f47c577 commit a89a78b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
2 changes: 0 additions & 2 deletions src/main/java/extendedrenderer/particle/ParticleRegistry.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import java.util.List;
import java.util.Optional;

@Mod.EventBusSubscriber(modid = Weather.MODID, bus = Mod.EventBusSubscriber.Bus.MOD)
public class ParticleRegistry extends SpriteSourceProvider {

public static TextureAtlasSprite squareGrey;
Expand Down Expand Up @@ -133,7 +132,6 @@ public void addSprite(ResourceLocation res) {
}

@SubscribeEvent
@OnlyIn(Dist.CLIENT)
public static void getRegisteredParticles(TextureStitchEvent.Post event) {

if (!event.getAtlas().location().equals(TextureAtlas.LOCATION_PARTICLES)) {
Expand Down
3 changes: 0 additions & 3 deletions src/main/java/weather2/BlockProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,8 @@
import java.util.List;
import java.util.Optional;

@Mod.EventBusSubscriber(modid = Weather.MODID, bus = Mod.EventBusSubscriber.Bus.MOD)
public class BlockProvider extends SpriteSourceProvider {

public static TextureAtlasSprite squareGrey;

public BlockProvider(PackOutput output, ExistingFileHelper fileHelper)
{
super(output, fileHelper, Weather.MODID);
Expand Down
16 changes: 14 additions & 2 deletions src/main/java/weather2/Weather.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
import net.minecraft.data.DataGenerator;
import net.minecraft.data.PackOutput;
import net.minecraft.world.item.CreativeModeTab;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.data.ExistingFileHelper;
import net.minecraftforge.common.data.ForgeSpriteSourceProvider;
Expand All @@ -25,6 +27,7 @@
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.fml.event.lifecycle.InterModProcessEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import net.minecraftforge.fml.loading.FMLEnvironment;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import weather2.command.WeatherCommand;
Expand Down Expand Up @@ -93,6 +96,10 @@ public Weather() {
//WeatherUtilConfig.nbtLoadDataAll();

SoundRegistry.init();

if (FMLEnvironment.dist.isClient()) {
modBus.addListener(ParticleRegistry::getRegisteredParticles);
}
}

public static IConfigCategory addConfig(IConfigCategory config) {
Expand Down Expand Up @@ -148,15 +155,20 @@ private void registerCommands(RegisterCommandsEvent event) {
}

private void gatherData(GatherDataEvent event) {
DataGenerator gen = event.getGenerator();
if (event.includeServer()) {
//TODO: 1.20
//gen.addProvider(new WeatherRecipeProvider(gen));
}
if (event.includeClient()) {
gatherClientData(event);
}
}

@OnlyIn(Dist.CLIENT)
private void gatherClientData(GatherDataEvent event) {
DataGenerator gen = event.getGenerator();
PackOutput packOutput = gen.getPackOutput();
ExistingFileHelper existingFileHelper = event.getExistingFileHelper();

gen.addProvider(event.includeClient(), new ParticleRegistry(packOutput, existingFileHelper));
gen.addProvider(event.includeClient(), new BlockProvider(packOutput, existingFileHelper));
}
Expand Down

0 comments on commit a89a78b

Please sign in to comment.