Giter VIP home page Giter VIP logo

Comments (2)

Tohricat avatar Tohricat commented on July 19, 2024

Thanks for your response on Discord, Blay. I've modified the "Icon" to now be a tag, but I'm still getting nothing - no categories, nor anything in the logs. Here's the code.



@Mod.EventBusSubscriber(modid = "seasonal_seed_shop", bus = Mod.EventBusSubscriber.Bus.MOD)
public class Events {

	@SubscribeEvent
	public static void onIMCEvent(InterModEnqueueEvent event) {	
		
		final Logger LOGGER = LogManager.getLogger();
		
		ItemStack autumnIcon = new ItemStack(Items.STONE_HOE);
		CompoundTag iconTag = new CompoundTag();
		autumnIcon.save(iconTag);
		
		LOGGER.fatal(ItemStack.of(iconTag).getItem().getRegistryName());
		
		CompoundTag winterData = new CompoundTag();
		winterData.putString("RegistryName", "seasonal_seed_shop:winter_crops");
		winterData.putString("Tooltip", "Winter");
		winterData.put("Icon", iconTag);
		winterData.putInt("SortIndex", 4);
		
		CompoundTag springData = new CompoundTag();
		springData.putString("RegistryName", "seasonal_seed_shop:spring_crops");
		springData.putString("Tooltip", "Spring");
		springData.put("Icon", iconTag);
		springData.putInt("SortIndex", 1);
		
		CompoundTag summerData = new CompoundTag();
		summerData.putString("RegistryName", "seasonal_seed_shop:summer_crops");
		summerData.putString("Tooltip", "Summer");
		summerData.put("Icon", iconTag);
		summerData.putInt("SortIndex", 2);
				
		CompoundTag autumnData = new CompoundTag();
		autumnData.putString("RegistryName", "seasonal_seed_shop:autumn_crops");
		autumnData.putString("Tooltip", "Autumn");
		autumnData.put("Icon", iconTag);
		autumnData.putInt("SortIndex", 3);
		
		InterModComms.sendTo("farmingforblockheads", "RegisterMarketCategory", () -> winterData );
		InterModComms.sendTo("farmingforblockheads", "RegisterMarketCategory", () -> springData );
		InterModComms.sendTo("farmingforblockheads", "RegisterMarketCategory", () -> summerData );
		InterModComms.sendTo("farmingforblockheads", "RegisterMarketCategory", () -> autumnData );
		
		ItemStack boat = new ItemStack(Items.ACACIA_BOAT);
		CompoundTag boatTag = new CompoundTag();
		boat.save(boatTag);
		
		CompoundTag test = new CompoundTag();
		test.put("OutputItem", boatTag);
		test.put("CostItem", boatTag);
		test.putString("Category", "seasonal_seed_shop:summer_crops");
		InterModComms.sendTo("farmingforblockheads", "RegisterMarketEntry", () -> { return test; });
		
		LOGGER.fatal("Hello from Seasonal Seeds Shop!");
	}
}

I also tested by adding a boat item to the category, but still nothing appears in the market.

from farmingforblockheads.

BlayTheNinth avatar BlayTheNinth commented on July 19, 2024

You are right, it seems the IMC API is currently non-functional because its registrations are reset when a world is loaded.

I recommend using the data pack API instead by placing json files like this in your mod's resources, since I probably won't be fixing IMC before 1.19:

https://github.com/ModdingForBlockheads/FarmingForBlockheads/tree/1.18.x/shared/src/main/resources/data/farmingforblockheads/farmingforblockheads_compat

Example file: https://gist.github.com/blay09/93a48d092d6dc570a64c81e1912dc4d0

from farmingforblockheads.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.