
Herzlich Willkommen ihm Minecraft ModLoader Tutorial auf Elitepvpers.
Hallo liebe Elitepvp Community ich möchte euch mal danken das sich so viele Leute für das Thema Minecraft Modding Interessieren. Ich möchte euch mal ein Paar Grundlagen vermitteln ihm Thema Modding.
Ihn den Folgenden Schritten will ich euch mal Erklären wie ihr eigene Blöcke erstellt bis hin zu eigenen Biomen und Mobs.


Vorwort: Die Installation ist eigentlich zimlich simpel an sich. Allerdings ist darauf zu achten das wenn wir was mit Java machen muss dann für die Bit-Betriebssystem art Gewält werden d.H wenn du zum Beispiel Windows 7 32-Bit Installiert hast brauchst du auch die 32 Bit Version von Java. Bei 64-Bit natürlich auch die 64-Bit Java Version. Eine Installation bei Mac OS X kommt auch bald genau so wie die Art wie man das auf einen Linux betriebssystem macht, wenn ich weis wie es geht

-----------------------------
Den Punkt Installation würde ich einen Schwierigkeitsgrad: Mittel geben
-----------------------------
Was wir alles Benötigen:
Programm | Download |
---|---|
Java SDK 32 Bit | ![]() |
Java SDK 64 Bit | ![]() |
Eclipse 32 Bit | ![]() |
Minecraft* | ![]() |
ModLoader | ![]() |
Minecraft Coder Pack | ![]() |
Das Wären dan alle Downloads die Benötigt werden
---Schritt 1---
Sobald wir das Java SDK Kit heruntergeladen und installiert haben können wir weiter machen. Das Java SDK beinhaltet einmal die Java Laufzeitumgebeung und einmal den Compiler und den Debugger die Sind wichtig. Da wir sonst nicht Minecraft modden Können

---Schritt 2---
Wir drücken den Start Knopf und geben bei Suche Systemumgebung ein
Danach sollte ein solches Fenster aufgehen

Wir drücken auf Umgebungsvariablen.

Und nun geht so ein Fenster auf

Weiter unten ist ein List Feld dort suchen wir nach PATH

Wir drücken nun auf bearbeiten

Nun erscheint dort ein Fenster das so ausschaut.

Wir geben rechts neben Wert der Variable hinter dem letzten buchstaben oder zahl ein semicolon (;) ein. Wir lassen alle Fenster offen.
---Schritt 3---
Ich hoffe ihr habt die Fenster noch nicht geschlossen
Wir gehen nun ihn den Ordner wohin wir das Java SDK installiert haben.
Bei mir liegt es unter C:\Programme\Java. Wenn ihr ihm java Ordner seid gehen wir zuerst ihn den Ordner jdk1.7.x (x kann variieren das ist nur ein platzhalter für die versions nummer) und dort dan in den bin Ordner. Ich bin jetzt bei mir ihn C:\Program Files\Java\jdk1.7.0_02\bin

Jetzt klicken wir dorthin wo bei mir der rote rahmen ist. Nun können wir den Text aus dem Input Feld kopieren wichtig ist das ihr ihm bin Ordner seid. Wenn ihr das Kopiert habt geht wieder in dieses Fenster

Jetzt seitzen wir den Kopierten link dort ein. Und machen am Schluss noch einmal ein ; wen wir das haben FENSTER OFFEN LASSEN nun machen wir das selbe mit dem jre7 der sich ihm selben ordner bfindet wie das jdk wieder ihn den bin Ordner nur dieses mal sied mein link so aus C:/Programme/Java/jre7/bin das fügen wir wieder hinter den letzten ; ein bei mir sieht das nun so aus
Code:
C:\Program Files\NVIDIA Corporation\PhysX\Common;C:\Program Files\Common Files\Microsoft Shared\Windows Live;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files\Windows Live\Shared;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files\QuickTime\QTSystem\;C:\Program Files\Java\jdk1.7.0_02\bin;C:\Program Files\Java\jre7\bin
Nun können wir das mit ok schließen genau so wie alle anderen Fenster auch.
---Schritt 4---
Nun drücken wir mal die Windows taste + R und geben ihn dem neuen fenster %appdata% ein nun solltet ihr einen .Minecraft Ordner sehen. ihr löscht diesen oder nennt ihn um das ist ganz wichtig. Nun haben wir uns ja das Minecraft Coder Pack Heruntergeladen dies müssen wir nun entpacken. Den entpackten Ordner mit dem Minecraft Coder Pack nennen wir nun wie wir wollen. Ich habe den Ordner mcp genannt. Nun sehen wir ein Paar Ordner und Datein hier mal ein Paar Beschreibungen.
Name | Datei Endung | Beschreibung |
---|---|---|
conf | Ordner | Hier sind die ganzen Informationen für das MCP drin hier nichts ändern |
docs | Ordner | Enthält Hilfe Dateien |
eclipse | Ordner | Wird jetzt Dan wichtig für die Eclipse Installation |
jars | Ordner | Hier kommt der bin/Ressources Ordner von Minecraft rein |
runtime | Ordner | Wieder ein Java Ordner aber für uns egal |
CHANGELOG | Datei | Letzte änderungen vom MCP |
cleanup | .bat/.sh | Zum löschen von Minecraft source |
decompile | .bat/.sh | Hiermit zerlegt man die minecraft.jar und wandelt die verschlüsselten .class datein um ihn.java |
getchangedsrc | .bat/.src | Hier kann man die geänderten Minecraft.java Dateien aus den src Ordner exportieren |
recompile | .bat/src | Ist genau das gegenteil von Decompilen hierbei werden die .java Dateien verschlüsselt und ihn .class Dateien umgewandelt. |
reformat | .bat/.src | Fällt mir gerade nicht ein hab ich noch nie benötigt |
reobfuscate | .bat/.src | Hiermit kann man seinen mod fertigstellen davor muss man allerdings recompilen |
startclient | .bat/.src | Hiermit kann man Minecraft zum testen mit seinen Mod starten |
startserver | .bat/.src | Hiermit kann man seinen Server mit seinen Server Mod starten werden wir allerdings nicht brauchen |
updatemcp | .bat/.src | Hiermit kann man das Minecraft Coder pack Updaten lassen |
updatemd5 | .bat/.src | KA |
updatenames | .bat/.src | Hiermit kann man die minecraft.java Datein aktualisieren |
So das war Dan alles also sobald Minecraft den .minecraft Ordner ersetzt hat gehen wir ihn den .Minecraft Ordner und Kopieren uns den bin und den resources Ordner und fügen sie ihm mcp Ordner ihn dem Jars Ordner ein. Öffnen wir die Minecraft.jar aus dem bin ordner und den ModLoader den wir uns Runtergeladen haben nun löschen wir als erstes den META-INF Ordner und ziehen anschließend alle Dateien aus dem Modloader Ordner ihn die nun Minecraft.jar schließen wir wieder alles und drücken Decompile das sich ihm mcp Ordner befindet. Nun bekommen wir einen Error
Code:
== ERRORS FOUND == 1 out of 1 hunk FAILED -- saving rejects to file 'net\minecraft\src\RenderBlocks .#' ==================
---Schritt 5--- Wir starten eclipse und wählen ihm mcp ordner den Ordner "Eclipse" aus sobald er uns nach einer Webspace frägt.
Wenn wir nun bestätigen sehen wir folgendes bild

Hier ist dan auch noch ein Server ordner den können wir löschen und fertig sind wir mit der Installation.
------------------------------------------------------------------------


Vorwort: Jetzt geht es an das eingemachte wir Modden Minecraft

Block Standart (Ohne Welt Generation)
Als erstes erstellen wir ihn eclipse eine neue classe wie machen wir das. Das ist ganz einfach ihr drückt einfach nur auf das rot eingerahmte icon
Dan gebt ihr unter Name einfach einen Namen ein dieser name muss ein mod_ enthalten da das unsere erste Datei ist ich habe sie deshalb mal mod_name genannt. Weis ziemlich Einfalls los aber egal. Mit einen klick auf ok wird diese neue Datei erstellt und geöffnet.
Nun fügen wir diesen Text hinzu
----
public class mod_name extends BaseMod = Gibt uns auskunft das wir uns ihn der datei mod_name befinden und die infos aus BaseMod laden.
public static final Block TestErz; = Das heiß das auf unseren block von überall zugegriffen werden kann.
----
TestErz = new Block(ID, Txture, Material)
TestErz = Block Name für eclipse/Minecraft
Block= Es handelt sich um einen Block wer hätte das gedacht
ID= Steht weiter oben was das ist
Texture= Nicht für uns wichtig da unser Block e eine neue Texture bekommt.
Material = Ist für uns wichtig damit drücken wir z.b aus das es Material.rock ist also kann man es nicht mit der hand abbauen.
.setHardness(0.5F) = Setzt die härte für den Block oben stet ihn der Tabelle etwas über Komma zahlen.
.setLightValue(0.5F)= Setzt das licht der unser Block ausstrahlt. 2F ist das höchste
.setBlockName("Block Tutorial") = Block Tutorial ist nur eine Kleine Orientierung für uns.
----
ModLoader.AddName(TestErz, "Rubin Erz")= hier fügt Modloader den namen Ingame für den Block Test Erz hinzu. Der Name wäre Dan Rubin Erz
ModLoader.RegisterBlock(TestErz) = !!!!Das ist sehr wichtig ihr sag minecraft das das ein neuer Block ist und registriert ihn dadurch. Ihne diesen Code geht Minecraft nicht mehr!!!
TestErz.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/tutorial/block/rubin_erz.png");= Hier wird ein bild ihn Minecraft Inpotiert um genau zu sein ihn die terrain.png Das bild muss ihm Ordner mcp/eclipse/client/bin/tutorial/block das bild muss rubin_erz.png heißen

