Jump to content

custom block that prevents spawning of mobs in a certain perimeter


Thaliviel

Recommended Posts

  • Replies 61
  • Created
  • Last Reply

Top Posters In This Topic

Okay, so adding a glow/brightness is quite difficult, right?

There's no method similar to setLightValue(), where you can just set a value.

There is getBlockBrightness(), but that doesn't seem to help...

 

So I have to create a renderer and set the brightness with a tesselator, if I'm not mistaken?

Or is there an easier method?

____

Basically, I just want to make the block look like it recieves light from a torch on every side. Or something like that.

Link to comment
Share on other sites

Ooh, you want it to LOOK like it is fully lit without actually emitting light.

 

That's trickier, but involves rendering the block yourself.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

There is still one thing bothering me: In the documentation

http://mcforge.readthedocs.org/en/latest/datastorage/worldsaveddata/

it says:

 

There are two ways to attach the data: per dimension, or globally.

[...]

In code, these storage locations are represented by two instances of MapStorage present in the World object. The global data is obtained from World#getMapStorage(), while the per-world map is obtained from World#getPerWorldStorage().

 

However, I didn't use getMapStorage or getPerWorldStorage...

So is my BlockList stored per dimension or globally?

Link to comment
Share on other sites

Have you looked at the source of the

World#loadItemData

method? In 1.8.9, it uses

World#mapStorage

(global) rather than

World#perWorldStorage

(per-dimension).

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

Thank you!!

 

An instance of "world" is a dimension, like overworld, or nether, right? Or is it the whole world containing all dimensions?

 

So right now my BlockList is global, which means spawns will be denied in all dimensions. So when I put a MonsterBlocker-Block in the overworld, spawns will be denied in same area of the nether, too, although there is no MB-Block in the nether. Did I understand this right?

 

If that's the case, I somehow need to use World#perWorldStorage(), and I think that I'll be able to do that on my own - so please just confirm if I'm right, or correct me if I'm wrong.

Link to comment
Share on other sites

