Jump to content

Recommended Posts

Posted

This is what I see in my log:

[18:29:39] [server thread/INFO] [FML/]: Loading dimension 0 (New World) (net.minecraft.server.integrated.IntegratedServer@17eb9432)
[18:29:39] [server thread/INFO] [FML/]: Loading dimension 1 (New World) (net.minecraft.server.integrated.IntegratedServer@17eb9432)
[18:29:39] [server thread/INFO] [lidr/]: Registering Draftable :test
[18:29:39] [server thread/INFO] [FML/]: Loading dimension -1 (New World) (net.minecraft.server.integrated.IntegratedServer@17eb9432)
[18:29:39] [server thread/INFO] [lidr/]: Registering Draftable :test
[18:29:39] [server thread/INFO] [lidr/]: Registering Draftable :test

This is my event handler:

       @SubscribeEvent
public void worldLoad(WorldEvent.Load e){
	if(!e.world.isRemote)
	{
		DraftableMap dMap = new DraftableMap();
		dMap.AddPart("0,0,0", new EdgePart(LuxinReg.RegisteredLuxin.get("Blue"), Purity.Base));
		DraftableReg.RegisterDraftable(CoreFactory.GenerateFrom("test", CoreType.Sword, dMap)); //Testing items
	}
}

and this is my registerDraftable method

        public static void RegisterDraftable(IDraftable draftable){
	LogHelper.info("Registering Draftable :" + draftable.GetName());
	knowledgeBase.put(draftable.GetName(), draftable);
}

 

This is happening when I run through eclipse and play in an smp world, any ideas?

 

So I'm dumb, this event is obviously getting triggered for each dimension.  Revised question, I am looking for an event that happens once when you launch an smp world or when a server is starting its world so I can check if the world is remote. What event should I be using here?

Current Project: Armerger 

Planned mods: Light Drafter  | Ore Swords

Looking for help getting a mod off the ground? Coding  | Textures

Posted

