German 1.4.7 Modding Tutorials: Custom Block Textures

In diesem Tutorial werde ich euch zeigen, wie ihr eure eigene Textur auf euren Block befördert. Um das zu schaffen, musst du in zwei Dateien etwas ändern. Die erste ist "ClientProxy", die zweite das Blockfile.
Ich fange mit diesen Dateien an:

ClientProxy

package tutorial;

public class ClientProxyTutorial extends CommonProxyTutorial
{
 @Override
 public void registerRenderThings()
 {
 
 }
}

Block

package tutorial;

import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;

public class BlockTutorialBlock extends Block
{
 public BlockTutorialBlock(int id, int texture)
 {
  super(id, texture, Material.cloth);
  this.setCreativeTab(CreativeTabs.tabBlock);
 }
}

Das erste, was du machen musst, ist ein 256 mal 256 großes Bild erstellen. Ich empfehle GIMP. Am besten benutzt man für Blöcke die folgende Datei:
Das ist ein einfaches Gitter aus 16 mal 16 Pixel großen Blöcken.
Das Quadrat oben links ist Index 0, das rechts daneben 1, …
Als nächstes speichern wir die Datei. Ich nenne sie tutorialblocks.png.

Wenn du das Bild fertig gemacht hast, bewege es irgendwo hin, wo Eclipse es finden kann, wenn es Minecraft startet. Ein guter Ort ist im Mop ordner/jars/bin und dann per 7zip oder ähnliche in die minecraft.jar.
Jetzt müssen wir noch eine Zeile in die "ClientProxy"-Datei packen:

MinecraftForgeClient.preloadTexture("/tutorialblocks.png");

Wenn du deine Texturen in einen Unterordner (z.B. "tutorialmod") tun wills, musst du es so machen:

MinecraftForgeClient.preloadTexture("/tutorialmod/tutorialblocks.png");

Ich werde dass jetzt fürs Tutorial nicht machen, es ist aber grundsätzlich keine schlechte Idee.
ClientProxy sollte jetzt so aussehen:

package tutorial;

import net.minecraftforge.client.MinecraftForgeClient;

public class ClientProxyTutorial extends CommonProxyTutorial
{
 @Override
 public void registerRenderThings()
 {
  MinecraftForgeClient.preloadTexture("/tutorialblocks.png");
 }
}

Wenn du das fertig hast, musst du zu jedem einzelnen Block, der eine Textur aus deinem Texturenspritesheet braucht, folgende Methode hinzufügen:

public String getTextureFile()
    {
            return "/tutorialblocks.png";
    }

Das ganze gibt einfach das Spritesheet, zurück, aus dem die Texturen geladen werden.

Das Blockfile sollte jetzt ungefähr so aussehen:

package tutorial;

import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;

public class BlockTutorialBlock extends Block
{
 public BlockTutorialBlock(int id, int texture)
 {
  super(id, texture, Material.cloth);
  this.setCreativeTab(CreativeTabs.tabBlock);
 }

 public String getTextureFile()
    {
            return "/tutorialblocks.png";
    }
}

Download vom Block- und Proxyfile




1 opmerking:

  1. ROBLOX is driven by an ever growing player base of over 300,000 creators who generate an infinite variety of highly immersive experiences.

    These experiences range from 3D games and competitions, to interactive adventures where friends can take on new avatars to imagine what it would be like to be a dinosaur, a miner working a mine or an astronaut on a space exploration.

    BeantwoordenVerwijderen