Jump to content

Crop Wont Display or Trample Properly.


gmod622

Recommended Posts

Hello all!

So I was messing around with creating a crop, and I ran into an interesting 'error'. Reason I quote that, is because the console says nothing about missing textures or .json. So I'm a bit stuck, and getting into game, I found out that jumping on the crop, won't trample it, but the tilled soil will disappear.

[NOTE:] The Code is messy and uncommented, due to this being a test project! As well, I know there is already 'melon' in the game, again, testing.

 

 

ModelHandler:

 

 

package com.lambda.PlentifulMisc.main.item;

import net.minecraft.item.Item;

public interface ItemModelProvider {

void registerItemModel(Item item);

}

 

 

 

Main Class Pre-Init ( Only thing that I changed )

 

 

 


@EventHandler
public void preInit(FMLPreInitializationEvent event)
{
System.out.println("[Plentiful Misc] Plentiful Misc is loading!");
System.out.println("[Plentiful Misc] Thanks for downloading!");

System.out.println("[Plentiful Misc] Initializing Blocks!");
ModBlocks.init();
System.out.println("[Plentiful Misc] Initializing Items!");
ModItems.init();


}

 

 

 

Watermelon Seed-Block Class

 

 

 

 

package com.lambda.PlentifulMisc.main.block;

import com.lambda.PlentifulMisc.main.item.ModItems;

import net.minecraft.block.BlockCrops;
import net.minecraft.item.Item;

public class PMBlkCropWatermelon extends BlockCrops {

public PMBlkCropWatermelon() {
	setUnlocalizedName("pmcropwatermelon");
	setRegistryName("pmcropwatermelon");
}

@Override
protected Item getSeed() {
	return ModItems.watermelonSeed;
}

@Override
protected Item getCrop() {
	return ModItems.watermelon;
}

}

 

 

 

 

ModBlocks Class:

 

 

 

 

package com.lambda.PlentifulMisc.main.block;
import com.lambda.PlentifulMisc.main.item.ItemModelProvider;

import net.minecraft.block.Block;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.ItemBlock;
import net.minecraftforge.fml.common.registry.GameRegistry;

public class ModBlocks {

public static PMOreBase pmXianite;
public static PMBlkCropWatermelon cropWatermelon;

public static void init() {
pmXianite = register(new PMOreBase("pmXianite").setCreativeTab(CreativeTabs.MATERIALS));
cropWatermelon = register(new PMBlkCropWatermelon(), null);
}

private static <T extends Block> T register(T block, ItemBlock itemBlock) {
if(itemBlock != null) {
GameRegistry.register(block);
GameRegistry.register(itemBlock);
}

if (block instanceof ItemModelProvider) {
((ItemModelProvider)block).registerItemModel(itemBlock);
}

return block;
}

private static <T extends Block> T register(T block) {
ItemBlock itemBlock = new ItemBlock(block);
itemBlock.setRegistryName(block.getRegistryName());
return register(block, itemBlock);
}

}

 

 

 

 

Watermelon Seed:

 

 

 

package com.lambda.PlentifulMisc.main.item;

import com.lambda.PlentifulMisc.main.PlentifulMisc;
import com.lambda.PlentifulMisc.main.block.ModBlocks;

import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemSeeds;


public class ItemWatermelonSeed extends ItemSeeds implements ItemModelProvider {

public ItemWatermelonSeed() {
	super(ModBlocks.cropWatermelon, Blocks.FARMLAND);
	setUnlocalizedName("pmwatermelonseed");
	setRegistryName("pmwatermelonseed");
}

@Override
public void registerItemModel(Item item) {
	PlentifulMisc.proxy.registerItemRenderer(item, 0, "pmwatermelonseed");
}

}

 

 

 

 

ModItems:

 

 

 

 

 

package com.lambda.PlentifulMisc.main.item;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraftforge.fml.common.registry.GameRegistry;

public class ModItems {

public static PMItemBase cheese;
public static PMItemBase watermelon;
public static ItemWatermelonSeed watermelonSeed;

public static void init() {
cheese = register(new PMItemBase("pmcheese").setCreativeTab(CreativeTabs.FOOD));
watermelonSeed = register(new ItemWatermelonSeed());
watermelon = register(new PMItemBase("pmwatermelon").setCreativeTab(CreativeTabs.FOOD));
}

private static <T extends Item> T register(T item) {
GameRegistry.register(item);

if (item instanceof ItemModelProvider ) {
((ItemModelProvider )item).registerItemModel(item);
}

return item;
}

}

 

 

 

 

 

Not new to java >> New to modding.

Link to comment
Share on other sites

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



×
×
  • Create New...

Important Information

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