Jump to content

Recommended Posts

Posted

Hello

i want to make some of my custom blocks colorable exactly like the leather-armour.

 

The basic color should be white and all other colors should have the additional info "dyed" under the block´s name.

it should be able to craft the white ones with a basic-recipe i made and the other colors with a dye added to the receipe or a finished one and a dye in a receipe.

A colored one with a dye in a receipe should change the color a bit, just like leather armour, too

Also it should be possible, to get all colours, wich can be created in a graphic-program, by typing a chat-command, wich includes the name of the block and a number for a color.

 

I already have a white extra-texture for the color changing parts of my blocks.

 

how do i code this?

Posted (edited)

It'll depends on how you want to achieve this.

You could create 16 blocks, each matching a vanilla dye color.

 

However, if you want to register all color variants as one block, you can store the color in the block's property, and just specify the color in the variants in the blockstates json.

 

Other alternatives exist, such as how BonsaiTrees handles its coloring: https://github.com/thraaawn/BonsaiTrees/blob/master/src/main/java/org/dave/bonsaitrees/block/BlockBonsaiPot.java

 

As for the crafting, you might have to create an IRecipe implementation.

Edited by DavidM

Some tips:

Spoiler

Modder Support:

Spoiler

1. Do not follow tutorials on YouTube, especially TechnoVision (previously called Loremaster) and HarryTalks, due to their promotion of bad practice and usage of outdated code.

2. Always post your code.

3. Never copy and paste code. You won't learn anything from doing that.

4. 

Quote

Programming via Eclipse's hotfixes will get you nowhere

5. Learn to use your IDE, especially the debugger.

6.

Quote

The "picture that's worth 1000 words" only works if there's an obvious problem or a freehand red circle around it.

Support & Bug Reports:

Spoiler

1. Read the EAQ before asking for help. Remember to provide the appropriate log(s).

2. Versions below 1.11 are no longer supported due to their age. Update to a modern version of Minecraft to receive support.

 

 

Posted (edited)

how do i store the colors in the blockstates json?

 

And i want to be able to get all 16777216 color shades, a pc can make, by using an ingame-chat-commant with a color-vaule.

 

i added implements IRecipe to one of my block classes and that added some methods there.

How do i use them fo my coloring thing?

Edited by Drachenbauer
Posted (edited)
20 hours ago, Drachenbauer said:

how do i store the colors in the blockstates json?

If you want 16777216 color variations you will need a TileEntity + FastTESR/Custom baked model an IBlockColor implementation

Edited by Cadiboo

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Posted

IBlockColor won't help you store any additional data. You'd still need a TE.

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
6 minutes ago, Drachenbauer said:

TE

Tile Entity.

 

6 minutes ago, Drachenbauer said:

How do i implament IRecipe and IBlockColor in the same class?

We've never told you to do that. They are separate.

 

There are plenty of examples out there on tile entities.

If you are looking for how to use a TESR. Here is a tutorial on that: https://github.com/TheGreyGhost/MinecraftByExample/tree/master/src/main/java/minecraftbyexample/mbe21_tileentityspecialrenderer.

Some tips:

Spoiler

Modder Support:

Spoiler

1. Do not follow tutorials on YouTube, especially TechnoVision (previously called Loremaster) and HarryTalks, due to their promotion of bad practice and usage of outdated code.

2. Always post your code.

3. Never copy and paste code. You won't learn anything from doing that.

4. 

Quote

Programming via Eclipse's hotfixes will get you nowhere

5. Learn to use your IDE, especially the debugger.

6.

Quote

The "picture that's worth 1000 words" only works if there's an obvious problem or a freehand red circle around it.

Support & Bug Reports:

Spoiler

1. Read the EAQ before asking for help. Remember to provide the appropriate log(s).

2. Versions below 1.11 are no longer supported due to their age. Update to a modern version of Minecraft to receive support.

 

 

Posted (edited)

i meaned having connections to boch interfaces in my block-class.

