Jump to content

[1.7.2] What ever happened to the ICraftingHandler?


Mitchellbrine

Recommended Posts

So, as I was working on doing some achievement based stuff for my mod, I tried to create a crafting handler. Upon doing so, I noticed that ICraftingHandler is no longer an interface.

 

Just wondering if anyone knows what it was replaced by or what I can use to get the same functionality? An event, possibly?

 

Thanks in advance!

-Mitchellbrine

 

Minecraft can do ANYTHING, it's coded in Java and you got the full power of Java behind you when you code. So nothing is impossible.

It may be freaking fucking hard though, but still possible ;)

 

If you create a topic on Modder Support, live by this motto:

I don't want your charity, I want your information
Link to comment
Share on other sites

Funny, when I remembered the crafting handlers, I had always wanted a way of cancelling them. Thanks diesieben07!

-Mitchellbrine

 

Minecraft can do ANYTHING, it's coded in Java and you got the full power of Java behind you when you code. So nothing is impossible.

It may be freaking fucking hard though, but still possible ;)

 

If you create a topic on Modder Support, live by this motto:

I don't want your charity, I want your information
Link to comment
Share on other sites

Um, diesieben, I'm having a bit of issues with the fact that the event is not working. I have it with a @SubscribeEvent, but it doesn't seem to even run the event.

-Mitchellbrine

 

Minecraft can do ANYTHING, it's coded in Java and you got the full power of Java behind you when you code. So nothing is impossible.

It may be freaking fucking hard though, but still possible ;)

 

If you create a topic on Modder Support, live by this motto:

I don't want your charity, I want your information
Link to comment
Share on other sites

Thanks, Alias, but I already got that part. It still doesn't work after I register it.

-Mitchellbrine

 

Minecraft can do ANYTHING, it's coded in Java and you got the full power of Java behind you when you code. So nothing is impossible.

It may be freaking fucking hard though, but still possible ;)

 

If you create a topic on Modder Support, live by this motto:

I don't want your charity, I want your information
Link to comment
Share on other sites

Okay, here are the classes. I would link you to my repository, but I'd have to add you to it on BitBucket (it's private while I'm updating).

 

So here they are:

 

Here's my MainMod class (Sorry it's so long, It's a big mod)

 

package mc.Mitchellbrine.anchormanMod.common.core;