Dan gebt ihr unter Name einfach einen Namen ein dieser name muss ein mod_ enthalten da das unsere erste Datei ist ich habe sie deshalb mal mod_name genannt. Weis ziemlich Einfalls los aber egal. Mit einen klick auf ok wird diese neue Datei erstellt und geöffnet.
Nun fügen wir diesen Text hinzu
Code:
package net.minecraft.src; public class mod_name extends BaseMod{ public static final Block TestErz; static{ //Block TestErz = new Block(220, 0, Material.rock).setHardness(0.5F).setLightValue(0.5F).setBlockName("Block Tutorial"); //Register ModLoader.registerBlock(TestErz); //Name ModLoader.addName(TestErz, "Rubin Erz"); //Textur TestErz.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/tutorial/block/rubin_erz.png"); } public String getVersion() {return "Minecraft Tutorial Mod";} public void load() {} }
Code | Beschreibung |
---|---|
extends | Steht für das inpotieren von Informationen aus einer Datei ihn diesen fall aus der BaseMod Datei |
// | Sind für das Kommentieren text stellen aus dem Code alles hinter // wird grün hinterlegt und nicht mit gewertet |
ID | Darf immer ein einziges mal zu vergeben d.H ihr dürft nicht z.B zwei Blöcken die Selbe id geben min ID = 389 max ID = 225 |
0.X | Um Komma zahlen zu machen ist es wichtig das man nicht einfach 0,1 schreibt oder 0.1 sondern man muss 0.1F schreiben |
----
public class mod_name extends BaseMod = Gibt uns auskunft das wir uns ihn der datei mod_name befinden und die infos aus BaseMod laden.
public static final Block TestErz; = Das heiß das auf unseren block von überall zugegriffen werden kann.
----
TestErz = new Block(ID, Txture, Material)
TestErz = Block Name für eclipse/Minecraft
Block= Es handelt sich um einen Block wer hätte das gedacht

ID= Steht weiter oben was das ist
Texture= Nicht für uns wichtig da unser Block e eine neue Texture bekommt.
Material = Ist für uns wichtig damit drücken wir z.b aus das es Material.rock ist also kann man es nicht mit der hand abbauen.
.setHardness(0.5F) = Setzt die härte für den Block oben stet ihn der Tabelle etwas über Komma zahlen.
.setLightValue(0.5F)= Setzt das licht der unser Block ausstrahlt. 2F ist das höchste
.setBlockName("Block Tutorial") = Block Tutorial ist nur eine Kleine Orientierung für uns.
----
ModLoader.AddName(TestErz, "Rubin Erz")= hier fügt Modloader den namen Ingame für den Block Test Erz hinzu. Der Name wäre Dan Rubin Erz
ModLoader.RegisterBlock(TestErz) = !!!!Das ist sehr wichtig ihr sag minecraft das das ein neuer Block ist und registriert ihn dadurch. Ihne diesen Code geht Minecraft nicht mehr!!!
TestErz.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/tutorial/block/rubin_erz.png");= Hier wird ein bild ihn Minecraft Inpotiert um genau zu sein ihn die terrain.png Das bild muss ihm Ordner mcp/eclipse/client/bin/tutorial/block das bild muss rubin_erz.png heißen
Mit Welt Generation
Die Welt Generation dient Ausschließlich das Ein Block ihn der Welt gefunden werden kann.
Der Code Fällt auch relativ gering aus. Der Code Muss wieder ihn eure erstellte Hauptdatei.
Er sieht ihm Grunde so aus:
Code:
public void generateSurface(World world, Random rand, int chunkX, int chunkZ) { for(int i = 0; i < (Seltenheitswert); i++) { int randPosX = chunkX + rand.nextInt(16); int randPosY = rand.nextInt(Höhe); int randPosZ = chunkZ + rand.nextInt(16); (new WorldGenMinable(Deinblock.blockID, Rate)).generate(world, rand, randPosX, randPosY, randPosZ); } }
Rate = Das ist die Angabe wie oft er nebeneinander generiert wird.
Höhe = Hier kommen wir auf ein sehr schweres Problem. Und zwar können wir ja sagen das unser Block nur auf die höhe des Diamanten generiert werden soll also glaub ich wäre dan die höhe 16. Oder wir sagen es soll über die gesamte Höhe generiert werden. wenn wir das wollen könnten wir eben 512 eingeben. Oder wir wenden einen Trick an und geben statt einer zahl einfach world.getHeight() ein. So wird zuerst die welt höhe ermittelt und anschließend der Block über die gesamte höhe Erstellt.

Hier mal ein Code Von mir.
Code:
public void generateSurface(World world, Random rand, int chunkX, int chunkZ){ for(int i = 0; i < (13); i++) { int randPosX = chunkX + rand.nextInt(16); int randPosY = rand.nextInt(world.getHeight()); int randPosZ = chunkZ + rand.nextInt(16); (new WorldGenMinable(TestErz.blockID, 16)).generate(world, rand, randPosX, randPosY, randPosZ); } }


So sieht nun mein Quell Code aus
Code:
package net.minecraft.src; public class mod_name extends BaseMod{ public static final Block TestErz; static{ //Block TestErz = new Block(220, 0, Material.rock).setHardness(0.5F).setBlockName("Block Tutorial"); //Register ModLoader.registerBlock(TestErz); //Name ModLoader.addName(TestErz, "Rubin Erz"); //Textur TestErz.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/tutorial/block/rubin_erz.png"); } public void generateSurface(World world, Random rand, int chunkX, int chunkZ) { for(int i = 0; i < (13); i++) { int randPosX = chunkX + rand.nextInt(16); int randPosY = rand.nextInt(world.getHeight()); int randPosZ = chunkZ + rand.nextInt(16); (new WorldGenMinable(TestErz.blockID, 16)).generate(world, rand, randPosX, randPosY, randPosZ); } } public String getVersion() {return "Minecraft Tutorial Mod";} public void load() {} }
Mit Nether Generation
So nun greifen wir die Nether Generierung an ihm Grunde ist es das Selbe wie gerade auch nur einen kleinen Unterschied.
Wir suchen die Datei WorldGenMinable. Wir kopieren diese mit Rechtsklick und fügen sie wieder ein. Dan müssen wir sie umbenennen. Ich habe sie mal WorldGenNether genannt. Nun suchen wir ihn der Datei nach:
Code:
Block.stone.blockID
Code:
Block.netherrack.blockID
Code:
package net.minecraft.src; import java.util.Random; public class WorldGenNether extends WorldGenerator{ /** The block ID of the ore to be placed using this generator. */ private int minableBlockId; /** The number of blocks to generate. */ private int numberOfBlocks; public WorldGenNether(int par1, int par2) { minableBlockId = par1; numberOfBlocks = par2; } public boolean generate(World par1World, Random par2Random, int par3, int par4, int par5) { float f = par2Random.nextFloat() * (float)Math.PI; double d = (float)(par3 + 8) + (MathHelper.sin(f) * (float)numberOfBlocks) / 8F; double d1 = (float)(par3 + 8) - (MathHelper.sin(f) * (float)numberOfBlocks) / 8F; double d2 = (float)(par5 + 8) + (MathHelper.cos(f) * (float)numberOfBlocks) / 8F; double d3 = (float)(par5 + 8) - (MathHelper.cos(f) * (float)numberOfBlocks) / 8F; double d4 = (par4 + par2Random.nextInt(3)) - 2; double d5 = (par4 + par2Random.nextInt(3)) - 2; for (int i = 0; i <= numberOfBlocks; i++) { double d6 = d + ((d1 - d) * (double)i) / (double)numberOfBlocks; double d7 = d4 + ((d5 - d4) * (double)i) / (double)numberOfBlocks; double d8 = d2 + ((d3 - d2) * (double)i) / (double)numberOfBlocks; double d9 = (par2Random.nextDouble() * (double)numberOfBlocks) / 16D; double d10 = (double)(MathHelper.sin(((float)i * (float)Math.PI) / (float)numberOfBlocks) + 1.0F) * d9 + 1.0D; double d11 = (double)(MathHelper.sin(((float)i * (float)Math.PI) / (float)numberOfBlocks) + 1.0F) * d9 + 1.0D; int j = MathHelper.floor_double(d6 - d10 / 2D); int k = MathHelper.floor_double(d7 - d11 / 2D); int l = MathHelper.floor_double(d8 - d10 / 2D); int i1 = MathHelper.floor_double(d6 + d10 / 2D); int j1 = MathHelper.floor_double(d7 + d11 / 2D); int k1 = MathHelper.floor_double(d8 + d10 / 2D); for (int l1 = j; l1 <= i1; l1++) { double d12 = (((double)l1 + 0.5D) - d6) / (d10 / 2D); if (d12 * d12 >= 1.0D) { continue; } for (int i2 = k; i2 <= j1; i2++) { double d13 = (((double)i2 + 0.5D) - d7) / (d11 / 2D); if (d12 * d12 + d13 * d13 >= 1.0D) { continue; } for (int j2 = l; j2 <= k1; j2++) { double d14 = (((double)j2 + 0.5D) - d8) / (d10 / 2D); if (d12 * d12 + d13 * d13 + d14 * d14 < 1.0D && par1World.getBlockId(l1, i2, j2) == Block.netherrack.blockID) { par1World.setBlock(l1, i2, j2, minableBlockId); } } } } } return true; } }

Code:
public void generateNether(World world, Random rand, int chunkX, int chunkZ) { for(int i = 0; i <= Seltenheitswert; i++) { int randPosX = chunkX + rand.nextInt(16); int randPosY = rand.nextInt(Höhe); int randPosZ = chunkZ + rand.nextInt(16); (new WorldGenMeinNethererz(TestBlock2.blockID, Rate)).generate(world, rand, randPosX, randPosY, randPosZ); } }
Seltenheitswert= Diese Angabe muss eine zahl sein, diese gibt an wie schnell man den block finden kann ob er nun eher selten ist oder so wie dreck einfach überall leicht zu finden ist. Ich empfehle hier den Maximal wert von 13
Rate = Das ist die Angabe wie oft er nebeneinander generiert wird.
Höhe = Hier kommen wir auf ein sehr schweres Problem. Und zwar können wir ja sagen das unser Block nur auf die höhe des Diamanten generiert werden soll also glaub ich wäre dan die höhe 16. Oder wir sagen es soll über die gesamte Höhe generiert werden. wenn wir das wollen könnten wir eben 512 eingeben. Oder wir wenden einen Trick an und geben statt einer zahl einfach world.getHeight() ein. So wird zuerst die welt höhe ermittelt und anschließend der Block über die gesamte höhe Erstellt.

Ich zeige nun mal meinen Quell Code Bis jetzt.
Code:
package net.minecraft.src; public class mod_name extends BaseMod{ public static final Block TestErz; public static final Block TestBlock2; static{ //Block TestErz = new Block(220, 0, Material.rock).setHardness(0.5F).setBlockName("Block Tutorial"); TestBlock2 = new Block(221, 0, Material.rock).setHardness(0.5F).setBlockName("Block 2 Für den Nether"); //Register ModLoader.registerBlock(TestErz); ModLoader.registerBlock(TestBlock2); //Name ModLoader.addName(TestErz, "Rubin Erz"); ModLoader.addName(TestBlock2, "Nether Erz"); //Textur TestErz.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/tutorial/block/rubin_erz.png"); TestBlock2.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/tutorial/block/nether_erz.png"); } public void generateSurface(World world, Random rand, int chunkX, int chunkZ) { for(int i = 0; i < (13); i++) { int randPosX = chunkX + rand.nextInt(16); int randPosY = rand.nextInt(world.getHeight()); int randPosZ = chunkZ + rand.nextInt(16); (new WorldGenMinable(TestErz.blockID, 16)).generate(world, rand, randPosX, randPosY, randPosZ); } } public void generateNether(World world, Random rand, int chunkX, int chunkZ) { for(int i = 0; i <= 13; i++) { int randPosX = chunkX + rand.nextInt(16); int randPosY = rand.nextInt(world.getHeight()); int randPosZ = chunkZ + rand.nextInt(16); (new WorldGenMeinNethererz(TestBlock2.blockID, 16)).generate(world, rand, randPosX, randPosY, randPosZ); } } public String getVersion() {return "Minecraft Tutorial Mod";} public void load() {} }

Mit The End Generation
So nun greifen wir die The End Generierung an ihm Grunde ist es das Selbe wie die Nether Generation.
Wir suchen die Datei WorldGenMinable. Wir kopieren diese mit Rechtsklick und fügen sie wieder ein. Dan müssen wir sie umbenennen. Ich habe sie mal WorldGenTheEnd genannt. Nun suchen wir ihn der Datei nach:
Code:
Block.stone.blockID
Code:
Block.whiteStone.blockID
Code:
package net.minecraft.src; import java.util.Random; public class WorldGenTheEnd extends WorldGenerator{ /** The block ID of the ore to be placed using this generator. */ private int minableBlockId; /** The number of blocks to generate. */ private int numberOfBlocks; public WorldGenMeinEndErz(int par1, int par2) { minableBlockId = par1; numberOfBlocks = par2; } public boolean generate(World par1World, Random par2Random, int par3, int par4, int par5) { float f = par2Random.nextFloat() * (float)Math.PI; double d = (float)(par3 + 8) + (MathHelper.sin(f) * (float)numberOfBlocks) / 8F; double d1 = (float)(par3 + 8) - (MathHelper.sin(f) * (float)numberOfBlocks) / 8F; double d2 = (float)(par5 + 8) + (MathHelper.cos(f) * (float)numberOfBlocks) / 8F; double d3 = (float)(par5 + 8) - (MathHelper.cos(f) * (float)numberOfBlocks) / 8F; double d4 = (par4 + par2Random.nextInt(3)) - 2; double d5 = (par4 + par2Random.nextInt(3)) - 2; for (int i = 0; i <= numberOfBlocks; i++) { double d6 = d + ((d1 - d) * (double)i) / (double)numberOfBlocks; double d7 = d4 + ((d5 - d4) * (double)i) / (double)numberOfBlocks; double d8 = d2 + ((d3 - d2) * (double)i) / (double)numberOfBlocks; double d9 = (par2Random.nextDouble() * (double)numberOfBlocks) / 16D; double d10 = (double)(MathHelper.sin(((float)i * (float)Math.PI) / (float)numberOfBlocks) + 1.0F) * d9 + 1.0D; double d11 = (double)(MathHelper.sin(((float)i * (float)Math.PI) / (float)numberOfBlocks) + 1.0F) * d9 + 1.0D; int j = MathHelper.floor_double(d6 - d10 / 2D); int k = MathHelper.floor_double(d7 - d11 / 2D); int l = MathHelper.floor_double(d8 - d10 / 2D); int i1 = MathHelper.floor_double(d6 + d10 / 2D); int j1 = MathHelper.floor_double(d7 + d11 / 2D); int k1 = MathHelper.floor_double(d8 + d10 / 2D); for (int l1 = j; l1 <= i1; l1++) { double d12 = (((double)l1 + 0.5D) - d6) / (d10 / 2D); if (d12 * d12 >= 1.0D) { continue; } for (int i2 = k; i2 <= j1; i2++) { double d13 = (((double)i2 + 0.5D) - d7) / (d11 / 2D); if (d12 * d12 + d13 * d13 >= 1.0D) { continue; } for (int j2 = l; j2 <= k1; j2++) { double d14 = (((double)j2 + 0.5D) - d8) / (d10 / 2D); if (d12 * d12 + d13 * d13 + d14 * d14 < 1.0D && par1World.getBlockId(l1, i2, j2) == Block.whiteStone.blockID) { par1World.setBlock(l1, i2, j2, minableBlockId); } } } } } return true; } }

Code:
public void generateSurface(World world, Random rand, int chunkX, int chunkZ){ for(int i = 0; i < (13); i++) { int randPosX = chunkX + rand.nextInt(16); int randPosY = rand.nextInt(world.getHeight()); int randPosZ = chunkZ + rand.nextInt(16); (new WorldGenTheEnd(TestBlock3.blockID, 16)).generate(world, rand, randPosX, randPosY, randPosZ); } }
Seltenheitswert= Diese Angabe muss eine zahl sein, diese gibt an wie schnell man den block finden kann ob er nun eher selten ist oder so wie dreck einfach überall leicht zu finden ist. Ich empfehle hier den Maximal wert von 13
Rate = Das ist die Angabe wie oft er nebeneinander generiert wird.
Höhe = Hier kommen wir auf ein sehr schweres Problem. Und zwar können wir ja sagen das unser Block nur auf die höhe des Diamanten generiert werden soll also glaub ich wäre dan die höhe 16. Oder wir sagen es soll über die gesamte Höhe generiert werden. wenn wir das wollen könnten wir eben 512 eingeben. Oder wir wenden einen Trick an und geben statt einer zahl einfach world.getHeight() ein. So wird zuerst die welt höhe ermittelt und anschließend der Block über die gesamte höhe Erstellt.

WorldGenTheEnd = Hier kommt unsere Welt generation wiede ins spiel
Ansonstens ist ales das selbe wie mit der Normalen Welt generation
Ich zeige nun mal meinen Quell Code Bis jetzt.
Code:
package net.minecraft.src; public class mod_name extends BaseMod{ public static final Block TestErz; public static final Block TestBlock2; public static final Block TestBlock3; static{ //Block TestErz = new Block(220, 0, Material.rock).setHardness(0.5F).setBlockName("Block Tutorial"); TestBlock2 = new Block(221, 0, Material.rock).setHardness(0.5F).setBlockName("Block 2 Für den Nether"); TestBlock3 = new Block(222, 0, Material.rock).setHardness(0.5F).setBlockName("Block 2 Für den Nether"); //Register ModLoader.registerBlock(TestErz); ModLoader.registerBlock(TestBlock2); ModLoader.registerBlock(TestBlock3); //Name ModLoader.addName(TestErz, "Rubin Erz"); ModLoader.addName(TestBlock2, "Nether Erz"); ModLoader.addName(TestBlock3, "The End Erz"); //Textur TestErz.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/tutorial/block/rubin_erz.png"); TestBlock2.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/tutorial/block/nether_erz.png"); TestBlock3.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/tutorial/block/theend_erz.png"); } public void generateSurface(World world, Random rand, int chunkX, int chunkZ) { for(int i = 0; i < (13); i++) { int randPosX = chunkX + rand.nextInt(16); int randPosY = rand.nextInt(world.getHeight()); int randPosZ = chunkZ + rand.nextInt(16); (new WorldGenMinable(TestBlock3.blockID, 16)).generate(world, rand, randPosX, randPosY, randPosZ); } //Hier ist der The End Code for(int i = 0; i < (13); i++) { int randPosX = chunkX + rand.nextInt(16); int randPosY = rand.nextInt(world.getHeight()); int randPosZ = chunkZ + rand.nextInt(16); (new WorldGenTheEnd(BlockTutorial3.blockID, 16)).generate(world, rand, randPosX, randPosY, randPosZ); } } public void generateNether(World world, Random rand, int chunkX, int chunkZ) { for(int i = 0; i <= 13; i++) { int randPosX = chunkX + rand.nextInt(16); int randPosY = rand.nextInt(world.getHeight()); int randPosZ = chunkZ + rand.nextInt(16); (new WorldGenMeinNethererz(TestBlock2.blockID, 16)).generate(world, rand, randPosX, randPosY, randPosZ); } } public String getVersion() {return "Minecraft Tutorial Mod";} public void load() {} }

Blume Erstellen und generieren lassen.
Wir erstellen wieder einen Neuen block nur schreiben wir dieses mal statt:
Einfach mal
new BlockFlower = Das Heist das auf die Datei BlockFlower zugegriffen wird. Das ist einfach eine Neue Blume.
Warum das ModLoader.addOverride("/terrain.png", "/Block/Blume.png") gleich beim erstellen eines neuen Blocks Mit drin steckt hat folgenden Grund. Wenn die Blume generiert wird Schaut noch alles Gut aus. Sammelt man sie allerdings auf hat sie eine Andere Textur. Dadurch wird das vermieden.
Hier mal der Code zum Generieren
Ihr solltet nun schon etwa über die Kenntnisse Besitzen diesen Code zu entschlüsseln Hoffe ich einfach mal. 
Meine Datei schaut nun so aus
Hier mal ein Bild
Code:
Blume = new Block(223, 0, Material.rock)).setBlockName("Block Blume").setHardness(0.0F);
Code:
Blume = new BlockFlower(223, ModLoader.addOverride("/terrain.png", "tutorial/block/Blume.png")).setBlockName("Block Blume").setHardness(0.0F);
Warum das ModLoader.addOverride("/terrain.png", "/Block/Blume.png") gleich beim erstellen eines neuen Blocks Mit drin steckt hat folgenden Grund. Wenn die Blume generiert wird Schaut noch alles Gut aus. Sammelt man sie allerdings auf hat sie eine Andere Textur. Dadurch wird das vermieden.
Hier mal der Code zum Generieren
Code:
public void generateSurface(World world, Random rand, int chunkX, int chunkZ){ for(int i = 0; i <= 50; i++) { int randPosX = chunkX + rand.nextInt(16); int randPosY = rand.nextInt(256); int randPosZ = chunkZ + rand.nextInt(16); if(world.getBlockId(randPosX, randPosY, randPosZ) == Block.grass.blockID) { (new WorldGenFlowers(Blume.blockID)).generate(world, rand, randPosX, randPosY, randPosZ); } } }

Meine Datei schaut nun so aus
Code:
package net.minecraft.src; public class mod_name extends BaseMod{ public static final Block TestErz; public static final Block TestBlock2; public static final Block TestBlock3; public static final Block Blume; static{ //Block TestErz = new Block(220, 0, Material.rock).setHardness(0.5F).setBlockName("Block Tutorial"); TestBlock2 = new Block(221, 0, Material.rock).setHardness(0.5F).setBlockName("Block 2 Für den Nether"); TestBlock3 = new Block(222, 0, Material.rock).setHardness(0.5F).setBlockName("Block 2 Für den Nether"); Blume = new Block(223, ModLoader.addOverride("/terrain.png", "/tutorial/block/Blume.png")).setBlockName("Block Blume").setHardness(0.0F); //Register ModLoader.registerBlock(TestErz); ModLoader.registerBlock(TestBlock2); ModLoader.registerBlock(TestBlock3); ModLoader.registerBlock(Blume); //Name ModLoader.addName(TestErz, "Rubin Erz"); ModLoader.addName(TestBlock2, "Nether Erz"); ModLoader.addName(TestBlock3, "The End Erz"); ModLoader.addName(Blume, "Blaue Blume"); //Textur TestErz.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/tutorial/block/rubin_erz.png"); TestBlock2.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/tutorial/block/nether_erz.png"); TestBlock3.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/tutorial/block/theend_erz.png"); } public void generateSurface(World world, Random rand, int chunkX, int chunkZ) { for(int i = 0; i < (13); i++) { int randPosX = chunkX + rand.nextInt(16); int randPosY = rand.nextInt(world.getHeight()); int randPosZ = chunkZ + rand.nextInt(16); (new WorldGenMinable(TestErz.blockID, 16)).generate(world, rand, randPosX, randPosY, randPosZ); } for(int i = 0; i < (13); i++) { int randPosX = chunkX + rand.nextInt(16); int randPosY = rand.nextInt(world.getHeight()); int randPosZ = chunkZ + rand.nextInt(16); (new WorldGenTheEnd(TestBlock2.blockID, 16)).generate(world, rand, randPosX, randPosY, randPosZ); } for(int i = 0; i <= 50; i++) { int randPosX = chunkX + rand.nextInt(16); int randPosY = rand.nextInt(256); int randPosZ = chunkZ + rand.nextInt(16); if(world.getBlockId(randPosX, randPosY, randPosZ) == Block.grass.blockID) { (new WorldGenFlowers(Blume.blockID)).generate(world, rand, randPosX, randPosY, randPosZ); } } public void generateNether(World world, Random rand, int chunkX, int chunkZ) { for(int i = 0; i <= 13; i++) { int randPosX = chunkX + rand.nextInt(16); int randPosY = rand.nextInt(world.getHeight()); int randPosZ = chunkZ + rand.nextInt(16); (new WorldGenMeinNethererz(TestBlock2.blockID, 16)).generate(world, rand, randPosX, randPosY, randPosZ); } } public String getVersion() {return "Minecraft Tutorial Mod";} public void load() {} }

Einen Pilz Generieren Lassen
Wir machen es genau so wie bei der Blume nur das es dieses mal statt:
So heist
Und der Welt Code zum Generieren so ausschaut:
Wieder Solltet ihr wissen wie man den Code zum Generiere umschreiben muss.
Hier mal mein Code zur Orientierung
Code:
Pilz = new Block(229, 0).setBlockName("Block Pilz").setHardness(0.0F);
Code:
Pilz = new BlockMushroom(229, ModLoader.addOverride("/terrain.png", "/tutorial/block/pilz.png")).setBlockName("Block Pilz").setHardness(0.0F);
Code:
for(int i = 0; i <= 50; i++) { int randPosX = chunkX + rand.nextInt(16); int randPosY = rand.nextInt(256); int randPosZ = chunkZ + rand.nextInt(16); if(world.getBlockId(randPosX, randPosY, randPosZ) == Block.grass.blockID) { (new WorldGenFlowers(Pilz.blockID)).generate(world, rand, randPosX, randPosY, randPosZ); } }
Hier mal mein Code zur Orientierung
Code:
package net.minecraft.src; public class mod_name extends BaseMod{ public static final Block TestErz; public static final Block TestBlock2; public static final Block TestBlock3; public static final Block Blume; public static final Block Pilz; static{ //Block TestErz = new Block(220, 0, Material.rock).setHardness(0.5F).setBlockName("Block Tutorial"); TestBlock2 = new Block(221, 0, Material.rock).setHardness(0.5F).setBlockName("Block 2 Für den Nether"); TestBlock3 = new Block(222, 0, Material.rock).setHardness(0.5F).setBlockName("Block 2 Für den Nether"); Blume = new Block(223, ModLoader.addOverride("/terrain.png", "/tutorial/block/Blume.png")).setBlockName("Block Blume").setHardness(0.0F); Pilz = new BlockMushroomNew(229, ModLoader.addOverride("/terrain.png", "/tutorial/Block/Pilz.png")).setBlockName("Block Pilz").setHardness(0.0F); //Register ModLoader.registerBlock(TestErz); ModLoader.registerBlock(TestBlock2); ModLoader.registerBlock(TestBlock3); ModLoader.registerBlock(Blume); ModLoader.registerBlock(Pilz); //Name ModLoader.addName(TestErz, "Rubin Erz"); ModLoader.addName(TestBlock2, "Nether Erz"); ModLoader.addName(TestBlock3, "The End Erz"); ModLoader.addName(Blume, "Blaue Blume"); ModLoader.addName(Pilz, "Neuer Pilz"); //Textur TestErz.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/tutorial/block/rubin_erz.png"); TestBlock2.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/tutorial/block/nether_erz.png"); TestBlock3.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/tutorial/block/theend_erz.png"); } public void generateSurface(World world, Random rand, int chunkX, int chunkZ) { for(int i = 0; i < (13); i++) { int randPosX = chunkX + rand.nextInt(16); int randPosY = rand.nextInt(world.getHeight()); int randPosZ = chunkZ + rand.nextInt(16); (new WorldGenMinable(TestErz.blockID, 16)).generate(world, rand, randPosX, randPosY, randPosZ); } for(int i = 0; i < (13); i++) { int randPosX = chunkX + rand.nextInt(16); int randPosY = rand.nextInt(world.getHeight()); int randPosZ = chunkZ + rand.nextInt(16); (new WorldGenTheEnd(TestBlock2.blockID, 16)).generate(world, rand, randPosX, randPosY, randPosZ); } for(int i = 0; i <= 50; i++) { int randPosX = chunkX + rand.nextInt(16); int randPosY = rand.nextInt(256); int randPosZ = chunkZ + rand.nextInt(16); if(world.getBlockId(randPosX, randPosY, randPosZ) == Block.grass.blockID) { (new WorldGenFlowers(Blume.blockID)).generate(world, rand, randPosX, randPosY, randPosZ); } for(int i = 0; i <= 50; i++) { int randPosX = chunkX + rand.nextInt(16); int randPosY = rand.nextInt(256); int randPosZ = chunkZ + rand.nextInt(16); if(world.getBlockId(randPosX, randPosY, randPosZ) == Block.grass.blockID) { (new WorldGenFlowers(Pilz.blockID)).generate(world, rand, randPosX, randPosY, randPosZ); } } public void generateNether(World world, Random rand, int chunkX, int chunkZ) { for(int i = 0; i <= 13; i++) { int randPosX = chunkX + rand.nextInt(16); int randPosY = rand.nextInt(world.getHeight()); int randPosZ = chunkZ + rand.nextInt(16); (new WorldGenMeinNethererz(TestBlock2.blockID, 16)).generate(world, rand, randPosX, randPosY, randPosZ); } } public String getVersion() {return "Minecraft Tutorial Mod";} public void load() {} }

------------------------------------------------------------------------


Was kann man unter Block Erweitert generell verstehen.
Man Versteht das man Einen Neuen Block Erstellen kann der z.B die Selben Eigenschaften haben Kann wie ein glas Block
Glas Block Erstellen
Um einen neuen Glass Block zu erstellen können wir nicht einfach so wie immer. So erstellen.
Und diesen einfach die Glas Textur zuweisen. Das geht so nicht sondern wir geben stattdessen folgendes ein
So wir erstellen wieder eine neue Class datei mit dem namen GlasBlock ihn der sollte dan folgendes stehen.
Sagt das der Block kein normaler Block ist
Das fixt einfach den Bug das man ihn das Welt innere schauen kann.
Nun so sollte ihn etwa dann die Hauptdatei ausschauen.
Und das ist mein Ergebnis
Code:
Glas = new Block(220, 0, Material.glass).setBlockName("Block Normal").setHardness(0.4F);
Code:
Glas = new GlasBlock(220, 0, Material.glass).setBlockName("Block Normal").setHardness(0.4F);
Code:
package net.minecraft.src; import java.util.Random; public class GlasBlock extends Block{ protected GlasBlock(int par1, int par2, Material par3Material) { super(par1, par2, par3Material); } public boolean renderAsNormalBlock() { return false; } public boolean isOpaqueCube() { return false; } public int quantityDropped(Random par1Random) { return 0; } }
Code:
public boolean renderAsNormalBlock() { return false; }
Code:
public boolean isOpaqueCube() { return false; }
Nun so sollte ihn etwa dann die Hauptdatei ausschauen.
Code:
package net.minecraft.src; public class mod_name extends BaseMod{ public static final Block Glass; static{ //Block Glass = new GlasBlock(220, 0, Material.glass).setHardness(0.5F).setBlockName("Block Tutorial"); //Register ModLoader.registerBlock(Glass); //Name ModLoader.addName(Glass, "Rotes Glass"); //Textur Glass.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/tutorial/block/glass.png"); } public String getVersion() {return "Minecraft Tutorial Mod";} public void load() {} }

------------------------------------------------------------------------


Wir erstellen uns nun unser eigenes Dorf Ohne Dorf Bewohner noch, außerdem ohne Biome Generierung. Kommt später noch.
Benötigte Addons
Beschreibung | Download |
---|---|
MC Edit | ![]() |
SCHEMATIC TO JAVA | ![]() |
Als erstes gehen wir ihn unser Minecraft (Nicht mit Eclipse sondern normal Minecraft Starten)
und bauen uns eine Stadt oder ein Haus wie ihn meinen Fall. Hier mal ein paar Bilder
Wenn wir unser Gerüst haben starten wir MCEdit und
Wir drücken auf LoadWorld und wählen unsere Welt aus.
Als nächstes suchen wir unser haus und markieren dieses.
Nun entfernen wir noch unnötiges zeug wie man ihn den Bildern unterhalb sehr schön sehen kann.
Wenn unser Haus/Dorf fertig ist drücken wir auf Copy anschließend müssen wir es noch speichern. Das ist Dan eine .shamatic Datei.
Nun öffnen wir das Programm Shamatic to java. Und laden unsere erstellte .shamatic Datei diese wird dan auch sofort Umgewandelt.
Wenn dieses Fenster erscheint ist das Programm fertig.
Nun Kopieren wir aus dem Ordner wo das Programm liegt die 2 Datein. Und gehen ihn unseren Mod Ordner und Dan ihn /src/Minecraft/net/Minecraft/src und fügen sie Dort ein. Und fertig ist das NPC Dorf.



Wenn wir unser Gerüst haben starten wir MCEdit und
Wir drücken auf LoadWorld und wählen unsere Welt aus.

Als nächstes suchen wir unser haus und markieren dieses.

Nun entfernen wir noch unnötiges zeug wie man ihn den Bildern unterhalb sehr schön sehen kann.




Wenn unser Haus/Dorf fertig ist drücken wir auf Copy anschließend müssen wir es noch speichern. Das ist Dan eine .shamatic Datei.


Nun öffnen wir das Programm Shamatic to java. Und laden unsere erstellte .shamatic Datei diese wird dan auch sofort Umgewandelt.

Wenn dieses Fenster erscheint ist das Programm fertig.

Nun Kopieren wir aus dem Ordner wo das Programm liegt die 2 Datein. Und gehen ihn unseren Mod Ordner und Dan ihn /src/Minecraft/net/Minecraft/src und fügen sie Dort ein. Und fertig ist das NPC Dorf.
------------------------------------------------------------------------

Was ist ein Block Model ??
Ein Block Model ist z.B ein Zaun oder Eine Treppen Stufe, Oder neue Slaps.
Eigene Treppe
Wir suchen die datei BlockStairs und nennen sie BlockStairsNew dan suchen wir nach
und löschen diesen code da das sonst einen licht bug erzeugt. So sieht der Code nun aus
Nun machen wir einen neuen Block mit folgenden Code
Wir können auch unseren eigenen block nehmen und zwar so
Das Ergebnis seht ihr hier
Code:
setLightOpacity(255);
Code:
package net.minecraft.src; import java.util.ArrayList; import java.util.Random; public class BlockStairsNew extends Block { /** The block that is used as model for the stair. */ private Block modelBlock; protected BlockStairsNew(int par1, Block par2Block) { super(par1, par2Block.blockIndexInTexture, par2Block.blockMaterial); modelBlock = par2Block; setHardness(par2Block.blockHardness); setResistance(par2Block.blockResistance / 3F); setStepSound(par2Block.stepSound); setLightOpacity(255); } /** * Updates the blocks bounds based on its current state. Args: world, x, y, z */ public void setBlockBoundsBasedOnState(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) { setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); } /** * Returns a bounding box from the pool of bounding boxes (this means this box can change after the pool has been * cleared to be reused) */ public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4) { return super.getCollisionBoundingBoxFromPool(par1World, par2, par3, par4); } /** * Is this block (a) opaque and (b) a full 1m cube? This determines whether or not to render the shared face of two * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block. */ public boolean isOpaqueCube() { return false; } /** * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc) */ public boolean renderAsNormalBlock() { return false; } /** * The type of render function that is called for this block */ public int getRenderType() { return 10; } /** * Returns true if the given side of this block type should be rendered, if the adjacent block is at the given * coordinates. Args: blockAccess, x, y, z, side */ public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) { return super.shouldSideBeRendered(par1IBlockAccess, par2, par3, par4, par5); } /** * Adds to the supplied array any colliding bounding boxes with the passed in bounding box. Args: world, x, y, z, * axisAlignedBB, arrayList */ public void getCollidingBoundingBoxes(World par1World, int par2, int par3, int par4, AxisAlignedBB par5AxisAlignedBB, ArrayList par6ArrayList) { int i = par1World.getBlockMetadata(par2, par3, par4); int j = i & 3; float f = 0.0F; float f1 = 0.5F; float f2 = 0.5F; float f3 = 1.0F; if ((i & 4) != 0) { f = 0.5F; f1 = 1.0F; f2 = 0.0F; f3 = 0.5F; } setBlockBounds(0.0F, f, 0.0F, 1.0F, f1, 1.0F); super.getCollidingBoundingBoxes(par1World, par2, par3, par4, par5AxisAlignedBB, par6ArrayList); if (j == 0) { setBlockBounds(0.5F, f2, 0.0F, 1.0F, f3, 1.0F); super.getCollidingBoundingBoxes(par1World, par2, par3, par4, par5AxisAlignedBB, par6ArrayList); } else if (j == 1) { setBlockBounds(0.0F, f2, 0.0F, 0.5F, f3, 1.0F); super.getCollidingBoundingBoxes(par1World, par2, par3, par4, par5AxisAlignedBB, par6ArrayList); } else if (j == 2) { setBlockBounds(0.0F, f2, 0.5F, 1.0F, f3, 1.0F); super.getCollidingBoundingBoxes(par1World, par2, par3, par4, par5AxisAlignedBB, par6ArrayList); } else if (j == 3) { setBlockBounds(0.0F, f2, 0.0F, 1.0F, f3, 0.5F); super.getCollidingBoundingBoxes(par1World, par2, par3, par4, par5AxisAlignedBB, par6ArrayList); } setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); } /** * A randomly called display update to be able to add particles or other items for display */ public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random) { modelBlock.randomDisplayTick(par1World, par2, par3, par4, par5Random); } /** * Called when the block is clicked by a player. Args: x, y, z, entityPlayer */ public void onBlockClicked(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer) { modelBlock.onBlockClicked(par1World, par2, par3, par4, par5EntityPlayer); } /** * Called right before the block is destroyed by a player. Args: world, x, y, z, metaData */ public void onBlockDestroyedByPlayer(World par1World, int par2, int par3, int par4, int par5) { modelBlock.onBlockDestroyedByPlayer(par1World, par2, par3, par4, par5); } /** * 'Goes straight to getLightBrightnessForSkyBlocks for Blocks, does some fancy computing for Fluids' */ public int getMixedBrightnessForBlock(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) { return modelBlock.getMixedBrightnessForBlock(par1IBlockAccess, par2, par3, par4); } /** * How bright to render this block based on the light its receiving. Args: iBlockAccess, x, y, z */ public float getBlockBrightness(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) { return modelBlock.getBlockBrightness(par1IBlockAccess, par2, par3, par4); } /** * Returns how much this block can resist explosions from the passed in entity. */ public float getExplosionResistance(Entity par1Entity) { return modelBlock.getExplosionResistance(par1Entity); } /** * Returns which pass should this block be rendered on. 0 for solids and 1 for alpha */ public int getRenderBlockPass() { return modelBlock.getRenderBlockPass(); } /** * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata */ public int getBlockTextureFromSideAndMetadata(int par1, int par2) { return modelBlock.getBlockTextureFromSideAndMetadata(par1, 0); } /** * Returns the block texture based on the side being looked at. Args: side */ public int getBlockTextureFromSide(int par1) { return modelBlock.getBlockTextureFromSideAndMetadata(par1, 0); } /** * How many world ticks before ticking */ public int tickRate() { return modelBlock.tickRate(); } /** * Returns the bounding box of the wired rectangular prism to render. */ public AxisAlignedBB getSelectedBoundingBoxFromPool(World par1World, int par2, int par3, int par4) { return modelBlock.getSelectedBoundingBoxFromPool(par1World, par2, par3, par4); } /** * Can add to the passed in vector for a movement vector to be applied to the entity. Args: x, y, z, entity, vec3d */ public void velocityToAddToEntity(World par1World, int par2, int par3, int par4, Entity par5Entity, Vec3D par6Vec3D) { modelBlock.velocityToAddToEntity(par1World, par2, par3, par4, par5Entity, par6Vec3D); } /** * Returns if this block is collidable (only used by Fire). Args: x, y, z */ public boolean isCollidable() { return modelBlock.isCollidable(); } /** * Returns whether this block is collideable based on the arguments passed in Args: blockMetaData, unknownFlag */ public boolean canCollideCheck(int par1, boolean par2) { return modelBlock.canCollideCheck(par1, par2); } /** * Checks to see if its valid to put this block at the specified coordinates. Args: world, x, y, z */ public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4) { return modelBlock.canPlaceBlockAt(par1World, par2, par3, par4); } /** * Called whenever the block is added into the world. Args: world, x, y, z */ public void onBlockAdded(World par1World, int par2, int par3, int par4) { onNeighborBlockChange(par1World, par2, par3, par4, 0); modelBlock.onBlockAdded(par1World, par2, par3, par4); } /** * Called whenever the block is removed. */ public void onBlockRemoval(World par1World, int par2, int par3, int par4) { modelBlock.onBlockRemoval(par1World, par2, par3, par4); } /** * Called whenever an entity is walking on top of this block. Args: world, x, y, z, entity */ public void onEntityWalking(World par1World, int par2, int par3, int par4, Entity par5Entity) { modelBlock.onEntityWalking(par1World, par2, par3, par4, par5Entity); } /** * Ticks the block if it's been scheduled */ public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) { modelBlock.updateTick(par1World, par2, par3, par4, par5Random); } /** * Called upon block activation (left or right click on the block.). The three integers represent x,y,z of the * block. */ public boolean blockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer) { return modelBlock.blockActivated(par1World, par2, par3, par4, par5EntityPlayer); } /** * Called upon the block being destroyed by an explosion */ public void onBlockDestroyedByExplosion(World par1World, int par2, int par3, int par4) { modelBlock.onBlockDestroyedByExplosion(par1World, par2, par3, par4); } /** * Called when the block is placed in the world. */ public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLiving par5EntityLiving) { int i = MathHelper.floor_double((double)((par5EntityLiving.rotationYaw * 4F) / 360F) + 0.5D) & 3; int j = par1World.getBlockMetadata(par2, par3, par4) & 4; if (i == 0) { par1World.setBlockMetadataWithNotify(par2, par3, par4, 2 | j); } if (i == 1) { par1World.setBlockMetadataWithNotify(par2, par3, par4, 1 | j); } if (i == 2) { par1World.setBlockMetadataWithNotify(par2, par3, par4, 3 | j); } if (i == 3) { par1World.setBlockMetadataWithNotify(par2, par3, par4, 0 | j); } } /** * Called when a block is placed using an item. Used often for taking the facing and figuring out how to position * the item. Args: x, y, z, facing */ public void onBlockPlaced(World par1World, int par2, int par3, int par4, int par5) { if (par5 == 0) { int i = par1World.getBlockMetadata(par2, par3, par4); par1World.setBlockMetadataWithNotify(par2, par3, par4, i | 4); } } }
Code:
StoneStairs = new BlockStairsNew(230, Block.stone).setBlockName("Stone Stairs").setHardness(0.4F).setRequiresSelfNotify();
Code:
StoneStairs = new BlockStairsNew(230, mod_name.TestErz).setBlockName("Stone Stairs").setHardness(0.4F).setRequiresSelfNotify();

Eigener Zaun
Ihr Kopiert die Datei BlockFence und nennt sie dann BlockFenceNew nun scrollt etwas runter und sucht nach
Und fügt das hier ein
Der Code Sollte nun so ausschauen
wichtig ist das ihr
Schreibt sonst gibt es einen Fetten Error
Nicht das Bearbeiten des Textes Vergessen !!! Nun Geht ihr ihn eure Mod_* datei und erstellt einen Neuen Block. Und Zwar so
Die 1 steht für das Bild wie man hier sehen Kann
Ingame Bild
Code:
public boolean canConnectFenceTo(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) { int i = par1IBlockAccess.getBlockId(par2, par3, par4); if (i == blockID || i == Block.fenceGate.blockID) { return true; } Block block = Block.blocksList[i]; if (block != null && block.blockMaterial.isOpaque() && block.renderAsNormalBlock()) { return block.blockMaterial != Material.pumpkin; } else { return false; } }
Code:
public boolean canConnectFenceTo(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) { int i = par1IBlockAccess.getBlockId(par2, par3, par4); if (i == blockID || i == Block.fenceGate.blockID) { return true; } if (i == blockID || i == mod_Name.Zaun.blockID) { return true; } Block block = Block.blocksList[i]; if (block != null && block.blockMaterial.isOpaque() && block.renderAsNormalBlock()) { return block.blockMaterial != Material.pumpkin; } else { return false; } }
Code:
package net.minecraft.src; public class BlockFenceNew extends BlockFence { public BlockFenceNew(int par1, int par2) { super(par1, par2, Material.rock); } public BlockFenceNew(int par1, int par2, Material par3Material) { super(par1, par2, par3Material); } /** * Checks to see if its valid to put this block at the specified coordinates. Args: world, x, y, z */ public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4) { return super.canPlaceBlockAt(par1World, par2, par3, par4); } /** * Returns a bounding box from the pool of bounding boxes (this means this box can change after the pool has been * cleared to be reused) */ public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4) { boolean flag = canConnectFenceTo(par1World, par2, par3, par4 - 1); boolean flag1 = canConnectFenceTo(par1World, par2, par3, par4 + 1); boolean flag2 = canConnectFenceTo(par1World, par2 - 1, par3, par4); boolean flag3 = canConnectFenceTo(par1World, par2 + 1, par3, par4); float f = 0.375F; float f1 = 0.625F; float f2 = 0.375F; float f3 = 0.625F; if (flag) { f2 = 0.0F; } if (flag1) { f3 = 1.0F; } if (flag2) { f = 0.0F; } if (flag3) { f1 = 1.0F; } return AxisAlignedBB.getBoundingBoxFromPool((float)par2 + f, par3, (float)par4 + f2, (float)par2 + f1, (float)par3 + 1.5F, (float)par4 + f3); } /** * Updates the blocks bounds based on its current state. Args: world, x, y, z */ public void setBlockBoundsBasedOnState(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) { boolean flag = canConnectFenceTo(par1IBlockAccess, par2, par3, par4 - 1); boolean flag1 = canConnectFenceTo(par1IBlockAccess, par2, par3, par4 + 1); boolean flag2 = canConnectFenceTo(par1IBlockAccess, par2 - 1, par3, par4); boolean flag3 = canConnectFenceTo(par1IBlockAccess, par2 + 1, par3, par4); float f = 0.375F; float f1 = 0.625F; float f2 = 0.375F; float f3 = 0.625F; if (flag) { f2 = 0.0F; } if (flag1) { f3 = 1.0F; } if (flag2) { f = 0.0F; } if (flag3) { f1 = 1.0F; } setBlockBounds(f, 0.0F, f2, f1, 1.0F, f3); } /** * Is this block (a) opaque and (b) a full 1m cube? This determines whether or not to render the shared face of two * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block. */ public boolean isOpaqueCube() { return false; } /** * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc) */ public boolean renderAsNormalBlock() { return false; } public boolean getBlocksMovement(IBlockAccess par1IBlockAccess, int par2, int par3, int i) { return false; } /** * The type of render function that is called for this block */ public int getRenderType() { return 11; } /** * Returns true if the specified block can be connected by a fence */ public boolean canConnectFenceTo(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) { int i = par1IBlockAccess.getBlockId(par2, par3, par4); if (i == blockID || i == Block.fenceGate.blockID) { return true; } if (i == blockID || i == mod_name.ZaunTor.blockID) { return true; } if (i == blockID || i == mod_name.Zaun.blockID) { return true; } Block block = Block.blocksList[i]; if (block != null && block.blockMaterial.isOpaque() && block.renderAsNormalBlock()) { return block.blockMaterial != Material.pumpkin; } else { return false; } } }
Code:
public class BlockFenceNew extends BlockFence
Nicht das Bearbeiten des Textes Vergessen !!! Nun Geht ihr ihn eure Mod_* datei und erstellt einen Neuen Block. Und Zwar so
Code:
Zaun = new BlockFenceNew(239, 1).setHardness(0.5F).setBlockName("FenceRock").setRequiresSelfNotify();

Ingame Bild

Eigenes Zaun Tor
Wir suchen wieder Nach einer Datei Dieses Mal ist es BlockFanceGate wir kopieren Diese und nennen sie BlockFenceGateNew wichtig ist das ihr nach
sucht und durch
Nun erstellen wir wieder einen Neuen Block mit diesem Code
Ingame Bildchen
Code:
public class BlockFenceGateNew extends BlockDirectional
Code:
public class BlockFenceGateNew extends BlockFenceGate
Code:
ZaunTor = new BlockFenceGateNew(240, 1).setHardness(0.5F).setBlockName("FenceRock").setRequiresSelfNotify();

Tür
Wir erstellen jetzt eine neue Tür diese hat die selben Funktionen wie eine normale Holz Tür.
Es wird eine Glas Tür.
Bilder
2 fach Tür
Beide Offen
Jeweils eine offen
Wir kopieren die Datein : BlockDoor & ItemDoor
die BlockDoor nenen wir einfach einmal BlockDoorGlas und schreiben das hinein
Hier werden zum einem mit dem Code
bestimmt das das Item doorGlas gedropt wird sobald man die Tür zerstört.
ItemDoorGlas
Hier werden die Türen definiert die gesetzt werden Sobalt man Rechtsklick mit dem Item macht
das Item das ich gemacht habe hat das material Glass normal hätte
Gereicht allerdings möchte ich ganz sicher gehen das Kein Error Kommt
jetzt zu meiner mod_Name Datei die sieht so aus
Das einzige was ihr Wissen müsst ist das ihr folgende Dateien
DoorUnten.png für den unteren teil der Tür ist und DoorOben.png für den Oberen.
Es wird eine Glas Tür.
Bilder

2 fach Tür

Beide Offen


Jeweils eine offen
Wir kopieren die Datein : BlockDoor & ItemDoor
die BlockDoor nenen wir einfach einmal BlockDoorGlas und schreiben das hinein
Code:
package net.minecraft.src; import java.util.Random; public class BlockDoorGlas extends BlockDoor{ protected BlockDoorGlas(int par1, Material par2Material) { super(par1, par2Material); } public int idDropped(int par1, Random par2Random, int par3) { if ((par1 & 8) != 0) { return 0; } if (blockMaterial == Material.iron) { return Item.doorSteel.shiftedIndex; } else { return mod_Name.doorGlass.shiftedIndex; } } public int getBlockTexture(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) { if (par5 == 0 || par5 == 1) { return blockIndexInTexture; } int i = getFullMetadata(par1IBlockAccess, par2, par3, par4); int j = blockIndexInTexture; if ((i & 8) != 0) { j = mod_Name.BlockDoorOben; } int k = i & 3; boolean flag = (i & 4) != 0; if (!flag) { if (k == 0 && par5 == 5) { j = -j; } else if (k == 1 && par5 == 3) { j = -j; } else if (k == 2 && par5 == 4) { j = -j; } else if (k == 3 && par5 == 2) { j = -j; } if ((i & 0x10) != 0) { j = -j; } } else if (k == 0 && par5 == 2) { j = -j; } else if (k == 1 && par5 == 5) { j = -j; } else if (k == 2 && par5 == 3) { j = -j; } else if (k == 3 && par5 == 4) { j = -j; } return j; } }
Code:
public int idDropped(int par1, Random par2Random, int par3) { if ((par1 & 8) != 0) { return 0; } if (blockMaterial == Material.iron) { return Item.doorSteel.shiftedIndex; } else { return mod_Name.doorGlass.shiftedIndex; } }
ItemDoorGlas
Code:
package net.minecraft.src; public class ItemDoorGlas extends Item { private Material doorMaterial; public ItemDoorGlas(int par1, Material par2Material) { super(par1); doorMaterial = par2Material; maxStackSize = 1; } /** * Callback for item usage. If the item does something special on right clicking, he will have one of those. Return * True if something happen and false if it don't. This is for ITEMS, not BLOCKS ! */ public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7) { if (par7 != 1) { return false; } par5++; Block block; if (doorMaterial == Material.glass) { block = mod_Name.GlassDoorBlock; } else { block = Block.doorSteel; } if (!par2EntityPlayer.canPlayerEdit(par4, par5, par6) || !par2EntityPlayer.canPlayerEdit(par4, par5 + 1, par6)) { return false; } if (!block.canPlaceBlockAt(par3World, par4, par5, par6)) { return false; } else { int i = MathHelper.floor_double((double)(((par2EntityPlayer.rotationYaw + 180F) * 4F) / 360F) - 0.5D) & 3; placeDoorBlock(par3World, par4, par5, par6, i, block); par1ItemStack.stackSize--; return true; } } public static void placeDoorBlock(World par0World, int par1, int par2, int par3, int par4, Block par5Block) { byte byte0 = 0; byte byte1 = 0; if (par4 == 0) { byte1 = 1; } if (par4 == 1) { byte0 = -1; } if (par4 == 2) { byte1 = -1; } if (par4 == 3) { byte0 = 1; } int i = (par0World.isBlockNormalCube(par1 - byte0, par2, par3 - byte1) ? 1 : 0) + (par0World.isBlockNormalCube(par1 - byte0, par2 + 1, par3 - byte1) ? 1 : 0); int j = (par0World.isBlockNormalCube(par1 + byte0, par2, par3 + byte1) ? 1 : 0) + (par0World.isBlockNormalCube(par1 + byte0, par2 + 1, par3 + byte1) ? 1 : 0); boolean flag = par0World.getBlockId(par1 - byte0, par2, par3 - byte1) == par5Block.blockID || par0World.getBlockId(par1 - byte0, par2 + 1, par3 - byte1) == par5Block.blockID; boolean flag1 = par0World.getBlockId(par1 + byte0, par2, par3 + byte1) == par5Block.blockID || par0World.getBlockId(par1 + byte0, par2 + 1, par3 + byte1) == par5Block.blockID; boolean flag2 = false; if (flag && !flag1) { flag2 = true; } else if (j > i) { flag2 = true; } par0World.editingBlocks = true; par0World.setBlockAndMetadataWithNotify(par1, par2, par3, par5Block.blockID, par4); par0World.setBlockAndMetadataWithNotify(par1, par2 + 1, par3, par5Block.blockID, 8 | (flag2 ? 1 : 0)); par0World.editingBlocks = false; par0World.notifyBlocksOfNeighborChange(par1, par2, par3, par5Block.blockID); par0World.notifyBlocksOfNeighborChange(par1, par2 + 1, par3, par5Block.blockID); } }
Hier werden die Türen definiert die gesetzt werden Sobalt man Rechtsklick mit dem Item macht
Code:
if (doorMaterial == Material.glass) { block = mod_Name.GlassDoor; } else { block = mod_Name.GlassDoor; }
Code:
if (doorMaterial == Material.glass) { block = mod_Name.GlassDoor; }
jetzt zu meiner mod_Name Datei die sieht so aus
Code:
package net.minecraft.src; import java.util.Random; public class mod_Name extends BaseMod { public static int BlockDoorUnten; public static int BlockDoorOben; public static final Block GlassDoor; public static final Item doorGlass; static { GlassDoor = new BlockDoorGlas(160, Material.glass).setHardness(0F).setStepSound(Block.soundGlassFootstep).setBlockName("GlasTrapdoor").disableStats().setRequiresSelfNotify(); doorGlass = new ItemDoorGlas(161, Material.glass).setIconCoord(11, 2).setItemName("GlassDoor"); ModLoader.registerBlock(GlassDoor); doorGlass.iconIndex = ModLoader.addOverride("/gui/items.png","/glassDoorIcon.png"); } public void load() { BlockDoorUnten = GlassDoor.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/DoorUnten.png"); BlockDoorOben = GlassDoor.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/DoorOben.png"); GlassDoor.blockIndexInTexture = BlockDoorUnten; } public String getVersion() { return "1.2.5";} }
DoorUnten.png für den unteren teil der Tür ist und DoorOben.png für den Oberen.
Trap Door
So könnte sie aussehen

