Jump to content

Recommended Posts

Posted

Hello guys. I have a question, hopefully someone can guide me and see what I'm doing wrong and what I should use to fix this.

 

I'm trying to create an invisible block. I almost had it, but I found 2 problems. One was that it was breakable with Dark Oak trees. (Same that happens with bedrock) I guess that's a Minecraft problem and nothing on the code itself.

 

Another problem I had was that water break the block.

 

This is the code I was using.

 

package com.american.survival.block;

import com.american.survival.configuration.ConfigValues;
import com.american.survival.reference.CSInfo;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.BlockGlass;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;

public class BlockInvisible extends BlockGlass
{

    public BlockInvisible(Material material, Boolean bool)
    {
        super(material, bool);
	this.setBlockName("invisible");
	this.setBlockUnbreakable();
	this.setResistance(60000000.0F);
    }

    public boolean isOpaqueCube() {
    return false;
    }

    public boolean isSolid()
    {
        return true;
    }

 @Override
 public String getUnlocalizedName() {
 return String.format("tile.%s%s", CSInfo.MOD_ID.toLowerCase() + ":", getUnwrappedUnlocalizedName(super.getUnlocalizedName()));
 }

 @Override
 @SideOnly(Side.CLIENT)
 public void registerBlockIcons(IIconRegister iconRegister) {
//	 blockIcon = iconRegister.registerIcon(String.format("%s", getUnwrappedUnlocalizedName(this.getUnlocalizedName())));

	 if (ConfigValues.showInvisibleBlock == false){
		 blockIcon = iconRegister.registerIcon("chunksurvival:invisible");
	 }
	 else{
		 blockIcon = iconRegister.registerIcon("chunksurvival:visible");
	 }

 }

 protected String getUnwrappedUnlocalizedName(String unlocalizedName) {
 return unlocalizedName.substring(unlocalizedName.indexOf(".") + 1);
 }


}

 

The material is defined as Material.air from a boolean config value.

 

What I need to achieve basically is:

 

[*]Block invisible / Visible if set so in a config file

[*]Block invisible not showing a hitbox

[*]Not breakable

[*]Rain must go through

[*]Hopefully no leaves grow on the other side of a wall made of this blocks

 

I had almost everything working, but the leaves problem and water breaking it, I have no clue how to fix it.

 

Any ideas?

 

PS: The overall idea is to be able to create a wall while in cheat mode, and once set to invisible a "Barrier" be in place of those blocks.

Posted

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

Draco it works perfect, the problem I'm having, and I know I'm not that good with this codes :P

 

But I can't figure out how to let rain go through.

 

I'm taking a look into the Cobweb code for example and I don't see what code is allowing the rain to go through it. I must be missing something basic.

 

Any clue?

 

Thanks in advice, meanwhile I will keep trying and see how to achieve this :D

Posted

But I can't figure out how to let rain go through.

 

I'm taking a look into the Cobweb code for example and I don't see what code is allowing the rain to go through it. I must be missing something basic.

 

Not something I have messed with.  I'll take a peek and get back to you.

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

It appears that this is the check that is used to determine if rain should pass through a block:

 

if (!material.blocksMovement() && !material.isLiquid())

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 sure how to apply that. But I think the method that I can use to let rain go through would be setting Material.air

 

It let's the rain to go through, but it makes the block to "break" with water... I will try different materials, I was thinking on material.web it lets rain go, but it also breaks with water.

 

I'll try some other materials or I will have to figure out how to make the block not breakable by water :D

 

Thanks Draco for your help, really awesome ;)

 

PS: Your Artifacts Mod is the one on the MadPack 2 right? I see JonBams playing it on Twitch :D

 

Posted

You'll need to make your own material.

 

PS: Your Artifacts Mod is the one on the MadPack 2 right? I see JonBams playing it on Twitch :D

 

Fuck if I know.  Artifacts is in like four dozen mod packs.  I don't keep track of their names.  But probably.

 

And to think that mod was merely an exploration of a new design pattern I wanted to experiment with.

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

You'll need to make your own material.

 

PS: Your Artifacts Mod is the one on the MadPack 2 right? I see JonBams playing it on Twitch :D

 

Fuck if I know.  Artifacts is in like four dozen mod packs.  I don't keep track of their names.  But probably.

 

And to think that mod was merely an exploration of a new design pattern I wanted to experiment with.

 

Ok, yes I was thinking the same, looks like I will have to create my own material. Hopefully I wont drown trying this :P Sounds scary to me, I'm not that good, just making a ModPack and this Mod with this block, just to fill my needing :D

 

PS: You should check JonBams some day, everytime he starts a World (He plays Hardcore) the first thing he looks for is an Artifact Tower :D

 

http://www.twitch.tv/jonbams

 

Man once again, thanks for your help, really appreciate.

 

:)

 

 

Posted

He plays Hardcore and the first thing he looks for is an Artifact Tower :D

 

Haha, I would too.  The artifacts are totally OP.

Took a quick look at his stream, yup, I saw one of my crowns. :D

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

Well, I finally went with 2 blocks. One for the walls that water can't break and rain doesn't go through it. And a second one for the roof of my barrier that lets rain pass and can be break by water but as there is no way to place water to it side or above it, players wont be able to do that :D

 

Not the most elegant solution, but it will do the trick ;)

 

Thanks for the help ;)

Posted

That sounds like it works pretty well.  Glad you figured it out. :)

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.

  • 1 month later...
Posted

Hey, sorry to get back this old post, but it's about the same.

 

I thought I had a problem, but I think it's a Minecraft problem. So now my question is... Can I do something on the code of my blocks to fix this?

 

Ok, let's describe what going on. I made the invisible, unbreakable block, the problem I have is that leaves can grow on the other side of them. And as you can see on the images, it happens on Minecraft Glass or Stone also (forgot to test bedrock)

 

And the "worst" when I tell my block to be invisible, you can't go through of course, but you can place blocks on the leaves that grow on the other side...(last image)

 

Any idea on what can I do to work around this?

 

Thanks a lot.

 

(Sorry for color changes I have a new Computer and my Corel isn't configured correctly yet)

lpHGphe.jpg

Posted

1) Your block is configured to be replaceable (look at Snow_Layer and Tall_Grass) which it should not be.

2) By not having a collision volume for raytracing, the game doesn't see your block for the purposes of interaction.  Water, lava, and air (along with most other fluids) are like this because you shouldn't be prevented from acting when inside these non-solid blocks.

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 think I know what you mean. But the problem is that when the block is there, it acts like glass, I can see through but I can't interact with whatever is on the other side of it. Now, when I make it invisible I can place blocks through it.

 

I'll take a look at tall grass and see what I can find there, but I think the problem is, my block when invisible doesn't has a collision box...

 

Thanks once again Draco ;)

  • 1 year later...
Posted

Don't necro an old post. If you have an issue, make your own topic. Also, 1.7.10 is no longer supported by Forge.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

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.