import mc.Mitchellbrine.anchormanMod.common.block.CarpetFormer;
import mc.Mitchellbrine.anchormanMod.common.block.CarpetFormerFilled;
import mc.Mitchellbrine.anchormanMod.common.block.DawnSummoner;
import mc.Mitchellbrine.anchormanMod.common.block.DispenserBehaviorAddition;
import mc.Mitchellbrine.anchormanMod.common.block.DispenserBehaviorWool;
import mc.Mitchellbrine.anchormanMod.common.block.DuskSummoner;
import mc.Mitchellbrine.anchormanMod.common.block.EmptyBlock;
import mc.Mitchellbrine.anchormanMod.common.block.ExperienceCarpet;
import mc.Mitchellbrine.anchormanMod.common.block.FarmCarpet;
import mc.Mitchellbrine.anchormanMod.common.block.LaunchCarpet;
import mc.Mitchellbrine.anchormanMod.common.block.MidnightSummoner;
import mc.Mitchellbrine.anchormanMod.common.block.NetherCarpet;
import mc.Mitchellbrine.anchormanMod.common.block.NoonSummoner;
import mc.Mitchellbrine.anchormanMod.common.block.RainSummoner;
import mc.Mitchellbrine.anchormanMod.common.block.SpawnSummoner;
import mc.Mitchellbrine.anchormanMod.common.block.ThunderSummoner;
import mc.Mitchellbrine.anchormanMod.common.block.WelcomeCarpet;
import mc.Mitchellbrine.anchormanMod.common.block.WelcomeCarpet1;
import mc.Mitchellbrine.anchormanMod.common.block.WelcomeCarpet2;
import mc.Mitchellbrine.anchormanMod.common.block.WelcomeCarpet3;
import mc.Mitchellbrine.anchormanMod.common.event.CraftingHandler;
import mc.Mitchellbrine.anchormanMod.common.event.LivingMagicalMurderEvent;
import mc.Mitchellbrine.anchormanMod.common.item.Needle;
import mc.Mitchellbrine.anchormanMod.common.item.NeedleWithThread;
import mc.Mitchellbrine.anchormanMod.common.tileentity.TileEntityCarpetFormer;
import mc.Mitchellbrine.anchormanMod.common.tileentity.TileEntityCarpetFormerFilled;
import mc.Mitchellbrine.anchormanMod.common.tileentity.TileEntityDawnCarpet;
import mc.Mitchellbrine.anchormanMod.common.tileentity.TileEntityDuskCarpet;
import mc.Mitchellbrine.anchormanMod.common.tileentity.TileEntityExpCarpet;
import mc.Mitchellbrine.anchormanMod.common.tileentity.TileEntityFarmCarpet;
import mc.Mitchellbrine.anchormanMod.common.tileentity.TileEntityLaunchCarpet;
import mc.Mitchellbrine.anchormanMod.common.tileentity.TileEntityMidnightCarpet;
import mc.Mitchellbrine.anchormanMod.common.tileentity.TileEntityNetherCarpet;
import mc.Mitchellbrine.anchormanMod.common.tileentity.TileEntityNoonCarpet;
import mc.Mitchellbrine.anchormanMod.common.tileentity.TileEntityRainCarpet;
import mc.Mitchellbrine.anchormanMod.common.tileentity.TileEntitySpawnCarpet;
import mc.Mitchellbrine.anchormanMod.common.tileentity.TileEntityThunderCarpet;
import mc.Mitchellbrine.anchormanMod.common.tileentity.TileEntityWelcomeCarpet;
import mc.Mitchellbrine.anchormanMod.common.tileentity.TileEntityWelcomeCarpet1;
import mc.Mitchellbrine.anchormanMod.common.tileentity.TileEntityWelcomeCarpet2;
import mc.Mitchellbrine.anchormanMod.common.tileentity.TileEntityWelcomeCarpet3;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.stats.Achievement;
import net.minecraftforge.common.AchievementPage;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.oredict.OreDictionary;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.registry.GameRegistry;