and i found out, i just have to separate their names with a ",", where i implement them:

public class BalloonBlock extends Block implements IRecipe, IBlockColor

 

 

I looked into the ItemArmorDyeable class of the basic Minecraft-stuff and found something about colors there, but i don´t know how to reproduce that in a block-class

 

And where are the recipe-jsons for dying a leather-armour?

There must be something special in the result-area of them, that i need to reproduce in my own dying recipes for my blocks.

 

And how do i create a tile-entity?

Edited by Drachenbauer
Posted (edited)
40 minutes ago, Drachenbauer said:

And how do i create a tile-entity?

https://github.com/TheGreyGhost/MinecraftByExample/tree/master/src/main/java/minecraftbyexample/mbe20_tileentity_data

 

40 minutes ago, Drachenbauer said:

I looked into the ItemArmorDyeable class of the basic Minecraft-stuff and found something about colors there, but i don´t know how to reproduce that in a block-class

The effect you are trying to achieve is not remotely similar to the leather armor of vanilla minecraft. I don't see why you are looking in there.

 

40 minutes ago, Drachenbauer said:

and i found out, i just have to separate their names with a ",", where i implement them:


public class BalloonBlock extends Block implements IRecipe, IBlockColor

... wtf?

Please make sure you understand what you are doing before trying to implement your ideas into your code.

Seeing how you want to create 16^6 different colors (and how lost you currently are), I suggest you to ditch the entire "IBlockColor" idea and do everything with tile entities and TESRs instead. You can implement it like how Cadiboo suggested:

On 3/3/2019 at 6:12 PM, Cadiboo said:

If you want 16777216 color variations you will need a TileEntity + FastTESR/Custom baked model

 

Edited by DavidM

Some tips:

Spoiler

Modder Support:

Spoiler

1. Do not follow tutorials on YouTube, especially TechnoVision (previously called Loremaster) and HarryTalks, due to their promotion of bad practice and usage of outdated code.

2. Always post your code.

3. Never copy and paste code. You won't learn anything from doing that.

4. 

Quote

Programming via Eclipse's hotfixes will get you nowhere

5. Learn to use your IDE, especially the debugger.

6.

Quote

The "picture that's worth 1000 words" only works if there's an obvious problem or a freehand red circle around it.

Support & Bug Reports:

Spoiler

1. Read the EAQ before asking for help. Remember to provide the appropriate log(s).

2. Versions below 1.11 are no longer supported due to their age. Update to a modern version of Minecraft to receive support.

 

 

Posted
1 minute ago, Drachenbauer said:

I think, for me the best workflow is to find working samples of my ideas and reproduce them in my mod.

 

Has anyone already got a block with 16777216 colors to work?

1. It is unlikely that someone has created exactly what you are trying to create before. You really should try making it yourself.

2. Judging by your previous posts (which strongly indicate that you have little idea on what is going on), I suspect that you want to copy/paste working code from others. This is highly discouraged on this forum. You need to learn how to create tile entities and TESRs, and work toward your goal yourself. It will not benefit you to just copy code from others.

Some tips:

Spoiler

Modder Support:

Spoiler

1. Do not follow tutorials on YouTube, especially TechnoVision (previously called Loremaster) and HarryTalks, due to their promotion of bad practice and usage of outdated code.

2. Always post your code.

3. Never copy and paste code. You won't learn anything from doing that.

4. 

Quote

Programming via Eclipse's hotfixes will get you nowhere

5. Learn to use your IDE, especially the debugger.

6.

Quote

The "picture that's worth 1000 words" only works if there's an obvious problem or a freehand red circle around it.

Support & Bug Reports:

Spoiler

1. Read the EAQ before asking for help. Remember to provide the appropriate log(s).

2. Versions below 1.11 are no longer supported due to their age. Update to a modern version of Minecraft to receive support.

 

 

Posted (edited)

But i don´t know how the code should look like, if i didn´t see a workung sample before.

 

And i also think the same result needs the same piece of code, no matter, who want to have this effect in a mod

