Jump to content

Recommended Posts

Posted

Mainclass:

package com.Egietje.degeweldigemod;

import org.lwjgl.opengl.Display;

import com.Egietje.degeweldigemod.handler.CheeseHandler;
import com.Egietje.degeweldigemod.init.CheeseBlocks;
import com.Egietje.degeweldigemod.init.CheeseItems;
import com.Egietje.degeweldigemod.mobs.EntityCheeseCow;
import com.Egietje.degeweldigemod.mobs.ModelCheeseCow;
import com.Egietje.degeweldigemod.mobs.RenderCheeseCow;
import com.Egietje.degeweldigemod.proxy.CommonProxy;

import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.entity.EnumCreatureType;
import net.minecraft.init.Biomes;
import net.minecraft.world.biome.Biome;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.client.registry.RenderingRegistry;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.Mod.Instance;
import net.minecraftforge.fml.common.SidedProxy;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.registry.EntityRegistry;
import net.minecraftforge.fml.common.registry.GameRegistry;

@Mod(modid = Reference.MODID, name = Reference.NAME, version = Reference.VERSION, acceptedMinecraftVersions = "[1.10]")
public class DeGeweldigeMod {
public static final CheeseTab tabCheeseStuff = new CheeseTab("tabCheeseStuff");

@SidedProxy(clientSide = Reference.CLIENTPROXY, serverSide = Reference.COMMONPROXY)
public static CommonProxy proxy;

@Instance(Reference.MODID)
public static DeGeweldigeMod DGMInstance;

@EventHandler
public void preInit(FMLPreInitializationEvent event) {
	registerModEntityWithEgg(EntityCheeseCow.class, "CheeseCow", 0x917B1B, 0x8E814E, 250);
	EntityRegistry.addSpawn(EntityCheeseCow.class, 8, 4, 4, EnumCreatureType.CREATURE, Biomes.PLAINS, Biomes.FOREST);
	proxy.registerModels();
	proxy.renderEntities();

	new CheeseItems();
	new CheeseBlocks();
	new CheeseAchievements();

	Display.setTitle("Minecraft - 1.10 | DeGeweldigeMod - 2.1");
}

@EventHandler
public static void init(FMLInitializationEvent event) {
	new CheeseCraftingAndSmelting();

	GameRegistry.registerWorldGenerator(new CheeseGeneration(), 0);

	MinecraftForge.EVENT_BUS.register(new CheeseHandler());
}

@EventHandler
public static void postInit(FMLPostInitializationEvent event) {
}

public void registerModEntityWithEgg(Class entityClass, String entityName, int eggColor, int eggSpotsColor, int entityID) {
    EntityRegistry.registerModEntity(entityClass, entityName, entityID, DeGeweldigeMod.DGMInstance, 80, 3, false);
    EntityRegistry.registerEgg(entityClass, eggColor, eggSpotsColor);
}
}

ClientProxy:

package com.Egietje.degeweldigemod.proxy;

import com.Egietje.degeweldigemod.DeGeweldigeMod;
import com.Egietje.degeweldigemod.Reference;
import com.Egietje.degeweldigemod.init.CheeseBlocks;
import com.Egietje.degeweldigemod.init.CheeseItems;
import com.Egietje.degeweldigemod.mobs.*;

import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.entity.EnumCreatureType;
import net.minecraft.init.Biomes;
import net.minecraft.item.Item;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.fml.client.registry.RenderingRegistry;
import net.minecraftforge.fml.common.registry.EntityRegistry;