@Mod(modid = "weatherManMod", name = "Weather Carpets Mod", version = "DEV BUILD", useMetadata = true)
public class MainMod {

@SidedProxy(clientSide = "mc.Mitchellbrine.anchormanMod.client.core.ClientProxy", serverSide = "mc.Mitchellbrine.anchormanMod.common.core.CommonProxy")
public static CommonProxy proxy;

public static String MOD_ID = "anchorman";


public static CreativeTabs ModTab = new ModTab(CreativeTabs.getNextID(), "weatherCarpetDev");
//	public static CreativeTabs ModTab = new ModTab(CreativeTabs.getNextID(), "weatherCarpet");
//	public static CreativeTabs ModTab = new ModTab(CreativeTabs.getNextID(), "weatherCarpetBeta");


public static int versionType = 1;

// Config Ids

public static int rSID;
public static int tSID;
public static int nSID;
public static int mSID;
public static int daSID;
public static int duSID;
public static int sSID;
public static int lCID;
public static int welcomeMatNorthID;
public static int welcomeMatEastID;
public static int welcomeMatSouthID;
public static int welcomeMatWestID;
public static int expCID;
public static int mW;
public static int mW2;
public static int mDW;
public static int mNW;
public static int bMID;
public static int fCID;
public static int mP;
public static int mP2;
public static int mDP;
public static int mNP;
public static int hSID;	

// Carpet Former

public static Block carpetFormer;
public static Block carpetFormerFilled;

// Carpets

public static Block rainSummoner;
public static Block thunderSummoner;
public static Block noonSummoner;
public static Block midnightSummoner;
public static Block dawnSummoner;
public static Block duskSummoner;
public static Block spawnSummoner;
public static Block launcherCarpet;
public static Block welcomeMat;
public static Block welcomeMatEast;
public static Block welcomeMatSouth;
public static Block welcomeMatWest;
public static Block expCarpet;
public static Block bonemealBlock;
public static Block farmCarpet;
public static Block netherCarpet;

// Wool

public static Block magicalWool;
public static Block magicalWool2;

public static Block magicalDayWool;
public static Block magicalNightWool;

// Pearls

public static Item magicalPearl;
public static Item magicalPearl2;

public static Item magicalDayPearl;
public static Item magicalNightPearl;

public static Item needle;
public static Item needleWithThread;

public static String lastStableVersion = "1.0.0";
public static String lastBetaVersion = "N/A";
public static String lastDevVersion = "14w09a";

// Skill System

public static Achievement weaving;
public static Achievement carpetCreation;
public static Achievement linearMastery;

public static AchievementPage weatherCarpetsPage;

// Misc Integers

public static int versionChannel;
public static int over9000Enabled;
public static int isUserValidated;
public static boolean stopBuggingMe;
public static boolean legacyRecipes;
public static int notified = 0;

@EventHandler
public void preInit(FMLPreInitializationEvent event)
{
Configuration config = new Configuration(event.getSuggestedConfigurationFile());

config.load();

//	rSID = config.get(Configuration.CATEGORY_GENERAL, "rS", 230).getInt();
//	tSID = config.get(Configuration.CATEGORY_GENERAL, "tS", 231).getInt();
//	nSID = config.get(Configuration.CATEGORY_GENERAL, "nS", 232).getInt();
//	mSID = config.get(Configuration.CATEGORY_GENERAL, "mS", 234).getInt();
//	daSID = config.get(Configuration.CATEGORY_GENERAL, "daS", 235).getInt();
//	duSID = config.get(Configuration.CATEGORY_GENERAL, "duS", 236).getInt();
//	sSID = config.get(Configuration.CATEGORY_GENERAL, "sS", 237).getInt();
//	lCID = config.get(Configuration.CATEGORY_GENERAL, "lC", 238).getInt();
//	welcomeMatNorthID = config.get(Configuration.CATEGORY_GENERAL, "wM", 239).getInt();
//	welcomeMatEastID = config.get(Configuration.CATEGORY_GENERAL, "wM1", 240).getInt();
//	welcomeMatSouthID = config.get(Configuration.CATEGORY_GENERAL, "wM2", 241).getInt();
//	welcomeMatWestID = config.get(Configuration.CATEGORY_GENERAL, "wM3", 242).getInt();
//	expCID = config.get(Configuration.CATEGORY_GENERAL, "expC", 243).getInt();
//	fCID = config.get(Configuration.CATEGORY_GENERAL, "fC", 244).getInt();
//	hSID = config.get(Configuration.CATEGORY_GENERAL, "hSID", 250).getInt();

//	mW = config.get(Configuration.CATEGORY_GENERAL, "mW", 245).getInt();
//	mW2 = config.get(Configuration.CATEGORY_GENERAL, "mW2", 246).getInt();
//	mDW = config.get(Configuration.CATEGORY_GENERAL, "mdW", 247).getInt();
//	mNW = config.get(Configuration.CATEGORY_GENERAL, "mNW", 248).getInt();
//	bMID = config.get(Configuration.CATEGORY_GENERAL, "bM", 249).getInt();

//	mP = config.get(Configuration.CATEGORY_GENERAL, "mP", 4000).getInt();
//	mP2 = config.get(Configuration.CATEGORY_GENERAL, "mP2", 4001).getInt();
//	mDP = config.get(Configuration.CATEGORY_GENERAL, "mDP", 4002).getInt();
//	mNP = config.get(Configuration.CATEGORY_GENERAL, "mNP", 4003).getInt();

config.addCustomCategoryComment(Configuration.CATEGORY_GENERAL, "These are values for the new AutoUpdate Checker and the new logged in messages. Personally, I would turn stopBuggingMe to true almost immediately! ;P");

versionChannel = config.get(Configuration.CATEGORY_GENERAL, "versionChannel", 0).getInt();
over9000Enabled = config.get(Configuration.CATEGORY_GENERAL, "enableOver9000", 1).getInt();
stopBuggingMe = config.get(Configuration.CATEGORY_GENERAL, "stopBuggingMe", false).getBoolean(false);
legacyRecipes = config.get(Configuration.CATEGORY_GENERAL, "enableLegacyCarpetRecipes", false).getBoolean(false);

config.save();

carpetFormer = new CarpetFormer().setCreativeTab(ModTab).setBlockName("carpetFormer").setBlockTextureName("anchorman:cFIcon");
carpetFormerFilled = new CarpetFormerFilled().setBlockName("carpetFormerFilled").setBlockTextureName("anchorman:cFIcon");

rainSummoner = new RainSummoner().setCreativeTab(ModTab).setBlockName("rainSummoner").setBlockTextureName("anchorman:rSIcon");
thunderSummoner = new ThunderSummoner().setCreativeTab(ModTab).setBlockName("thunderSummoner").setBlockTextureName("anchorman:tSIcon");
noonSummoner = new NoonSummoner().setCreativeTab(ModTab).setBlockName("noonSummoner").setBlockTextureName("anchorman:nSIcon");
midnightSummoner = new MidnightSummoner().setCreativeTab(ModTab).setBlockName("midnightSummoner").setBlockTextureName("anchorman:mSIcon");
dawnSummoner = new DawnSummoner().setCreativeTab(ModTab).setBlockName("dawnSummoner").setBlockTextureName("anchorman:daSIcon");
duskSummoner = new DuskSummoner().setCreativeTab(ModTab).setBlockName("duskSummoner").setBlockTextureName("anchorman:duSIcon");
spawnSummoner = new SpawnSummoner().setCreativeTab(ModTab).setBlockName("spawnSummoner").setBlockTextureName("anchorman:sSIcon");
launcherCarpet = new LaunchCarpet().setCreativeTab(ModTab).setBlockName("launchCarpet").setBlockTextureName("anchorman:lIcon");
welcomeMat = new WelcomeCarpet().setCreativeTab(ModTab).setBlockName("welcomeMat").setBlockTextureName("anchorman:wIcon");
welcomeMatEast = new WelcomeCarpet1().setBlockName("welcomeMatEast").setBlockTextureName("anchorman:wIcon");
welcomeMatSouth = new WelcomeCarpet2().setBlockName("welcomeMatSouth").setBlockTextureName("anchorman:wIcon");
welcomeMatWest =  new WelcomeCarpet3().setBlockName("welcomeMatWest").setBlockTextureName("anchorman:wIcon");
expCarpet = new ExperienceCarpet().setCreativeTab(ModTab).setBlockName("expSummoner").setBlockTextureName("anchorman:expIcon");
farmCarpet = new FarmCarpet().setCreativeTab(ModTab).setBlockName("farmSummoner").setBlockTextureName("anchorman:fIcon");
netherCarpet = new NetherCarpet().setCreativeTab(ModTab).setBlockName("netherSummoner").setBlockTextureName("anchorman:hIcon");

magicalWool = new EmptyBlock(Material.cloth).setHardness(0.8F).setStepSound(Block.soundTypeCloth).setCreativeTab(ModTab).setBlockName("magicalWool").setBlockTextureName("anchorman:magicalWool");
magicalWool2 = new EmptyBlock(Material.cloth).setHardness(0.8F).setStepSound(Block.soundTypeCloth).setCreativeTab(ModTab).setBlockName("boundMagicalWool").setBlockTextureName("anchorman:boundMagicalWool");
magicalDayWool = new EmptyBlock(Material.cloth).setHardness(0.8F).setStepSound(Block.soundTypeCloth).setCreativeTab(ModTab).setBlockName("dayWool").setBlockTextureName("anchorman:dayWool");
magicalNightWool = new EmptyBlock(Material.cloth).setHardness(0.8F).setStepSound(Block.soundTypeCloth).setCreativeTab(ModTab).setBlockName("nightWool").setBlockTextureName("anchorman:nightWool");
bonemealBlock = new EmptyBlock(Material.plants).setHardness(4.0F).setCreativeTab(ModTab).setBlockName("boneMeal").setBlockTextureName("boneMeal").setBlockTextureName("anchorman:boneMealBlock");

magicalPearl = new Item().setCreativeTab(ModTab).setUnlocalizedName("magicalPearl").setTextureName("anchorman:" + "magicalPearl");
magicalPearl2 = new Item().setCreativeTab(ModTab).setUnlocalizedName("boundMagicalPearl").setTextureName("anchorman:" + "magicalPearl2");
magicalDayPearl = new Item().setCreativeTab(ModTab).setUnlocalizedName("magicalDayPearl").setTextureName("anchorman:" + "magicalDayPearl");
magicalNightPearl = new Item().setCreativeTab(ModTab).setUnlocalizedName("magicalNightPearl").setTextureName("anchorman:"+ "magicalNightPearl");

needle = new Needle().setCreativeTab(ModTab).setUnlocalizedName("needle").setTextureName("anchorman:needle");
needleWithThread = new NeedleWithThread().setCreativeTab(ModTab).setUnlocalizedName("needleWithThread").setTextureName("anchorman:needleThread");

GameRegistry.registerBlock(rainSummoner, "anchorman:rainSummoner");
GameRegistry.registerBlock(thunderSummoner, "anchorman:thunderSummoner");
GameRegistry.registerBlock(noonSummoner, "anchorman:noonSummoner");
GameRegistry.registerBlock(midnightSummoner, "anchorman:midnightSummoner");
GameRegistry.registerBlock(dawnSummoner, "anchorman:dawnSummoner");
GameRegistry.registerBlock(duskSummoner, "anchorman:duskSummoner");
GameRegistry.registerBlock(spawnSummoner, "anchorman:spawnSummoner");
GameRegistry.registerBlock(launcherCarpet, "anchorman:launchCarpet");
GameRegistry.registerBlock(welcomeMat, "anchorman:welcomeMat");
GameRegistry.registerBlock(welcomeMatEast, "anchorman:welcomeMatEast");
GameRegistry.registerBlock(welcomeMatSouth, "anchorman:welcomeMatSouth");
GameRegistry.registerBlock(welcomeMatWest, "anchorman:welcomeMatWest");
GameRegistry.registerBlock(farmCarpet, "anchorman:farmSummoner");
GameRegistry.registerBlock(netherCarpet, "anchorman:netherCarpet");
GameRegistry.registerBlock(expCarpet, "anchorman:expSummoner");
GameRegistry.registerBlock(carpetFormer, "anchorman:carpetFormer");
GameRegistry.registerBlock(carpetFormerFilled, "anchorman:carpetFormerFilled");
GameRegistry.registerBlock(magicalWool, "anchorman:magicalWool");
GameRegistry.registerBlock(magicalWool2, "anchorman:boundMagicalWool");
GameRegistry.registerBlock(magicalDayWool, "anchorman:magicalDayWool");
GameRegistry.registerBlock(magicalNightWool, "anchorman:magicalNightWool");
GameRegistry.registerBlock(bonemealBlock, "anchorman:boneMeal");

GameRegistry.registerItem(magicalPearl, "anchorman:magicalPearl");
GameRegistry.registerItem(magicalPearl2, "anchorman:boundMagicalPearl");
GameRegistry.registerItem(magicalDayPearl, "anchorman:magicalDayPearl");
GameRegistry.registerItem(magicalNightPearl, "anchorman:magicalNightPearl");
GameRegistry.registerItem(needle, "anchorman:needle");
GameRegistry.registerItem(needleWithThread, "anchorman:needleWithThread");

weaving = new Achievement("weaving", "weaving", 0, 0, needle, (Achievement)null).initIndependentStat();
carpetCreation = new Achievement("carpet", "carpet", 2, 0, MainMod.carpetFormer, weaving).registerStat();
linearMastery = new Achievement("linear", "linear", 4, 0, MainMod.magicalDayPearl, carpetCreation).registerStat();

    weatherCarpetsPage = new AchievementPage("Weather Carpets", new Achievement[] {weaving, carpetCreation, linearMastery});

}

@EventHandler
public void init(FMLInitializationEvent event)
{

	OreDictionary.registerOre(bMID, bonemealBlock);

	MinecraftForge.EVENT_BUS.register(new LivingMagicalMurderEvent());
	MinecraftForge.EVENT_BUS.register(new CraftingHandler());

	GameRegistry.registerTileEntity(TileEntityRainCarpet.class, "anchorman:rainCarpet");
	GameRegistry.registerTileEntity(TileEntityThunderCarpet.class, "anchorman:thunderCarpet");
	GameRegistry.registerTileEntity(TileEntityNoonCarpet.class, "anchorman:noonCarpet");
	GameRegistry.registerTileEntity(TileEntityMidnightCarpet.class, "anchorman:midnightCarpet");
	GameRegistry.registerTileEntity(TileEntityDawnCarpet.class, "anchorman:dawnCarpet");
	GameRegistry.registerTileEntity(TileEntityDuskCarpet.class, "anchorman:duskCarpet");
	GameRegistry.registerTileEntity(TileEntitySpawnCarpet.class, "anchorman:spawnCarpet");
	GameRegistry.registerTileEntity(TileEntityLaunchCarpet.class, "anchorman:launchCarpet");
	GameRegistry.registerTileEntity(TileEntityWelcomeCarpet.class, "anchorman:welcomeCarpet");
	GameRegistry.registerTileEntity(TileEntityWelcomeCarpet1.class, "anchorman:welcomeCarpet1");
	GameRegistry.registerTileEntity(TileEntityWelcomeCarpet2.class, "anchorman:welcomeCarpet2");
	GameRegistry.registerTileEntity(TileEntityWelcomeCarpet3.class, "anchorman:welcomeCarpet3");
	GameRegistry.registerTileEntity(TileEntityExpCarpet.class, "anchorman:expCarpet");
	GameRegistry.registerTileEntity(TileEntityFarmCarpet.class, "anchorman:farmCarpet");
	GameRegistry.registerTileEntity(TileEntityNetherCarpet.class, "anchorman:netherCarpet");
	GameRegistry.registerTileEntity(TileEntityCarpetFormer.class, "anchorman:carpetFormerTE");
	GameRegistry.registerTileEntity(TileEntityCarpetFormerFilled.class, "anchorman:carpetFormerFilledTE");

	proxy.registerTileEntities();		

	GameRegistry.addSmelting(magicalPearl, new ItemStack(magicalPearl2, 1), 0.25F);
	GameRegistry.addRecipe(new ItemStack(magicalWool2, 1), "XXX", "XYX", "XXX", Character.valueOf('X'), magicalPearl2,Character.valueOf('Y'), magicalWool);
//		GameRegistry.addRecipe(new ItemStack(rainSummoner, 1), "XXX", "XYX", "XXX", Character.valueOf('X'), magicalWool2, Character.valueOf('Y'), Items.water_bucket);
//		GameRegistry.addRecipe(new ItemStack(thunderSummoner, 1), "XXX", "XYX", "XXX", Character.valueOf('X'), magicalWool2, Character.valueOf('Y'), Blocks.iron_block);
	GameRegistry.addRecipe(new ItemStack(magicalDayWool , 1), "XXX", "XYX", "XXX", Character.valueOf('X'), magicalWool2, Character.valueOf('Y'), magicalDayPearl);
	GameRegistry.addRecipe(new ItemStack(magicalNightWool , 1), "XXX", "XYX", "XXX", Character.valueOf('X'), magicalWool2, Character.valueOf('Y'), magicalNightPearl);
	GameRegistry.addRecipe(new ItemStack(dawnSummoner, 1), "XXX", "XYX", "XXX", Character.valueOf('X'), magicalWool2, Character.valueOf('Y'), magicalDayWool);
	GameRegistry.addRecipe(new ItemStack(duskSummoner, 1), "XXX", "XYX", "XXX", Character.valueOf('X'), magicalWool2, Character.valueOf('Y'), magicalNightWool);
	GameRegistry.addRecipe(new ItemStack(noonSummoner, 1), "XYX", "XXX", "XZX", Character.valueOf('X'), magicalWool2, Character.valueOf('Y'), magicalDayWool, Character.valueOf('Z'), magicalNightWool);
	GameRegistry.addRecipe(new ItemStack(midnightSummoner, 1), "XZX", "XXX", "XYX", Character.valueOf('X'), magicalWool2, Character.valueOf('Y'), magicalDayWool, Character.valueOf('Z'), magicalNightWool);
//		GameRegistry.addRecipe(new ItemStack(spawnSummoner, 1), "XXX", "XYX", "XXX", Character.valueOf('X'), magicalWool2, Character.valueOf('Y'), Items.bed);
//		GameRegistry.addRecipe(new ItemStack(launcherCarpet, 1), "XXX", "XYX", "XXX", Character.valueOf('X'), magicalWool2, Character.valueOf('Y'), Blocks.tnt);
	GameRegistry.addRecipe(new ItemStack(welcomeMat, 1), "XXX", "XYX", "XXX", Character.valueOf('X'), new ItemStack(Blocks.wool, 1, 12), Character.valueOf('Y'), Items.sign);
//		GameRegistry.addRecipe(new ItemStack(expCarpet, 1), "XXX", "XYX", "XXX", Character.valueOf('X'), magicalWool2, Character.valueOf('Y'), Blocks.bookshelf);
	GameRegistry.addRecipe(new ItemStack(bonemealBlock, 1), "XXX", "XXX", "XXX", Character.valueOf('X'), new ItemStack(Items.dye, 1, 15));
//		GameRegistry.addRecipe(new ItemStack(farmCarpet, 1), "XXX", "XYX", "XXX", Character.valueOf('X'), magicalWool2, Character.valueOf('Y'), bonemealBlock);
//		GameRegistry.addRecipe(new ItemStack(netherCarpet, 1), "XXX", "XYX", "XXX", Character.valueOf('X'), magicalWool2, Character.valueOf('Y'), Items.blaze_powder);
	GameRegistry.addRecipe(new ItemStack(needle, 1), "X  "," Y ","  Y", Character.valueOf('X'), Items.leather, Character.valueOf('Y'), Items.iron_ingot);
	GameRegistry.addRecipe(new ItemStack(needle, 1), "Y  "," Y ","  X", Character.valueOf('X'), Items.leather, Character.valueOf('Y'), Items.iron_ingot);

	GameRegistry.addShapelessRecipe(new ItemStack(needleWithThread, 1), MainMod.needle, Items.string);
	GameRegistry.addShapelessRecipe(new ItemStack(Items.dye, 9, 15), bonemealBlock);

	if (MainMod.legacyRecipes == true) {
		GameRegistry.addRecipe(new ItemStack(rainSummoner, 1), "XXX", "XYX", "XXX", Character.valueOf('X'), magicalWool2, Character.valueOf('Y'), Items.water_bucket);
		GameRegistry.addRecipe(new ItemStack(thunderSummoner, 1), "XXX", "XYX", "XXX", Character.valueOf('X'), magicalWool2, Character.valueOf('Y'), Blocks.iron_block);

		GameRegistry.addRecipe(new ItemStack(spawnSummoner, 1), "XXX", "XYX", "XXX", Character.valueOf('X'), magicalWool2, Character.valueOf('Y'), Items.bed);
		GameRegistry.addRecipe(new ItemStack(launcherCarpet, 1), "XXX", "XYX", "XXX", Character.valueOf('X'), magicalWool2, Character.valueOf('Y'), Blocks.tnt);

		GameRegistry.addRecipe(new ItemStack(expCarpet, 1), "XXX", "XYX", "XXX", Character.valueOf('X'), magicalWool2, Character.valueOf('Y'), Blocks.bookshelf);

		GameRegistry.addRecipe(new ItemStack(farmCarpet, 1), "XXX", "XYX", "XXX", Character.valueOf('X'), magicalWool2, Character.valueOf('Y'), bonemealBlock);
		GameRegistry.addRecipe(new ItemStack(netherCarpet, 1), "XXX", "XYX", "XXX", Character.valueOf('X'), magicalWool2, Character.valueOf('Y'), Items.blaze_powder);
	}

	DispenserBehaviorAddition.addDispenserBehavior(MainMod.magicalPearl2, new DispenserBehaviorWool());

	AchievementPage.registerAchievementPage(weatherCarpetsPage);

}
}

 

 

