Jump to content

Recommended Posts

Posted

Hey guys! I am trying to make a portal. There are 3 custom blocks on each side and in the middle, one block down, there is the a 9x9 hole filled with lava (Kinda like the end-portal in the stronghold). And I can't figure out how to turn the lava blocks to a portal block if the player throws (Q-Button) a netherstar in the lava.

 

I thought maybe I can check the entityitem's position to locate if there is lava or not.. But I never did stuff with EntityItem's or something

so maybe someone can help me? thanks for your support!

Posted

Like the twilight forest portal with the flowers. In this case, the flowers are my custom blocks and the water is the lava. The item to summon the

portal is the nether star.

Posted

I can't think of a graceful way to do this if you are throwing a vanilla item.  It can be done, but it is a bit ugly.

 

Now, if you create a custom item you are throwing in, then you can have a custom entityitem for that item.  In that custom entityitem you can search for the conditions.  Also you can keep the entity item from going poof on contact with the lava.

 

 

Wait, on second though, look around for entity death event, check if it is an entityitem, then if it is a netherstar, then look for your conditions.  That will probably work and is fairly easy.

Long time Bukkit & Forge Programmer

Happy to try and help

Posted
  On 9/9/2015 at 2:44 PM, delpi said:

Wait, on second though, look around for entity death event, check if it is an entityitem, then if it is a netherstar, then look for your conditions.  That will probably work and is fairly easy.

 

There's no such event.

LivingDeathEvent

is only for living entities (i.e. entities that extend

EntityLivingBase

).

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.

Posted

So should I make a boolean method to check if the custom blocks are there? And in the method where it will check the contact with lava I will first write an if-Statement and check if the boolean method returns true. If it returns true, I will replace the lava with the portal block..

Posted

Hm I was looking at the src of Twilight Forest. He uses a TickHandler.. there he checks the entityItem (i think). Then he calld the method createPortal.. Couldnt understand much of it because it was not deobfuscated.

Posted

He is doing it the very involved way I thought of. 

 

Do what I suggested, it will be easier on you.

 

When you see your custom entityitem die (onDeath or something like that), do your search and if it is satisfied, build your portal.

Long time Bukkit & Forge Programmer

Happy to try and help

Posted

Hey guys! I made a custom entity item! So, if you drop a nether star, its entity item will actually convert to my custom entity item.

I wrote "this.isImmuneToFire = true;" in my custom entity item class. It is immune to fire, but if I check if its in lava, it doesn't call everything..

I used the boolean "isInLava"... So do you have any thoughts of why it doesn't equal to true?

 

Heres my event handler and EntityItem class:

 

Event Handler:

 

  Reveal hidden contents

 

 

Entity Item

 

  Reveal hidden contents

 

 

Thanks to delpi for giving me the suggestion to create the custom entity item class.

Posted

I guess this.isImmuneToFire = true is not the best way to make it immune to fire.. It somehow makes the entity item invisible.. If I walk to the block where it its, it pops up again..

Posted

You should compare

Item

instances directly (e.g.

someItemStack.getItem() == Items.nether_star

), don't compare their unlocalised names.

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.

Posted

I tried this:

 

event.world.isAABBInMaterial(aEntityItem.getBoundingBox(), Material.lava)

 

to check if it is in lava..

 

                if (event.world.isAABBInMaterial(aEntityItem.getBoundingBox(), Material.lava)) {

               

                    int dx = MathHelper.floor_double(aEntityItem.motionX);

                    int dy = MathHelper.floor_double(aEntityItem.motionY);

                    int dz = MathHelper.floor_double(aEntityItem.motionZ);

                    if (((BlockRVPortal)AOTOBlocks.rvPortal).tryToCreatePortal(event.world, dx, dy, dz)) {

                    WorldInfo wInfo = event.world.getWorldInfo();

                    event.world.addWeatherEffect(new EntityLightningBolt(event.world, dx, dy, dz));

                        wInfo.setRainTime(1000);

                        wInfo.setThunderTime(1000);

                        wInfo.setRaining(true);

                        wInfo.setThundering(true);

                        aEntityItem.setDead();

                        event.setCanceled(true);

                    }

                }

 

