Jump to content

DmitryLovin

Members
  • Posts

    10
  • Joined

  • Last visited

Everything posted by DmitryLovin

  1. LivingHurtEvent::getSource and DamageSource has isExplosion method.
  2. You have to use instance of EntityType class, like EntityType.SHEEP.spawn
  3. EntityType::spawn is what you are looking for. And BlockEvent::getPos for block position
  4. Well, I kinda fixed it: for(HeadPack pack:ipack){ Minecraft.getInstance().getResourcePackList().addPackFinder( (infoConsumer, infoFactory) -> { infoConsumer.accept(infoFactory.create(pack.getName(), true,()->pack,pack, new PackMetadataSection(new StringTextComponent(pack.getName()),6),ResourcePackInfo.Priority.BOTTOM,IPackNameDecorator.BUILTIN)); } ); } But it works only after I reload packs or something, keep looking what I did wrong. upd: I guess I still need to add it in ResourceManager manually like before as well: ((SimpleReloadableResourceManager) Minecraft.getInstance().getResourceManager()).addResourcePack(pack); because minecraft do it only when you reload resourcepacks or change them. Can be closed.
  5. As I know, it calls when fml (forge mod loader) finish to load itself, so even before mods start to load. Sorry I was wrong. This thing works fine, thanks, but now my IResourcePack implementation method doesn't work. I guess I do it absolutely wrong: for(HeadPack pack:ipack){ ((SimpleReloadableResourceManager) Minecraft.getInstance().getResourceManager()).addResourcePack(pack); } ((SimpleReloadableResourceManager) Minecraft.getInstance().getResourceManager()).addReloadListener((s,rM,pP,rP,bE,gE)->{ return CompletableFuture. supplyAsync(() ->{return null;}, bE). thenCompose(s::markCompleteAwaitingOthers). thenAcceptAsync((p_215269_3_) -> {reloadPack(rM);}, gE);});
  6. As I know, it calls when fml (forge mod loader) finish to load itself, so even before mods start to load.
  7. Hello. In my mod I need run method after all mods have been loaded, the reason is EntityType.byKey method. Briefly, mod is rendering mob's icons, where and why doesn't matter. Generation of these icons is not the fastest thing, so mod generate them once and save as files, and using IResourcePack implementation then. For rendering icons im using hashmap with EntityType as a key (to check should I render it or not), I tested and it is faster than using some sort of EntityType string as a key. So, I was trying to load all those icons in init state, but EntityTypes doesn't exists until mod is loaded (we are talking about external mods), I can't add mods in dependecies because it is a dynimic thing (excepts there is a way to add dependecies in mod constructor). My solution is not perfect at all, but it works at least, and I'm trying to find something better. (As I said before: way to add dependecies in constructor, for example). My solution: public class FirstMainMenuOpenEvent { @SubscribeEvent public void onGuiOpen(GuiOpenEvent event){ if(event.getGui()instanceof MainMenuScreen){ HeadUtils.loadModHeads(); MinecraftForge.EVENT_BUS.unregister(this); } } } So I register it once in init state, then it runs once and remove itself.
  8. I only need client player inventory, so it might help, thank you.
  9. I want to render animation for recently chenged items.
  10. Is there a way to handle vanilla packet (SSetSlotPacket to be exact). Part of the vanilla handler do this: itemstack.setAnimationsToGo(5); but only if item in hotbar slots, I want to do it for any item. I know the way to do it without packets, just check for changing in inventory every tick, but I don't think it is a good idea (don't know why) and trying to find another way.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.