Checking if the world is remote (which would mean it's the CLIENT world, btw), is not really a goal, it is a means to something else.

 

So, what exactly are you trying to do?

 

If you want to add data to the world, use WorldSavedData. If you want to add structures or something like that, look into IWorldGenerator (if that's still a thing) or the various generation events such as PopulateChunkEvent.Post.

Posted

The IDraftable that you can see me adding to a hashmap is a structure that I use to create an NBT based item (think tinkers but many more parts) I already have all the communication lines for giving an item to a player and syncing the nbt items between server and client. I am just trying to prime the world with a test item so I can test my save/load/item creation/item rendering methods.

Current Project: Armerger 

Planned mods: Light Drafter  | Ore Swords

Looking for help getting a mod off the ground? Coding  | Textures

Posted

And where will this Item be located?

 

Are you giving it to the player when they join? Use PlayerLoggedInEvent.

 

Are you placing it in a chest somewhere? Use the ChestGenHooks or loot tables or whatever that has become to add it to random loot or use one of the world gen events to place it yourself.

 

Or are you doing something else entirely? I don't see what the problem is that you're trying to solve.

Posted

It isn't really a problem for this purpose but for future reference I am trying to figure out what events I can use for initializing different things when a world starts up.

 

In this particular case the NBT information is getting stored in a custom registry that can be added to at any point during the game (I want to add a test item when the world starts). Each user has a selected item that will get created and given to them on a hotkey press.

Current Project: Armerger 

Planned mods: Light Drafter  | Ore Swords

Looking for help getting a mod off the ground? Coding  | Textures

Posted

Then I would store that information as additional data attached to those players, i.e. each player stores information about the Item(s) they can create. Use IExtendedEntityProperties (pre 1.8.9) or the Capabilities system (1.8.9+).

 

Or is the registry global for all players? In any case, world start up isn't the place I would choose to do this - unless you really need access to the World object for some reason (e.g. time of day), I would do it during the FML init or postInit phase, after all my items were registered.

Posted

I do need the world object because this also generates a bakedModel if it is on the client side and the registry is global but the selection is per user. I already have capabilities set up for the user specific things. I just don't have the system in place for designing the items yet, so in order to test other things I need to prime the registry with an item.

Current Project: Armerger 

Planned mods: Light Drafter  | Ore Swords

Looking for help getting a mod off the ground? Coding  | Textures

Posted

You don't need a World object to generate/register baked models - that should be done through your ClientProxy during FML's pre-init phase after registering your items.

 

And if for whatever reason you DO need the World object for your baked model (which you shouldn't), since you are doing this in your ClientProxy you can use Minecraft.getMinecraft().theWorld, BUT, I don't recommend that as it might very well be in an invalid state at that point (e.g. not existing yet). You can always access it from within your baked model class at the time of rendering.

Posted

When I register the nbt items (if it is client side) I generate a bakedModel from the nbt information and that can't happen on server side because the class bakedModel doesn't exist serverside. New items can be designed and added to the registry during run-time. Which means that the items available are determined by the server during run-time not during initialization.

Current Project: Armerger 

Planned mods: Light Drafter  | Ore Swords

Looking for help getting a mod off the ground? Coding  | Textures

Posted

There is really no event that only happens once??? To be clear I mean once in the sense that it would only get called when a server is starting up, I do not mean once per world.

 

I'm pretty sure it just seems like I'm doing this the wrong way because this thread is a bunch of half explanations. But I would like to find out sooner rather than later if I really am doing something wrong. So can you clarify what part you think I am doing wrong and I will give a full explanation of how I am doing that part to see if I actually am wrong.

Current Project: Armerger 

Planned mods: Light Drafter  | Ore Swords

Looking for help getting a mod off the ground? Coding  | Textures

Posted

I am using this:

public class DraftableSmartItemModel implements ISmartItemModel{
       @Override
public IFlexibleBakedModel handleItemState(ItemStack stack) {
      IFlexibleBakedModel model = null;
      if(stack.getTagCompound().hasKey(Refs.DRAFTABLE) && DraftableReg.Exists(stack.getTagCompound().getString(Refs.DRAFTABLE)))
         model = DraftableReg.getModel(stack.getTagCompound().getString(Refs.DRAFTABLE));
      return model;
   }
}

I generate the model for each item once, when they get added to my registry

public class DraftableReg {
        public static void RegisterDraftable(IDraftable draftable){
        models.put(draftable.GetName(), new DraftableBakedModel(draftable));
	LogHelper.info("Registering Draftable :" + draftable.GetName());
	knowledgeBase.put(draftable.GetName(), draftable);
}
}

public class DraftableBakedModel implements IFlexibleBakedModel{

 private List<BakedQuad> quads = new ArrayList<BakedQuad>();

 public DraftableBakedModel(IDraftable draft){
	 DraftableMap parts = draft.GetPartArray();
	 for(int xPos = 0; xPos < 16; xPos++){
	    for(int yPos = 0; yPos < 16; yPos++){
               for(int zPos = 0; zPos < 16; zPos++){
                  if(parts.GetPart(xPos + "," + yPos + "," + zPos) != null)
                     quads.addAll(getQuadFrom(parts.GetPart(xPos + "," + yPos + "," + zPos), xPos, yPos, zPos));
            }
         }
      }
   }

private List<BakedQuad> getQuadFrom(IPartType getPart, int x, int y, int z) {
	List<BakedQuad> list = new ArrayList<BakedQuad>();
	BakedQuad quad;
	//North
	quad = new BakedQuad(applyOffset(getPart.GetVertices(EnumFacing.NORTH),x,y,z), 0, EnumFacing.NORTH);
	list.add(quad);
	//Up
	quad = new BakedQuad(getPart.GetVertices(EnumFacing.UP), z, EnumFacing.UP);
	list.add(quad);
	//East
	quad = new BakedQuad(getPart.GetVertices(EnumFacing.EAST), z, EnumFacing.EAST);
	list.add(quad);
	//South
	quad = new BakedQuad(getPart.GetVertices(EnumFacing.SOUTH), z, EnumFacing.SOUTH);
	list.add(quad);
	//Down
	quad = new BakedQuad(getPart.GetVertices(EnumFacing.DOWN), z, EnumFacing.DOWN);
	list.add(quad);
	//West
	quad = new BakedQuad(getPart.GetVertices(EnumFacing.WEST), z, EnumFacing.WEST);
	list.add(quad);
	return list;
}

private int[] applyOffset(int[] vertices, int x, int y, int z) {
	for(int i = 0; i < 7; i++)//7 elements per vertex
	{
		for(int j = 1; j < 5; j++)// 4 vertices
		{
			switch(i){
			case 0: vertices[i*j] = vertices[i*j] + (x*Refs.OFFSET);//xpos
				break;
			case 1: vertices[i*j] = vertices[i*j] + (y*Refs.OFFSET);//ypos
				break;
			case 2: vertices[i*j] = vertices[i*j] + (z*Refs.OFFSET);//zpos
				break;
			default:
				break;
			}
		}
	}
	return vertices;
}
}

 

I'm not completely done with it but this is most of the code relevant to my model generation.

Current Project: Armerger 

Planned mods: Light Drafter  | Ore Swords

Looking for help getting a mod off the ground? Coding  | Textures

Posted

Like I said this thread was getting very off topic. I was trying to register a test item when the world loads and I noticed that it was registering the item 3 times in the event I was using. It is not a problem for this particular case but I am curious what events are available that are only triggered once during the startup process and are after postInit.

Current Project: Armerger 

Planned mods: Light Drafter  | Ore Swords

Looking for help getting a mod off the ground? Coding  | Textures

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • I need to know what mod is doing this crash, i mean the mod xenon is doing the crash but i want to know who mod is incompatible with xenon, but please i need to know a solution if i need to replace xenon, i cant use optifine anymore and all the other mods i tried(sodium, lithium, vulkan, etc) doesn't work, it crash the game.
    • I have been trying to solve a consistent crashing issue on my brother's computer where it will crash during the "Scanning Mod Candidates" phase of the loading process that starts when you click the play button on the Minecraft launcher. The issue seems to stem from a missing library that it mentions in the log file I provide below. I might I'm missing the bigger issue here for a smaller one but hopefully someone can find what I'm missing. Here's all of the stuff that I've been able to figure out so far: 1. It has nothing to do with mods, the crash happened with a real modpack, and even when I made a custom modpack and launched it without putting ANY mods into it (That is where the log file comes from by the way). 2. I have tried to find this class like a file in the Minecraft folders, but I've had no luck finding it (I don't think it works like that, but since I really don't understand how it works, I just figured I'd try). 3. I haven't seen anyone else have this issue before. 4. I know that my modpack (with mods) does work since I've run it on my computer, and it works fantastic. For some reason my brother's computer can't seem to run anything through curseforge. 5. This is for Minecraft version 1.20.1, Minecraft launcher version 3.4.50-2.1.3, forge 47.3.0, and curseforge app version 1.256.0.21056 6. My brother is using a Dell laptop from 6 years ago running Windows 10 (If you think more info on this would help, please ask as I do have it. I'm just choosing not to put it here for now). 7. I have reinstalled the curseforge app and installed Minecraft version 1.20.1. I have not reinstalled Minecraft or forge 47.3.0 but I didn't know if that would help. 8. I had an error code of 1 Please let me know if there is anything else that I am missing that you would like me to add to this post/add in a comment! Lastly, many thanks in advance to whoever can help! ------------- LOG FILE (latest.log) ------------- (from /Users/<NAME OF USER>/cursforge/minecraft/Instances/<THE NAME OF MY EMPTY MODPACK>/logs/latest.log) (This was made after running an empty modpack with same versions for all apps) ("[REDACTED]" is not the actual text from the log, it is me replacing text I figured wouldn't be necessary for fixing and would hurt my privacy) https://pastebin.com/hxXvGGEK ------------- DEBUG.LOG (I realized that I should have put this here first after I had done all of the work on putting latest.log in) -------------------- (again, "[REDACTED]" is not the actual text from the log, it is me replacing text I figured wouldn't be necessary for fixing and would hurt my privacy) https://pastebin.com/Fmh8GHYs
    • Pastebin... https://pastebin.com/Y3iZ85L5   Brand new profile, does not point to a mod as far as I can tell, my fatal message just has something about mixins. Don't know much about reading logs like this, but am genuinely stuck, please help. Java updated, pc restarted.
    • I was playing minecraft, forge 47.3.0 and 1.20.1, but when i tried to play minecraft now only crashes, i need help please. here is the crash report: https://securelogger.net/files/e6640a4f-9ed0-4acc-8d06-2e500c77aaaf.txt
  • Topics

×
×
  • Create New...

Important Information

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