Jump to content

Recommended Posts

Posted

I'm trying to check if an item can be placed. I started out by checking if the ItemStack is a block but it misses some items such as sugar cane, nether wart, etc. I haven't been able to find a function isPlaceable or any Interface that could be used with instanceof.

 

My code right now:

 

BlockPos blockPos = mc.objectMouseOver.getBlockPos();
ItemStack itemInUse = mc.thePlayer.getHeldItem();

if (itemInUse != null) {
    Block resultBlock = Block.getBlockFromItem(itemInUse.getItem());

    if (mc.theWorld.getBlockState(blockPos).getBlock().getMaterial() == Material.air || resultBlock == null) {
        return;
    }
}

 

Is there any function that can do what I'm trying to achieve?

Posted

1.8 is no longer supported on this forum. Please update to a modern version of Minecraft to receive support.

It's sad how much time mods spend saying "x is no longer supported on this forum. Please update to a modern version of Minecraft to receive support".

Posted (edited)
1 hour ago, Novârch said:

1.8 is no longer supported on this forum. Please update to a modern version of Minecraft to receive support.

I can't, this is a mod for a 1.8.9 server. Furthermore, it's not my mod, I'm adding functionality to someone's mod.

Edited by Hawpe
Posted

Unfortunately, Forge no longer supports old version, because they are old and we can't maintain every version in perpetuity.

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.

Posted

I'm not asking for you to maintain old versions though, just asking if you are aware of a way to do what I'm trying to achieve with what's currently available in 1.8.9. I don't want you to add anything new.

Posted

1.8 is no longer supported on this forum.

Please update to a modern version of Minecraft to receive support.

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

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.