Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Custom Fence won't connect to each other...


A-Game
 Share

Recommended Posts

I've created a custom fence and the textures will connect to other blocks, but not itself, I've tried adding it to the "minecraft:fences" tag and the forge version of it as well to no success. I also registered it as a "new FenceBlock".

 

Tag:

{

  "replace": true,

  "values": [

    "#minecraft:wooden_fences",

    "minecraft:nether_brick_fence",

    "visionarymod:rednetherbrickfence"

  ]

}

 

 

Edited by A-Game
Link to comment
Share on other sites

13 minutes ago, A-Game said:

I've created a custom fence and the textures will connect to other blocks, but not itself, I've tried adding it to the "minecraft:fences" tag and the forge version of it as well to no success. I also registered it as a "new FenceBlock".

I think you need to override Block#isIn

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

57 minutes ago, A-Game said:

Do I need to create a custom class for my custom fence block for that to work?

Yes you need your own custom class to override a method.

 

57 minutes ago, A-Game said:

Cause I didn't do so since the nether brick fence doesn't have a custom class to work...

That's because it is already included in the tag.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

45 minutes ago, A-Game said:

It will not allow me to Override the method, it only shows "delete these tokens" under the error message...

Did you use your IDE to override the method? You might be missing its parameter.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

I solved the problem by renaming the package the tag was in to "data.minecraft.tags.block" rather than "data.visionarymod.tags.block" which I did before. This means no actual class was needed for the block to have connected textures. Also on the side note, by doing this, you can create separate tags in the same package with your fence block and another fence block which will allow those fences to connect, but not any other fences. I did this with nether brick and my red nether brick fences and they were able to connect to each other, but not any of the wooden fences. Thanks for the help, though this ended up being a problem with the tags.

Link to comment
Share on other sites

38 minutes ago, A-Game said:

I solved the problem by renaming the package the tag was in to "data.minecraft.tags.block" rather than "data.visionarymod.tags.block" which I did before. This means no actual class was needed for the block to have connected textures.

This is because you are overriding the vanilla tag now. Guess what this means. If another mod does this exact same thing one of your fences will not work. So you should instead override Block#isIn

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

I've tried your @Override method, no success...

As for why I tried the previous method:

 

package dev.theagameplayer.visionarymod.block;

 

import dev.theagameplayer.visionarymod.tags.VisionaryBlockTags;

import net.minecraft.block.Block;

import net.minecraft.block.BlockState;

import net.minecraft.block.FenceBlock;

import net.minecraft.block.FenceGateBlock;

import net.minecraft.util.Direction;

 

public class RedNetherBrickFence extends FenceBlock {

 

public RedNetherBrickFence(Block.Properties builder) {

super(builder);

}

 

@Override

public boolean func_220111_a(BlockState p_220111_1_, boolean p_220111_2_, Direction p_220111_3_) {

  Block block = p_220111_1_.getBlock();

  boolean flag = block.isIn(VisionaryBlockTags.VISIONARYFENCES) && p_220111_1_.getMaterial() == this.material;

  boolean flag1 = block instanceof FenceGateBlock && FenceGateBlock.isParallel(p_220111_1_, p_220111_3_);

  return !cannotAttach(block) && p_220111_2_ || flag || flag1;

}

}

Edited by A-Game
Link to comment
Share on other sites

21 minutes ago, A-Game said:

boolean flag = block.isIn(VisionaryBlockTags.VISIONARYFENCES)

Excellent it still wont connect to other mods fences. Also that line literally uses the method I'm telling you to override. And block is definitely a Block. So the method exists.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

5 minutes ago, A-Game said:

It still won't connect to itself though...

It's pretty hard to debug code I cant see.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

On 10/8/2019 at 8:45 PM, Animefan8888 said:

This is because you are overriding the vanilla tag now. Guess what this means. If another mod does this exact same thing one of your fences will not work. 

...you realize that one of the parameters of the tag json definition is called "replace" and if you say "false" they add together, right?

 

Quote

replace: Optional. Whether or not contents of this tag should completely replace tag contents from different lower priority data packs with the same namespaced ID. When false the tag's content will append to the contents of the higher priority data packs, instead. Defaults to false.

https://minecraft.gamepedia.com/Tag#JSON_format

 

Example being used:

https://github.com/Draco18s/ReasonableRealism/blob/1.14.4/src/main/resources/data/minecraft/tags/blocks/rails.json

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

1 minute ago, Draco18s said:

...you realize that one of the parameters of the tag json definition is called "replace" and if you say "false" they add together, right?

I did not. I was thinking it operated like all of the other datapack jsons. Completely overriding the previous entry like loot tables. Or is that a misconception on my end as well?

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

9 hours ago, Animefan8888 said:

Completely overriding the previous entry like loot tables. Or is that a misconception on my end as well?

No, those are overridden. There's no way to "merge" things like recipes and advancements. Tags are just lists of items.

(Forge added a few extra bits of functionality, such as a way to list things to remove from a tag without overwriting entirely).

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

  • 2 months later...
On 10/11/2019 at 1:03 AM, A-Game said:

I've tried your @Override method, no success...

As for why I tried the previous method:

 

package dev.theagameplayer.visionarymod.block;

 

import dev.theagameplayer.visionarymod.tags.VisionaryBlockTags;

import net.minecraft.block.Block;

import net.minecraft.block.BlockState;

import net.minecraft.block.FenceBlock;

import net.minecraft.block.FenceGateBlock;

import net.minecraft.util.Direction;

 

public class RedNetherBrickFence extends FenceBlock {

 

public RedNetherBrickFence(Block.Properties builder) {

super(builder);

}

 

@Override

public boolean func_220111_a(BlockState p_220111_1_, boolean p_220111_2_, Direction p_220111_3_) {

  Block block = p_220111_1_.getBlock();

  boolean flag = block.isIn(VisionaryBlockTags.VISIONARYFENCES) && p_220111_1_.getMaterial() == this.material;

  boolean flag1 = block instanceof FenceGateBlock && FenceGateBlock.isParallel(p_220111_1_, p_220111_3_);

  return !cannotAttach(block) && p_220111_2_ || flag || flag1;

}

}

Hello! I just saw that you referenced my old post, so I'm not sure if you've fixed this already, but I figured I would post my solution anyway:

 

Under the data folder, I created three new folders: one called minecraft, inside that one i created one called tags, and inside that one I created one called blocks.

Now, inside the tags/blocks folder I create a fences.json file with the following in it:

{
  "replace": false,
  "values": [
    "pme:pier_fence"
  ]
}

 

Unlike you I didn't create a custom Fence class, I just used Minecrafts in-built one, since I didn't need any additional functionality, so unless you're creating some "special" fence that has additional functionality, you could just use the in-built class.

 

Hope this helped if you haven't already solved the problem! ?

Link to comment
Share on other sites

43 minutes ago, peter1745 said:

pme:pier_fence

BTW, make your modID longer. You have 64 characters of length, use them. "pme" is not unique enough.

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

2 minutes ago, Draco18s said:

BTW, make your modID longer. You have 64 characters of length, use them. "pme" is not unique enough.

Yeah, not really maintaining the mod that this belongs to anymore. It was just an example, and it's not really relevant to this topic either

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
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.

 Share



×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.