提供: Minecraft Modding Wiki
移動先: 案内検索

警告: ログインしていません。編集を行うと、あなたの IP アドレスが公開されます。ログインまたはアカウントを作成すれば、あなたの編集はその利用者名とともに表示されるほか、その他の利点もあります。

この編集を取り消せます。 下記の差分を確認して、本当に取り消していいか検証してください。よろしければ変更を保存して取り消しを完了してください。
最新版 編集中の文章
24行目: 24行目:
 
     @EventHandler
 
     @EventHandler
 
     public void init(FMLInitialization event) {
 
     public void init(FMLInitialization event) {
         EntityRegistry.registerModEntity(EntitySample.class, "SampleEntity", 0, this, 250, 1, false);
+
         EntityRegistry.registerModEntity(EntitySample.class, "SampleEntity, 0, this, 250, 1, false);
 
         EntityRegistry.addSpawn(EntitySample.class, 20, 1, 4, EnumCreatureType.creature, BiomeGenBase.plains);
 
         EntityRegistry.addSpawn(EntitySample.class, 20, 1, 4, EnumCreatureType.creature, BiomeGenBase.plains);
 
         if(FMLCommonHandler.instance().getSide() == Side.CLIENT) {
 
         if(FMLCommonHandler.instance().getSide() == Side.CLIENT) {
39行目: 39行目:
 
import net.minecraft.entity.EnumCreatureAttribute;
 
import net.minecraft.entity.EnumCreatureAttribute;
 
import net.minecraft.entity.EntityLiving;
 
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.ai.EntityAIWander;
 
import net.minecraft.entity.ai.EntityAILookIdle;
 
 
import net.minecraft.init.Items;
 
import net.minecraft.init.Items;
 
import net.minecraft.item.Item;
 
import net.minecraft.item.Item;
46行目: 44行目:
  
  
public class EntitySample extends EntityCreature {
+
public class EntitySample extends EntityLiving {
 
     public EntitySample(World world) {
 
     public EntitySample(World world) {
 
         super(world);
 
         super(world);
95行目: 93行目:
 
     public static final ResourceLocation texture = new ResourceLocation("entity:textures/entity/sample.png");
 
     public static final ResourceLocation texture = new ResourceLocation("entity:textures/entity/sample.png");
 
     public RenderSample() {
 
     public RenderSample() {
        // 引数:(ModelBase以降を継承したクラスのインスタンス、影の大きさ)
+
         super(new ModelSample(), 1.0f);
         super(new ModelSample(), 0.6f);
 
 
     }
 
     }
  
107行目: 104行目:
 
package mods.entity;
 
package mods.entity;
  
import net.minecraft.client.model.ModelBase;
 
 
import net.minecraft.client.model.ModelRenderer;
 
import net.minecraft.client.model.ModelRenderer;
  
141行目: 137行目:
 
}
 
}
 
</source>
 
</source>
 
 
===解説===
 
===解説===
*SampleEntityCore.java
 
このModのエントリクラス。
 
*EntitySample.java
 
うろついたり、見回したりする程度のAIを追加している。
 
*RenderSample.java
 
追加するMobの描画クラス。
 
*ModelSample.java
 
コンストラクタで、モデルの各直方体の大きさ、 回転軸、角度を決める。
 
<source lang="java">
 
ModelRenderer base;
 
 
public ModelSample() {
 
    base = new ModelRenderer(0, 0); // 引数:(テクスチャ画像の始点のX座標、テクスチャ画像の始点のY座標)
 
    base.addBox(0f, 0f, 0f, 1, 1, 1,); // 大きさの定義。引数:(始X, 始Y, 始Z, 終X, 終Y, 終Z)
 
    base.setRotationPoint(0.5f, 0.5f, 0.5f); // 回転軸の定義。引数:(X, Y, Z)
 
    base.rotateAngleX = 45f;
 
    base.rotateAngleZ = 45f; // X軸とZ軸方向に45度ずつ回転
 
}
 
</source>
 

Minecraft Modding Wikiへの投稿はすべて、他の投稿者によって編集、変更、除去される場合があります。 自分が書いたものが他の人に容赦なく編集されるのを望まない場合は、ここに投稿しないでください。
また、投稿するのは、自分で書いたものか、パブリック ドメインまたはそれに類するフリーな資料からの複製であることを約束してください(詳細はMinecraft Modding Wiki:著作権を参照)。 著作権保護されている作品は、許諾なしに投稿しないでください!

このページを編集するには、下記の確認用の質問に回答してください (詳細):

取り消し 編集の仕方 (新しいウィンドウで開きます)