Jump to content

[1.7.10] [SOLVED] Custom Drops Disabling - For Servers


Recommended Posts

Posted

So.. I don't know enough about how Minecraft works to know if this is even possible.. but.. it's worth an ask..

And if it isn't I would like to know if there is any kind of work around...

 

I have a custom drop for Stone blocks (code here):

http://pastebin.com/Yhg7fhvm

 

Which works perfectly fine in Singleplayer but obviously crashes a server when them item is dropped.

 

Is there even a way to limit dropping of items on a player to player basis over a server?

 

If not is there anyway around it easily.. is there something like... making my own version of silk touch.. and giving it to players until they find the item... and then disabling it.. and just make the drop require the new silk touch?

 

Edit: My code if anyone else has a similar question:

 

Item Spawning:

http://pastebin.com/SjLxhDAS

 

IExtendedEntityProperties:

http://pastebin.com/uU8nwVv5

 

Entity Spawn Handler:

http://pastebin.com/kziFX23P

 

and finally registered with:

MinecraftForge.EVENT_BUS.register(new ExtendedPlayerStatsHandler());

 

Developing the Spiral Power Mod .

こんにちは!お元気ですか?

Posted

So looking at IExtendedEntityProperties, that certainly answers questions for the next 3 or 4 things I want to play with, so thank you so much for that.. But will storing the data on a per player basis here mean the event will fire on a per player basis instead of just stopping spawning in the world/on the server altogether?

Developing the Spiral Power Mod .

こんにちは!お元気ですか?

Posted

So.. at the center of the nested ifs... drop the item if event.harvester isn't set to null.. And earlier in the ifs check if the player has already gotten one of the drops already.. if they have then set the harvester for this event call to null?

Thanks again for your help. I'll play with this for a bit and pop back in if I have more questions. When I get it working I lock the post I guess?

Developing the Spiral Power Mod .

こんにちは!お元気ですか?

Posted

Okay. So I implemented IExtendedEntityProperties, and changed the spawn code to check if the entity calling the event already had the item with a boolean. If it doesn't it runs the random chance spawn coding, if it does it does nothing.

 

Tested through the IDE... built a version and tested in both single player and on my server. I don't have anyone else to pop in and test if it for multiple players but it works fine for me on every save/ server generation I tested.

 

Has the downside of resetting that value every time the player dies.. and thus failing the check and spawning another item I need to find a way to make it persist.. but this has solved my initial problem, once again thank you so much mate.

Developing the Spiral Power Mod .

こんにちは!お元気ですか?

Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

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