Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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.

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.