And here's my class for the event:

 

package mc.Mitchellbrine.anchormanMod.common.event;

import mc.Mitchellbrine.anchormanMod.common.core.MainMod;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.PlayerEvent.ItemCraftedEvent;

public class CraftingHandler {

@SubscribeEvent
public void craftingStuff(ItemCraftedEvent event) {
	System.out.println("Checkpoint A");
	if (event.hasResult()) {
	if (!event.player.worldObj.isRemote) {
		System.out.println("Checkpoint B");
	if (event.crafting.getItem() == MainMod.needleWithThread) {
		System.out.println("Checkpoint C");
		event.player.addStat(MainMod.weaving, 1);
		System.out.println("Checkpoint D");
	}
	}
	}
}

}

 

-Mitchellbrine

 

Minecraft can do ANYTHING, it's coded in Java and you got the full power of Java behind you when you code. So nothing is impossible.

It may be freaking fucking hard though, but still possible ;)

 

If you create a topic on Modder Support, live by this motto:

I don't want your charity, I want your information
Link to comment
Share on other sites

Derp... sorry, the PlayerEvent is an FML event, my bad. You have to register it like this:

 

FMLCommonHandler.instance().bus().register(new CraftingHandler());

 

EDIT: It's confusing, because there are multiple PlayerEvents, one for FML, and one for MinecraftForge, so you have to double-check the import you are using and subscribe based on that import. The FML PlayerEvents contain most of what used to be in IPlayerTracker, plus item crafting and smelting events.