Still doesn't work.. But if gives me an error if I throw the nether star..

(But it doesn't crash)

 

[18:55:59] [server thread/ERROR] [FML]: Index: 3 Listeners:

[18:55:59] [server thread/ERROR] [FML]: 0: HIGHEST

[18:55:59] [server thread/ERROR] [FML]: 1: ASM: net.minecraftforge.common.ForgeInternalHandler@7fb27a08 onEntityJoinWorld(Lnet/minecraftforge/event/entity/EntityJoinWorldEvent;)V

[18:55:59] [server thread/ERROR] [FML]: 2: NORMAL

[18:55:59] [server thread/ERROR] [FML]: 3: ASM: netcrafter.mods.aoto.event.AOTOEventHandler@4bfb3772 onEntityJoinWorld(Lnet/minecraftforge/event/entity/EntityJoinWorldEvent;)V

[18:55:59] [server thread/FATAL] [FML]: Exception caught executing FutureTask: java.util.concurrent.ExecutionException: java.lang.NullPointerException

java.util.concurrent.ExecutionException: java.lang.NullPointerException

at java.util.concurrent.FutureTask.report(Unknown Source) ~[?:1.7.0_79]

at java.util.concurrent.FutureTask.get(Unknown Source) ~[?:1.7.0_79]

at net.minecraftforge.fml.common.FMLCommonHandler.callFuture(FMLCommonHandler.java:715) [FMLCommonHandler.class:?]

at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:727) [MinecraftServer.class:?]

at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:669) [MinecraftServer.class:?]

at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:171) [integratedServer.class:?]

at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:540) [MinecraftServer.class:?]

at java.lang.Thread.run(Unknown Source) [?:1.7.0_79]

Caused by: java.lang.NullPointerException

at net.minecraft.world.World.isAABBInMaterial(World.java:2318) ~[World.class:?]

at netcrafter.mods.aoto.event.AOTOEventHandler.onEntityJoinWorld(AOTOEventHandler.java:54) ~[AOTOEventHandler.class:?]

at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_6_AOTOEventHandler_onEntityJoinWorld_EntityJoinWorldEvent.invoke(.dynamic) ~[?:?]

at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:55) ~[ASMEventHandler.class:?]

at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:138) ~[EventBus.class:?]

at net.minecraft.world.World.spawnEntityInWorld(World.java:1230) ~[World.class:?]

at net.minecraft.entity.player.EntityPlayer.joinEntityItemWithWorld(EntityPlayer.java:934) ~[EntityPlayer.class:?]

at net.minecraftforge.common.ForgeHooks.onPlayerTossEvent(ForgeHooks.java:421) ~[ForgeHooks.class:?]

at net.minecraft.entity.player.EntityPlayer.dropOneItem(EntityPlayer.java:854) ~[EntityPlayer.class:?]

at net.minecraft.network.NetHandlerPlayServer.processPlayerDigging(NetHandlerPlayServer.java:513) ~[NetHandlerPlayServer.class:?]

at net.minecraft.network.play.client.C07PacketPlayerDigging.processPacket(C07PacketPlayerDigging.java:53) ~[C07PacketPlayerDigging.class:?]

at net.minecraft.network.play.client.C07PacketPlayerDigging.processPacket(C07PacketPlayerDigging.java:76) ~[C07PacketPlayerDigging.class:?]

at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:24) ~[PacketThreadUtil$1.class:?]

at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[?:1.7.0_79]

at java.util.concurrent.FutureTask.run(Unknown Source) ~[?:1.7.0_79]

at net.minecraftforge.fml.common.FMLCommonHandler.callFuture(FMLCommonHandler.java:714) ~[FMLCommonHandler.class:?]

... 5 more

 

Your right.. I changed it:

if(stack.getItem() == Items.nether_star)

Posted

Well, I was dumb and put the bounding box in..

But I needed the entity bounding box..

 

Still doesn't work if I throw the item in the lava..

 