So sieht sie aus wenn sie geschlossen ist

Und so offen

Schritt 1
Wir kopieren die Datei BlockTrapDoor und nennen Sie zum Beispiel BlockTrapDoorGlas sie sollte am Schluss dann so aussehen
Code:
package net.minecraft.src; public class BlockTrapDoorGlas extends Block { protected BlockTrapDoorGlas(int par1, Material par2Material) { super(par1, par2Material); blockIndexInTexture = 84; if (par2Material == Material.iron) { blockIndexInTexture++; } float f = 0.5F; float f1 = 1.0F; setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f1, 0.5F + f); } /** * Is this block (a) opaque and (b) a full 1m cube? This determines whether or not to render the shared face of two * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block. */ public boolean isOpaqueCube() { return false; } /** * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc) */ public boolean renderAsNormalBlock() { return false; } public boolean getBlocksMovement(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) { return !isTrapdoorOpen(par1IBlockAccess.getBlockMetadata(par2, par3, par4)); } /** * The type of render function that is called for this block */ public int getRenderType() { return 0; } /** * Returns the bounding box of the wired rectangular prism to render. */ public AxisAlignedBB getSelectedBoundingBoxFromPool(World par1World, int par2, int par3, int par4) { setBlockBoundsBasedOnState(par1World, par2, par3, par4); return super.getSelectedBoundingBoxFromPool(par1World, par2, par3, par4); } /** * Returns a bounding box from the pool of bounding boxes (this means this box can change after the pool has been * cleared to be reused) */ public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4) { setBlockBoundsBasedOnState(par1World, par2, par3, par4); return super.getCollisionBoundingBoxFromPool(par1World, par2, par3, par4); } /** * Updates the blocks bounds based on its current state. Args: world, x, y, z */ public void setBlockBoundsBasedOnState(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) { setBlockBoundsForBlockRender(par1IBlockAccess.getBlockMetadata(par2, par3, par4)); } /** * Sets the block's bounds for rendering it as an item */ public void setBlockBoundsForItemRender() { float f = 0.1875F; setBlockBounds(0.0F, 0.5F - f / 2.0F, 0.0F, 1.0F, 0.5F + f / 2.0F, 1.0F); } public void setBlockBoundsForBlockRender(int par1) { float f = 0.1875F; setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, f, 1.0F); if (isTrapdoorOpen(par1)) { if ((par1 & 3) == 0) { setBlockBounds(0.0F, 0.0F, 1.0F - f, 1.0F, 1.0F, 1.0F); } if ((par1 & 3) == 1) { setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, f); } if ((par1 & 3) == 2) { setBlockBounds(1.0F - f, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); } if ((par1 & 3) == 3) { setBlockBounds(0.0F, 0.0F, 0.0F, f, 1.0F, 1.0F); } } } /** * Called when the block is clicked by a player. Args: x, y, z, entityPlayer */ public void onBlockClicked(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer) { blockActivated(par1World, par2, par3, par4, par5EntityPlayer); } /** * Called upon block activation (left or right click on the block.). The three integers represent x,y,z of the * block. */ public boolean blockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer) { if (blockMaterial == Material.iron) { return true; } else { int i = par1World.getBlockMetadata(par2, par3, par4); par1World.setBlockMetadataWithNotify(par2, par3, par4, i ^ 4); par1World.playAuxSFXAtEntity(par5EntityPlayer, 1003, par2, par3, par4, 0); return true; } } public void onPoweredBlockChange(World par1World, int par2, int par3, int par4, boolean par5) { int i = par1World.getBlockMetadata(par2, par3, par4); boolean flag = (i & 4) > 0; if (flag == par5) { return; } else { par1World.setBlockMetadataWithNotify(par2, par3, par4, i ^ 4); par1World.playAuxSFXAtEntity(null, 1003, par2, par3, par4, 0); return; } } /** * Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are * their own) Args: x, y, z, neighbor blockID */ public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5) { if (par1World.isRemote) { return; } int i = par1World.getBlockMetadata(par2, par3, par4); int j = par2; int k = par4; if ((i & 3) == 0) { k++; } if ((i & 3) == 1) { k--; } if ((i & 3) == 2) { j++; } if ((i & 3) == 3) { j--; } if (!isValidSupportBlock(par1World.getBlockId(j, par3, k))) { par1World.setBlockWithNotify(par2, par3, par4, 0); dropBlockAsItem(par1World, par2, par3, par4, i, 0); } boolean flag = par1World.isBlockIndirectlyGettingPowered(par2, par3, par4); if (flag || par5 > 0 && Block.blocksList[par5].canProvidePower() || par5 == 0) { onPoweredBlockChange(par1World, par2, par3, par4, flag); } } /** * Ray traces through the blocks collision from start vector to end vector returning a ray trace hit. Args: world, * x, y, z, startVec, endVec */ public MovingObjectPosition collisionRayTrace(World par1World, int par2, int par3, int par4, Vec3D par5Vec3D, Vec3D par6Vec3D) { setBlockBoundsBasedOnState(par1World, par2, par3, par4); return super.collisionRayTrace(par1World, par2, par3, par4, par5Vec3D, par6Vec3D); } /** * Called when a block is placed using an item. Used often for taking the facing and figuring out how to position * the item. Args: x, y, z, facing */ public void onBlockPlaced(World par1World, int par2, int par3, int par4, int par5) { byte byte0 = 0; if (par5 == 2) { byte0 = 0; } if (par5 == 3) { byte0 = 1; } if (par5 == 4) { byte0 = 2; } if (par5 == 5) { byte0 = 3; } par1World.setBlockMetadataWithNotify(par2, par3, par4, byte0); } /** * checks to see if you can place this block can be placed on that side of a block: BlockLever overrides */ public boolean canPlaceBlockOnSide(World par1World, int par2, int par3, int par4, int par5) { if (par5 == 0) { return false; } if (par5 == 1) { return false; } if (par5 == 2) { par4++; } if (par5 == 3) { par4--; } if (par5 == 4) { par2++; } if (par5 == 5) { par2--; } return isValidSupportBlock(par1World.getBlockId(par2, par3, par4)); } public static boolean isTrapdoorOpen(int par0) { return (par0 & 4) != 0; } /** * Checks if the block ID is a valid support block for the trap door to connect with. If it is not the trapdoor is * dropped into the world. */ private static boolean isValidSupportBlock(int par0) { if (par0 <= 0) { return false; } else { Block block = Block.blocksList[par0]; return block != null && block.blockMaterial.isOpaque() && block.renderAsNormalBlock() || block == Block.glowStone; } } }
Code:
package net.minecraft.src; import java.util.Random; public class mod_Name extends BaseMod { public static final Block GlassDoor; static { GlassDoor = new BlockTrapDoorGlas(160, Material.glass).setHardness(0F).setStepSound(Block.soundGlassFootstep).setBlockName("GlasTrapdoor").disableStats().setRequiresSelfNotify(); ModLoader.registerBlock(GlassDoor); GlassDoor.blockIndexInTexture = ModLoader.addOverride("/terrain.png","/test.png"); } public void load() {} public String getVersion() { return "1.2.5";} }