Wait, something's not right.

 

	public void LSECheckSpawn(LivingSpawnEvent.CheckSpawn event)
{
	List<Position> mbBlockList = new ArrayList();
	MBSave mbdata = get(event.world);
	mbBlockList = mbdata.getList();

 

I'm retrieving the mbdata from a certain world (dimension).

So it SHOULD be right the way it is now? I'm confused...

Link to comment
Share on other sites

Thank you!!

 

An instance of "world" is a dimension, like overworld, or nether, right? Or is it the whole world containing all dimensions?

 

So right now my BlockList is global, which means spawns will be denied in all dimensions. So when I put a MonsterBlocker-Block in the overworld, spawns will be denied in same area of the nether, too, although there is no MB-Block in the nether. Did I understand this right?

 

If that's the case, I somehow need to use World#perWorldStorage(), and I think that I'll be able to do that on my own - so please just confirm if I'm right, or correct me if I'm wrong.

 

An instance of

World

is one dimension, yes.

 

Wait, something's not right.

 

	public void LSECheckSpawn(LivingSpawnEvent.CheckSpawn event)
{
	List<Position> mbBlockList = new ArrayList();
	MBSave mbdata = get(event.world);
	mbBlockList = mbdata.getList();

 

I'm retrieving the mbdata from a certain world (dimension).

So it SHOULD be right the way it is now? I'm confused...

 

There's no point in creating an

ArrayList

if you're immediately assigning another value to the variable. Declare the

mbBlockList

variable in the same statement as you're calling

mbdata.getList()

in.

 

Your

get

method does receive a

World

argument, but it uses

World#loadItemData

to load the data from that

World

. At least in 1.8.9, this uses the global

MapStorage

(

World#mapStorage

) instead of that dimension's

MapStorage

(

World#perWorldStorage

).

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

Okay, nevermind. I was dumb to assume that setLightValue(2F) would be brighter than setLightValue(1F).

 

So if light is 0 to 15, and 1.0f corresponds to 15 and it bit-overflows, what happens is we double that?

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

My old get method was this:

	public static MBSave get(World world) {
	MBSave handler = (MBSave) world.loadItemData(MBSave.class, DATA_NAME);
	if(handler==null) {
		handler = new MBSave();
		world.setItemData(DATA_NAME, handler);
	}
	return handler;
}

 

And in World.class there is

    public WorldSavedData loadItemData(Class par1Class, String par2Str)
    {
        return this.mapStorage.loadData(par1Class, par2Str);
    }

 

But instead of mapStorage (global) I need perWorldStorage. So my new get method is:

	public static MBSave get(World world) {
	MBSave handler = (MBSave) world.perWorldStorage.loadData(MBSave.class, DATA_NAME);
	if(handler==null) {
		handler = new MBSave();
		world.perWorldStorage.setData(DATA_NAME, handler);
	}
	return handler;
}

 

Is that right? If it is, then I'm a bit proud that I'm understanding Java and Minecraft and Forge a little more than when I started this thread :)

At least it is working when I test it with these changes.

Link to comment
Share on other sites

If the

World#perWorldStorage

field is public in 1.6.4, your new code is correct. The field is protected in 1.8.9, but that may be a recent change.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

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

    • Etumax Royal Honey Price In Pakistan - Get Free Delivery Shop Today Online With Online Shopping in Pakistan Etumax Royal Honey Available At Our Store Online Shopping in Pakistan, 
    • I want to make a tree decorator that will generate a beehive under branches of my tree. I have no idea how to check for branches and make beehives generate because TreeDecorator.Context.logs() is just a block pos and i dont understand how it works. i hope ill get an answer here.
    • Imagine this: you've painstakingly accumulated $97,000 worth of Bitcoin, only to see it vanish into the digital abyss at the hands of cunning scammers. It's a devastating blow, leaving you feeling helpless and betrayed. But fear not, for Lee Ultimate Hacker is here to turn the tide in your favor. After conducting extensive research on cryptocurrency recovery options, I stumbled upon Lee Ultimate Hacker, and it proved to be the most suitable choice for the daunting task at hand. Despite my initial skepticism, they shattered my doubts by successfully retrieving $92,000 of the lost Bitcoin—a feat I once deemed impossible. From the moment I reached out to Lee Ultimate Hacker and provided them with all the pertinent information about the fraudulent transaction, they sprang into action with unwavering determination. True to their word, they delivered on their promise to recover the lost Bitcoin within an impressive timeframe of 24 to 72 hours. Their professionalism, expertise, and commitment to their clients were truly commendable, transforming what seemed like an insurmountable ordeal into a resounding triumph. In my eyes, the investment of both time and money was more than justified by the remarkable outcome achieved by Lee Ultimate Hacker. So, if you've fallen victim to cryptocurrency scams and are grappling with the anguish of lost funds, don't despair. Reach out to Lee Ultimate Hacker and let them work their magic. Their track record of success speaks for itself, and with their assistance, you can reclaim what's rightfully yours and emerge stronger than ever before. Don't let the darkness of cybercrime overshadow your financial future. Take a stand against fraudsters with the help of Lee Ultimate Hacker, and witness the transformation from despair to triumph. Your journey to recovery starts here. LEEULTIMATEHACKER@ AOL. COM or Support @ leeultimatehacker . com. telegram:LEEULTIMATE or wh@tsapp +1  (715) 314  -  9248 https://leeultimatehacker.com Thank you.
    • There's a scheme I got into where they promised to trade Bitcoin for me and take a cut as a commission. Seemed like a good idea at the time. But then, things went south real fast. They ended up transferring   $190,000 worth of my Bitcoin. I was devastated and felt completely helpless. That's when I stumbled upon the Wizard Web Recovery Tool. It was like a beacon of hope amid chaos. With this tool, I could finally start digging into what went wrong and hopefully get my Bitcoin back. Using Wizard Web was surprisingly easy. I just had to plug in some details about my Bitcoin account and let it do its thing. It started scanning the internet, looking for any clues about what happened to my Bitcoin. It felt like having a detective on my side, searching for answers. And guess what? Wizard Web found some leads. It uncovered evidence of the scheme's shady dealings and helped me track down the people responsible for losing my Bitcoin. Armed with this information, I took the case to court. After a long and hard-fought legal battle, the court ruled in my favor. The perpetrators were held accountable for their actions and faced criminal charges for their involvement in the scheme. It was a victory not just for me, but for anyone who's been taken advantage of by these kinds of scams. Thanks to Wizard Web Recovery, I was able to get justice and reclaim what was rightfully mine. It showed me that even in the face of adversity, there's always a way to fight back. And with the right tools and determination, anything is possible.   The following is the contact information for Wizard Web Recovery.   Email: wizard web recovery((@))programmer . net
    • Hello, good morning. I know some programming and I'm interested in mod creation. That's why I've decided to follow a tutorial guide on YouTube by TurtyWurty. https://www.youtube.com/watch?v=DhoX9cmAZqA&t=160s&ab_channel=TurtyWurty I've followed the tutorial perfectly. The problem is that when checking the food, the texture doesn't load for me. However, everything seems fine no matter how much I check. I'm sure it's something trivial, the problem is that I can't find it. Could you help me solve it, please? I leave a zip of my file so you can edit it freely. forge-1.20-Civicraft.rar
  • Topics

×
×
  • Create New...

Important Information

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