Edited by Drachenbauer
Posted
1 hour ago, Drachenbauer said:

But i don´t know how the code should look like, if i didn´t see a workung sample before.

Before doing something on this scale, I would suggest to start with making some simpler things..

 

Try to just create a block with a TileEntity. And instead of doing everything at the same time, just log something in your TileEntity#tick. If that works move on to the next thing, like implementing colour data.

 

You can copy/paste all you want, but you'll never get it to work by doing it the way your handling it right now. Some part of the whole thing won't work and you wouldn't even have clue where you need to look for debugging.

 

If you can only learn from examples, then I suggest to look at the link DavidM posted earlier. But try to understand the code instead of just copy/pasting everything

Posted
1 hour ago, Drachenbauer said:

And i also think the same result needs the same piece of code, no matter, who want to have this effect in a mod

And by the way, just copying from someone else without permission is just blately a violation of copyright and disrespectful.

Posted
24 minutes ago, Drachenbauer said:

How do i add a tile entity to a block?

Make a separate class called something like TileEntityColouredBlock that extends TileEntity.

 

Then in your ColouredBlock class that extends from Block, override Block#hasTileEntity and return true.

 

Also override Block#createTileEntity and return a new instance of your TileEntityColouredBlock class.

 

Don't forget to register your TileEntity.

Posted

now i have this:

	@Override
	public boolean hasTileEntity()
	{
		return true;
	}
	
	@Override
	public TileEntity createTileEntity(IBlockState state, IBlockReader world)
	{
		return new TileEntityBlockColors(null)
		{
			
		};
	}

TileEntityBlockColors is the name of my TileEntity-class

should i replace the "null" behind it with something else?

Posted

Yes. But I won't tell you what, because you need to learn how to figure stuff out for 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.

Posted

You may/may not have already read this, but it’s useful - https://gist.github.com/williewillus/353c872bcf1a6ace9921189f6100d09a.

You need to fix your error with not being able to see the minecraft library as an attached source before you continue Modding. Everything that mods do is based off vanilla.

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Posted
3 hours ago, Blue_Atlas said:

I believe a version of what you are trying to do is this mod, right?

No. His approach is with tile entities, as well as making all 16^6 colors, which is completely different from mod in the link.

Some tips:

Spoiler

Modder Support:

Spoiler

1. Do not follow tutorials on YouTube, especially TechnoVision (previously called Loremaster) and HarryTalks, due to their promotion of bad practice and usage of outdated code.

2. Always post your code.

3. Never copy and paste code. You won't learn anything from doing that.

4. 

Quote

Programming via Eclipse's hotfixes will get you nowhere

5. Learn to use your IDE, especially the debugger.

6.

Quote

The "picture that's worth 1000 words" only works if there's an obvious problem or a freehand red circle around it.

Support & Bug Reports:

Spoiler

1. Read the EAQ before asking for help. Remember to provide the appropriate log(s).

2. Versions below 1.11 are no longer supported due to their age. Update to a modern version of Minecraft to receive support.

 

 

Posted
4 minutes ago, Drachenbauer said:

how do i learn that?

You know... probably... learn from the tutorial I've given you at least 3 times?

Some tips:

Spoiler

Modder Support:

Spoiler

1. Do not follow tutorials on YouTube, especially TechnoVision (previously called Loremaster) and HarryTalks, due to their promotion of bad practice and usage of outdated code.

2. Always post your code.

3. Never copy and paste code. You won't learn anything from doing that.

4. 

Quote

Programming via Eclipse's hotfixes will get you nowhere

5. Learn to use your IDE, especially the debugger.

6.

Quote

The "picture that's worth 1000 words" only works if there's an obvious problem or a freehand red circle around it.

Support & Bug Reports:

Spoiler

1. Read the EAQ before asking for help. Remember to provide the appropriate log(s).