public class ClientProxy extends CommonProxy {

public void registerModels() {
	registerItemModel(CheeseItems.CHEESE, 0);
	registerItemModel(CheeseItems.CHEESE_COOKED, 0);
	registerItemModel(CheeseItems.BREAD_CHEESE, 0);
	registerItemModel(CheeseItems.CHEESE_APPLE, 0);

	registerItemModel(CheeseItems.CHEESE_SWORD, 0);
	registerItemModel(CheeseItems.CHEESE_PICKAXE, 0);
	registerItemModel(CheeseItems.CHEESE_AXE, 0);
	registerItemModel(CheeseItems.CHEESE_SHOVEL, 0);
	registerItemModel(CheeseItems.CHEESE_HOE, 0);
	registerItemModel(CheeseItems.CHEESE_FLY_STICK, 0);

	registerItemModel(CheeseItems.CHEESE_HELMET, 0);
	registerItemModel(CheeseItems.CHEESE_CHESTPLATE, 0);
	registerItemModel(CheeseItems.CHEESE_LEGGINGS, 0);
	registerItemModel(CheeseItems.CHEESE_BOOTS, 0);

	registerBlockModel(CheeseBlocks.CHEESE_ORE, 0);
	registerBlockModel(CheeseBlocks.CHEESE_ORE_NETHER, 0);
	registerBlockModel(CheeseBlocks.CHEESE_ORE_END, 0);
	registerBlockModel(CheeseBlocks.CHEESE_BLOCK, 0);
	registerBlockModel(CheeseBlocks.QUICK_CHEESE, 0);
	registerBlockModel(CheeseBlocks.COMPLIMENT_MACHINE, 0);
	registerBlockModel(CheeseBlocks.BELGIUM_FLAG, 0);
}

public void renderEntities() {
	RenderingRegistry.registerEntityRenderingHandler(EntityCheeseCow.class, new RenderingHandlerCheeseCow());
}

private void registerItemModel(Item item, int meta) {
	ModelLoader.setCustomModelResourceLocation(item, meta, new ModelResourceLocation(item.getRegistryName(), "inventory"));
}

private void registerBlockModel(Block block, int meta) {
	ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(block), meta, new ModelResourceLocation(block.getRegistryName(), "inventory"));
}
}

Posted

Renderer:

package com.Egietje.degeweldigemod.mobs;

import com.Egietje.degeweldigemod.Reference;
import com.Egietje.degeweldigemod.mobs.EntityCheeseCow;

import net.minecraft.client.model.ModelBase;
import net.minecraft.client.renderer.entity.RenderLiving;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

@SideOnly(Side.CLIENT)
public class RenderCheeseCow extends RenderLiving<EntityCheeseCow> {
private static final ResourceLocation CHEESE_COW_TEXTURES = new ResourceLocation(Reference.MODID + ":entity/cheesecow.png");

public RenderCheeseCow(RenderManager renderManagerIn, ModelBase modelBaseIn, float shadowSizeIn) {
	super(renderManagerIn, modelBaseIn, shadowSizeIn);
}

protected ResourceLocation getEntityTexture(EntityCheeseCow entity) {
	return CHEESE_COW_TEXTURES;
}
}

Model:

package com.Egietje.degeweldigemod.mobs;

import net.minecraft.client.model.ModelQuadruped;
import net.minecraft.client.model.ModelRenderer;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

@SideOnly(Side.CLIENT)
public class ModelCheeseCow extends ModelQuadruped {
public ModelCheeseCow() {
	super(12, 0.0F);
	this.head = new ModelRenderer(this, 0, 0);
	this.head.addBox(-4.0F, -4.0F, -6.0F, 8, 8, 6, 0.0F);
	this.head.setRotationPoint(0.0F, 4.0F, -8.0F);
	this.head.setTextureOffset(22, 0).addBox(-5.0F, -5.0F, -4.0F, 1, 3, 1, 0.0F);
	this.head.setTextureOffset(22, 0).addBox(4.0F, -5.0F, -4.0F, 1, 3, 1, 0.0F);
	this.body = new ModelRenderer(this, 18, 4);
	this.body.addBox(-6.0F, -10.0F, -7.0F, 12, 18, 10, 0.0F);
	this.body.setRotationPoint(0.0F, 5.0F, 2.0F);
	this.body.setTextureOffset(52, 0).addBox(-2.0F, 2.0F, -8.0F, 4, 6, 1);
	--this.leg1.rotationPointX;
	++this.leg2.rotationPointX;
	this.leg1.rotationPointZ += 0.0F;
	this.leg2.rotationPointZ += 0.0F;
	--this.leg3.rotationPointX;
	++this.leg4.rotationPointX;
	--this.leg3.rotationPointZ;
	--this.leg4.rotationPointZ;
	this.childZOffset += 2.0F;
}
}

Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

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