is AABB (entity bounding box) In Material (Material.lava)?

The entity of the boats in minecraft does this too with water (Material.water)

 

 

if (event.world.isAABBInMaterial(aEntityItem.getEntityBoundingBox(), Material.lava)) {       

                    int dx = MathHelper.floor_double(aEntityItem.motionX);

                    int dy = MathHelper.floor_double(aEntityItem.motionY);

                    int dz = MathHelper.floor_double(aEntityItem.motionZ);

                    if (((BlockRVPortal)AOTOBlocks.rvPortal).tryToCreatePortal(event.world, dx, dy, dz)) {

                    WorldInfo wInfo = event.world.getWorldInfo();

                    event.world.addWeatherEffect(new EntityLightningBolt(event.world, dx, dy, dz));

                        wInfo.setRainTime(1000);

                        wInfo.setThunderTime(1000);

                        wInfo.setRaining(true);

                        wInfo.setThundering(true);

                        aEntityItem.setDead();

                        event.setCanceled(true);

                    }

[spoiler/]

Posted

I don't think this should be in your event handler, since the item usually won't be in lava at the moment it's dropped.

Entity#setOnFireFromLava

will be called when the item is in lava, you should be able to override this to check for the portal activation criteria.

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.

Posted

Thanks, Choonster!

 

Got it working now finally..

Is it neccesary to check if the item is in lava?

Because the method is basically being called

if it catches fire of lava..

 

But anyways, thanks very much to delpi and Choonster!

 

 

Posted
  On 9/10/2015 at 5:49 PM, DaryBob said:

Is it neccesary to check if the item is in lava?

Because the method is basically being called

if it catches fire of lava..

 

It shouldn't be necessary to check if it's in lava, the method should only be called if it's already known that it is in lava.

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.

Posted

Hey guy's, i've found a new problem..

If I throw the nether star into the lava,

it creates the portal, but sometimes

it doesn't check if it is in lava..

So it only creates a portal every

10 times or something..

Any thoughts on why this

is so?

 

Custom Entity Item

 

  Reveal hidden contents

 

 

Portal Block:

 

  Reveal hidden contents

 

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

    • Betafort Recovery has emerged as a prominent figure in the realm of cryptocurrency recovery, gaining a reputation for their exceptional ability to retrieve lost Bitcoin (BTC) and other cryptocurrencies. Their expertise and track record have made them a beacon of hope for individuals facing the distressing situation of lost or inaccessible crypto assets.  
    • When you name a method like that, with no return value, it is a constructor. The constructor must have the same name as the class it constructs, in this case, ModItems. I would strongly advise reading up on some basic Java tutorials, because you will definitely be running into a lot more issues as you go along without the basics. *I should also add that the Forge documentation is a reference, not a tutorial. Even following tutorials, you should know Java basics, otherwise the smallest of mistakes will trip you up as you copy someone elses code.
    • so, I'm starting modding and I'm following the official documantation for forge: https://docs.minecraftforge.net, but in the registries part it is not working as it is in the docs:   public class ModItems { private static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, DarkStarvation.MOD_ID); public static final RegistryObject<Item> TEST_ITEM = ITEMS.register("test_item", () -> new Item(new Item.Properties())); public DarkStarvation(FMLJavaModLoadingContext context) { ITEMS.register(context.getModEventBus()); } } in 'public DarkStarvation(...' the DarkStarvation has this error: Invalid method declaration; return type required and the getModEventBus(): Cannot resolve method 'getModEventBus' in 'FMLJavaModLoadingContext' please help, I asked gpt but it is saying that I'm using an old method, but I'm following the latest version of Forge Docs???
    • I merged your second post with the original , there is no need to post a new thread asking for an answer. If someone sees your post and can help, they will reply. If you are seeking a quicker response, you could try asking in the Minecraft Forge diacord.
    • Create a new instance and start with cobblemon - if this works, add the rest of your mods in groups   Maybe another mod is conflicting - like Sodium/Iris or Radical Cobblemon Trainers
  • Topics

×
×
  • Create New...

Important Information

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