Unter einem Einfachen Item versteht man grundsätzlich ein Item ohne direkte Funktion ein beispiel hierfür ist ein Diamant. Dieser Hat auch keine Funtkion bei Rechtsklick bzw links klick.
Einfaches Item
Wir erstellen uns nun einen Diamanten.
Wie bei einen neuen Block müssen wir ein Public Item erstellen das machen wir mit diesen Code
Nun müssen wir die ID etc festlegen Beim Block war das der Standard Code
Beim Item heißt der Standard Code so
.setIconCoord = Dieser Befehl legt das Icon fest diese befindet sich später Dan ihn folgender datei: minecraft.jar/gui/items.png !!!!! Sollte uns aber ihn der regel egal sein xD !!!!!
Rubin = Das ist das Item das wir einbauen wollen so findet eclipse es
new Item = Dieser Code sagt das er ein neues Item mit den Standard Item Code aus der Item.java laden soll
ID = Darf nur wie beim Block einmal Vergeben werden. Die Id muss höher sein als die Letzte ID auch wenn diese von einen Block ist.
X-Achse/Y-Achse = Geben An wo sich das Bild Befindet ihn der items.png
ItemName = Unsere Hilfe wieder.
Hier das ist der Code für das Einbinden eines neuen Icons:
Dieses Mal heißt es statt Rubin.blockIndexInTexture so Rubin.iconIndex
Auch liegt die BildDatei nicht ihn der Terrain.png sondern ihn der /gui/items.png
So kann ein Fertiger Code ausschauen
Wie bei einen neuen Block müssen wir ein Public Item erstellen das machen wir mit diesen Code
Code:
public static final Item Rubin;
Code:
TestErz = new Block(220, 0, Material.rock).setHardness(0.5F).setLightValue(0.5F).setBlockName("Block Tutorial");
Code:
Rubin = new Item(220).setIconCoord(10, 1).setItemName("Rubin"); Item = new Item(ID).setIconCoord(X-Achse, Y-Achse).setItemName("ItemName");
Rubin = Das ist das Item das wir einbauen wollen so findet eclipse es
new Item = Dieser Code sagt das er ein neues Item mit den Standard Item Code aus der Item.java laden soll
ID = Darf nur wie beim Block einmal Vergeben werden. Die Id muss höher sein als die Letzte ID auch wenn diese von einen Block ist.
X-Achse/Y-Achse = Geben An wo sich das Bild Befindet ihn der items.png
ItemName = Unsere Hilfe wieder.
Hier das ist der Code für das Einbinden eines neuen Icons:
Code:
Rubin.iconIndex = ModLoader.addOverride("/gui/items.png", "/Items/Rubin.png");
Auch liegt die BildDatei nicht ihn der Terrain.png sondern ihn der /gui/items.png
So kann ein Fertiger Code ausschauen
Code:
package net.minecraft.src; public class mod_name extends BaseMod{ public static Item Block Rubin; static{ //Item Rubin = new Item(220).setIconCoord(10, 1).setItemName("Rubin"); //Name ModLoader.addName(Rubin, "Rubin"); //Textur Rubin.iconIndex = ModLoader.addOverride("/gui/items.png", "/tutorial/item/rubin.png"); } public String getVersion() {return "Minecraft Tutorial Mod";} public void load() {} }
Block etwas Droppen lassen.
Zuerst Erstelln wir einen Block und zwar so
Dan erstellen wir eine Neue Klasse mit dem Namen BlockDrop
Hin der Dan folgendes Steht
Dieser Code ist wichtig
Das heißt wenn der Block = mod_name.BlockTutorial1.blockId ist soll er einen mod_name.Rubin.shiftedIndex ausgeben das mod_name ist wichtig da Block Drop von der Datei Block die Informationen bekommt. dH wir greifen so auf eine andere Datei hinzu. Vorteil von diesen code ist das man mehrere Blöcke hinzufügen kann das Kann Dan z.B so aussehen
Das ganze sieht Dan Ingame so aus
Code:
BlockTutorial1 = new BlockDrop(220, 0, Material.wood).setBlockName("Block Normal").setHardness(0.4F);
Hin der Dan folgendes Steht
Code:
package net.minecraft.src; import java.util.Random; public class BlockDrop extends Block{ protected BlockDrop(int par1, int par2, Material par3Material) { super(par1, par2, par3Material); } public int idDropped(int par1, Random par2Random, int par3) { if (blockID == mod_name.BlockTutorial1.blockID) { return mod_name.Rubin.shiftedIndex; } else { return blockID; } } }
Code:
if (blockID == mod_name.BlockTutorial1.blockID) { return mod_name.Rubin.shiftedIndex; }
Code:
package net.minecraft.src; import java.util.Random; public class BlockDrop extends Block{ protected BlockDrop(int par1, int par2, Material par3Material) { super(par1, par2, par3Material); } public int idDropped(int par1, Random par2Random, int par3) { if (blockID == mod_name.BlockTutorial1.blockID) { return mod_name.Rubin.shiftedIndex; } if (blockID == mod_name.BlockTutorial2.blockID) { return mod_name.Rubin2.shiftedIndex; } if (blockID == mod_name.BlockTutorial3.blockID) { return mod_name.Rubi3.shiftedIndex; } if (blockID == mod_name.BlockTutorial4.blockID) { return mod_name.Rubin4.shiftedIndex; } else { return blockID; } } }
Das ganze sieht Dan Ingame so aus


Block Mehr Droppen lassen.
Wenn wir so eine Drop rate wollen wir bei Lapis Dan gehen wir wieder ihn unsere BlockDrop datei und fügen folgendes Hinzu
wenn wir statt
z.B eingeben
werden einige mehr gespawnt so sieht nun die Datei aus
Wichtig ist auch das der Code aus dem ersten Block Drop Tut nicht fehlen darf also auf den Oberen Spoiler Klicken oder hier unten
So sieht das Dan Ingame aus
Code:
public int quantityDropped(Random par1Random) { if (blockID == mod_name.BlockTutorial1.blockID) { return 4 + par1Random.nextInt(5); } else { return 1; } }
Code:
return 4 + par1Random.nextInt(5);
Code:
return 100 + par1Random.nextInt(5);
Code:
package net.minecraft.src; import java.util.Random; public class BlockDrop extends Block{ protected BlockDrop(int par1, int par2, Material par3Material) { super(par1, par2, par3Material); } public int idDropped(int par1, Random par2Random, int par3) { if (blockID == mod_name.BlockTutorial1.blockID) { return mod_name.Rubin.shiftedIndex; } else { return blockID; } } public int quantityDropped(Random par1Random) { if (blockID == mod_name.BlockTutorial1.blockID) { return 4 + par1Random.nextInt(5); } else { return 1; } } }
Code:
if (blockID == mod_name.BlockTutorial1.blockID) { return mod_name.Rubin.shiftedIndex; }
So sieht das Dan Ingame aus




Eigene Spawn Eggs
Wer wünscht sich nicht seinen eigenen Mob spawnen zu lassen oder ein Anderes Tier Spawnen zu lassen das geht eigentlich recht simpel.
Wir erstellen zuerst ein neues Item das sollte ungefähr so ausschauen.
So nun brauchen wir eine neue klasse mit dem Namen ItemSpawnEgg
Ihn der sollte folgendes stehen
maxStackSize = 1; = Hier ist angegeben wie groß ein Stack davon ist bei mir ist es genau ein Spawn ei.
setMaxDamage(1); = Hier wird der maximale Schaden eingestellt d.H wir können dieses Item nur einmal benutzen Dan wird es zerstört.
float x = 0.0F; = wert einer X-Achse benutzen wir um den Mob Spawn einzustellen.
float z = 10; = wert einer Z-Achse benutzen wir um den Mob Spawn einzustellen.
EntityDragon dragon = new EntityDragon(par1World); = Hier wird angegeben das EntityDragon auch mit dem wert dragon aufgerufen werden kann. außerdem ist es ein neuer Entity ihn der Welt.
dragon.setLocationAndAngles(par2EntityPlayer.posX, par2EntityPlayer.posY, par2EntityPlayer.posZ, x, z); = Hier wird angegeben wo der Mob Gespawnt wird.
par1World.spawnEntityInWorld(dragon); = Dieser Code Sagt aus das unser EntityDragon oder auch Dragon Gespawnt werden soll
par1ItemStack.damageItem(1, par2EntityPlayer); = Dieser Code sagt aus das bei einem Rechtsklick dem maxDamage ein Wert abgezogen werden soll. So zerstören wir das Ei
Hier 2 Bildchen
Spawn Ei
Gespawnter Ender Drache
Wir erstellen zuerst ein neues Item das sollte ungefähr so ausschauen.
Code:
package net.minecraft.src; public class mod_name extends BaseMod{ public static Item Block EnderEgg; static{ //Item EnderEgg = new ItemSpawnEgg(244).setIconCoord(10,1).setItemName("Ender Drachen Ei"); //Name ModLoader.addName(EnderEgg, "Ender Dragon Egg"); //Textur Rubin.iconIndex = ModLoader.addOverride("/gui/items.png", "/tutorial/item/EnderEgg.png"); } public String getVersion() {return "Minecraft Tutorial Mod";} public void load() {} }
Ihn der sollte folgendes stehen
Code:
package net.minecraft.src; public class ItemSpawnEgg extends Item{ protected ItemSpawnEgg(int par1) { super(par1); maxStackSize = 1; setMaxDamage(1); } public ItemStack onItemRightClick(ItemStack par1ItemStack, World par1World, EntityPlayer par2EntityPlayer) { EntityDragondragon = new EntityDragon(par1World); float x = 0.0F; float z = 10; float y = 0.0F; dragon.setLocationAndAngles(par2EntityPlayer.posX, par2EntityPlayer.posY, par2EntityPlayer.posZ, x, z); par1World.spawnEntityInWorld(dragon); par1ItemStack.damageItem(1, par2EntityPlayer); return par1ItemStack; } }
setMaxDamage(1); = Hier wird der maximale Schaden eingestellt d.H wir können dieses Item nur einmal benutzen Dan wird es zerstört.
float x = 0.0F; = wert einer X-Achse benutzen wir um den Mob Spawn einzustellen.
float z = 10; = wert einer Z-Achse benutzen wir um den Mob Spawn einzustellen.
EntityDragon dragon = new EntityDragon(par1World); = Hier wird angegeben das EntityDragon auch mit dem wert dragon aufgerufen werden kann. außerdem ist es ein neuer Entity ihn der Welt.
dragon.setLocationAndAngles(par2EntityPlayer.posX, par2EntityPlayer.posY, par2EntityPlayer.posZ, x, z); = Hier wird angegeben wo der Mob Gespawnt wird.
par1World.spawnEntityInWorld(dragon); = Dieser Code Sagt aus das unser EntityDragon oder auch Dragon Gespawnt werden soll
par1ItemStack.damageItem(1, par2EntityPlayer); = Dieser Code sagt aus das bei einem Rechtsklick dem maxDamage ein Wert abgezogen werden soll. So zerstören wir das Ei
Hier 2 Bildchen
Spawn Ei

Gespawnter Ender Drache

# Dieser Abschnitt Wird noch erweitert #
##########################