Link to comment
Share on other sites

Thank you so much Alias! Just got it to work!

-Mitchellbrine

 

Minecraft can do ANYTHING, it's coded in Java and you got the full power of Java behind you when you code. So nothing is impossible.

It may be freaking fucking hard though, but still possible ;)

 

If you create a topic on Modder Support, live by this motto:

I don't want your charity, I want your information
Link to comment
Share on other sites

Also note that the Item.onCreated() method is called when a new Item of that class is crafted. I would add achievement stuff there for new subclasses of items.

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • It wasnt mappings issue, I was reading fabric and not forge. Fabric has PlayerEntity while forge has Player. Through a mixin I was able to change the player's velocity so that there is a sort of slow-motion type movement. Only issue is that jumping seems to be handled separately. Changing that velocity only makes the jump lower, not slower. Unsure how to increase the duration in which a jump happens.   @Mixin(LivingEntity.class) public abstract class ExampleMixin extends Entity { public ExampleMixin(EntityType<?> type, World world) { super(type, world); } @Inject(method = "tickMovement", at = @At("HEAD")) private void onTickMovement(CallbackInfo ci) { // Access the player entity LivingEntity entity = (LivingEntity)(Object)this; // Modify player's acceleration by applying a force in the opposite direction double slowdownFactor = 0.75; // Adjust as needed entity.setVelocity(entity.getVelocity().multiply(1, slowdownFactor, 1)); } }  
    • Hi so i made a modded survival, and when i go to the page 13 of my JEI,  my game instant crash and give this error "The game crashed whilst rendering item Error", I don't know what to do i give you the crash report : https://pastebin.com/EhzYdEZg
    • You need to run build at least once before running the game for the first time in a dev environment. Make sure stuff's working *before* you start making changes to the mdk template
    • Greetings, people of the forge forums: I come to you in a time of need. While creating my silly block entity that is (in theory) supposed to point to a position within world space I've started to question how to actually implement it.   How would I get a tile entity element (or bone) to change its pitch/yaw/roll? While I do have prior experience with programming, I have no actual experience with the forge API except the things listed in its docs. Please correct me if I am in any way wrong.
    • Making my own screen by extending from net.minecraft.client.gui.screens.Screen and override render method. I am trying to make green square only to be visible when intersecting with red square. This is what I got so far: @Override public void render(PoseStack poseStack, int mx, int my, float partialTick) {     RenderSystem.enableDepthTest(); // Red square     GuiComponent.fill(pPoseStack, 32, 32, 64, 64, 0xFFFF0000);     RenderSystem.depthFunc(GlConst.GL_LEQUAL); // Green square     GuiComponent.fill(pPoseStack, mx-16, my-16, mx+16, my+16, 0xFF00FF00); } Thank you in advance.
  • Topics

×
×
  • Create New...

Important Information

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