2. Versions below 1.11 are no longer supported due to their age. Update to a modern version of Minecraft to receive support.

 

 

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

    • Im trying to build my mod using shade since i use the luaj library however i keep getting this error Reason: Task ':reobfJar' uses this output of task ':shadowJar' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. So i try adding reobfJar.dependsOn shadowJar  Could not get unknown property 'reobfJar' for object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler. my gradle file plugins { id 'eclipse' id 'idea' id 'maven-publish' id 'net.minecraftforge.gradle' version '[6.0,6.2)' id 'com.github.johnrengelman.shadow' version '7.1.2' id 'org.spongepowered.mixin' version '0.7.+' } apply plugin: 'net.minecraftforge.gradle' apply plugin: 'org.spongepowered.mixin' apply plugin: 'com.github.johnrengelman.shadow' version = mod_version group = mod_group_id base { archivesName = mod_id } // Mojang ships Java 17 to end users in 1.18+, so your mod should target Java 17. java.toolchain.languageVersion = JavaLanguageVersion.of(17) //jarJar.enable() println "Java: ${System.getProperty 'java.version'}, JVM: ${System.getProperty 'java.vm.version'} (${System.getProperty 'java.vendor'}), Arch: ${System.getProperty 'os.arch'}" minecraft { mappings channel: mapping_channel, version: mapping_version copyIdeResources = true runs { configureEach { workingDirectory project.file('run') property 'forge.logging.markers', 'REGISTRIES' property 'forge.logging.console.level', 'debug' arg "-mixin.config=derp.mixin.json" mods { "${mod_id}" { source sourceSets.main } } } client { // Comma-separated list of namespaces to load gametests from. Empty = all namespaces. property 'forge.enabledGameTestNamespaces', mod_id } server { property 'forge.enabledGameTestNamespaces', mod_id args '--nogui' } gameTestServer { property 'forge.enabledGameTestNamespaces', mod_id } data { workingDirectory project.file('run-data') args '--mod', mod_id, '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/') } } } sourceSets.main.resources { srcDir 'src/generated/resources' } repositories { flatDir { dirs './libs' } maven { url = "https://jitpack.io" } } configurations { shade implementation.extendsFrom shade } dependencies { minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}" implementation 'org.luaj:luaj-jse-3.0.2' implementation fg.deobf("com.github.Virtuoel:Pehkui:${pehkui_version}") annotationProcessor 'org.spongepowered:mixin:0.8.5:processor' minecraftLibrary 'luaj:luaj-jse:3.0.2' shade 'luaj:luaj-jse:3.0.2' } // Example for how to get properties into the manifest for reading at runtime. tasks.named('jar', Jar).configure { manifest { attributes([ 'Specification-Title' : mod_id, 'Specification-Vendor' : mod_authors, 'Specification-Version' : '1', // We are version 1 of ourselves 'Implementation-Title' : project.name, 'Implementation-Version' : project.jar.archiveVersion, 'Implementation-Vendor' : mod_authors, 'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"), "TweakClass" : "org.spongepowered.asm.launch.MixinTweaker", "TweakOrder" : 0, "MixinConfigs" : "derp.mixin.json" ]) } rename 'mixin.refmap.json', 'derp.mixin-refmap.json' } shadowJar { archiveClassifier = '' configurations = [project.configurations.shade] finalizedBy 'reobfShadowJar' } assemble.dependsOn shadowJar reobf { re shadowJar {} } publishing { publications { mavenJava(MavenPublication) { artifact jar } } repositories { maven { url "file://${project.projectDir}/mcmodsrepo" } } }  
    • All versions of Minecraft Forge suddenly black screen even without mods (tried reinstalling original Minecraft, Java, updating drivers doesn't work)
    • When i join minecraft all ok, when i join world all working fine, but when i open indentity menu, i get this The game crashed whilst unexpected error Error: java.lang.NullPointerException: Cannot invoke "top.ribs.scguns.common.Gun$Projectile.getDamage()" because "this.projectile" is null crash report here https://paste.ee/p/0vKaf
  • Topics

×
×
  • Create New...

Important Information

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