• Recently Browsing

    No registered users viewing this page.

  • Posts

    • Hi all! For my mod I have a custom furnace called the Obsidian Forge which is used to smelt higher tier ores that can't be smelted in a regular furnace. However, I'm having trouble with making custom recipe JSONs to be used for the forge. I made an ObsidianForgeRecipe class and an ObsidianForgeRecipeSerializer class and they both have no errors when I load up a world, but it says '[Render thread/WARN] [minecraft/ClientRecipeBook]: Unknown recipe category: minecraft:obsidian_forge/majcraft:obsidian_forge' which means that my custom recipe type must not have been properly registered, but how do I do that? Here is my Obsidian Forge class: public class ObsidianForgeRecipe implements IRecipe<RecipeWrapper> { public static final IRecipeType<ObsidianForgeRecipe> obsidian_forge = IRecipeType.register("obsidian_forge"); private final IRecipeType<?> type; private final ResourceLocation id; final String group; final Ingredient ingredient; final ItemStack result; final int cookTime; public ObsidianForgeRecipe(ResourceLocation resourceLocation, String group, Ingredient ingredient, ItemStack result, int cookTime) { type = obsidian_forge; id = resourceLocation; this.group = group; this.ingredient = ingredient; this.result = result; this.cookTime = cookTime; } @Override public boolean matches(RecipeWrapper inv, World worldIn) { return this.ingredient.test(inv.getStackInSlot(0)); } @Override public ItemStack getCraftingResult(RecipeWrapper inv) { return this.result.copy(); } @Override public boolean canFit(int width, int height) { return true; } @Override public ItemStack getRecipeOutput() { return result; } @Override public ResourceLocation getId() { return id; } @Override public IRecipeSerializer<?> getSerializer() { return ModRecipeSerializers.OBSIDIAN_FORGE; } @Override public IRecipeType<?> getType() { return type; } @Override public NonNullList<Ingredient> getIngredients() { NonNullList<Ingredient> nonnulllist = NonNullList.create(); nonnulllist.add(this.ingredient); return nonnulllist; } @Override public ItemStack getIcon() { return new ItemStack(ModBlocks.OBSIDIAN_FORGE.get()); } public int getCookTime() { return cookTime; } } and here is my ObsidianForgeRecipeSerializer class: public class ObsidianForgeRecipeSerializer<T extends ObsidianForgeRecipe> extends net.minecraftforge.registries.ForgeRegistryEntry<IRecipeSerializer<?>> implements IRecipeSerializer<T> { private final ObsidianForgeRecipeSerializer.IFactory<T> factory; public ObsidianForgeRecipeSerializer(ObsidianForgeRecipeSerializer.IFactory<T> factory) { this.factory = factory; } @Override @Nonnull public T read(@Nonnull ResourceLocation recipeId, @Nonnull JsonObject json) { // group String groupString = JSONUtils.getString(json, "group", ""); // ingredient JsonElement ingredientJSON = JSONUtils.isJsonArray(json, "ingredient") ? JSONUtils.getJsonArray(json, "ingredient") : JSONUtils.getJsonObject(json, "ingredient"); Ingredient ingredient = Ingredient.deserialize(ingredientJSON); // result ItemStack resultItemStack; if (!json.has("result")) { resultItemStack = ItemStack.EMPTY; } else if (json.get("result").isJsonObject()) { resultItemStack = ShapedRecipe.deserializeItem(JSONUtils.getJsonObject(json, "result")); } else { String resultString = JSONUtils.getString(json, "result"); ResourceLocation resultRS = new ResourceLocation(resultString); resultItemStack = new ItemStack(ForgeRegistries.ITEMS.getValue(resultRS)); } // cookTime int cookTime = JSONUtils.getInt(json, "furnaceTime", 200); return this.factory.create(recipeId, groupString, ingredient, resultItemStack, cookTime); } @Nullable @Override public T read(@Nonnull ResourceLocation recipeId, PacketBuffer buffer) { // group String groupString = buffer.readString(32767); // ingredient Ingredient ingredient = Ingredient.read(buffer); // result ItemStack itemstack = buffer.readItemStack(); // cookTime int cookTime = buffer.readVarInt(); return this.factory.create(recipeId, groupString, ingredient, itemstack, cookTime); } @Override public void write(PacketBuffer buffer, T recipe) { // group buffer.writeString(recipe.group); // ingredient recipe.ingredient.write(buffer); // result buffer.writeItemStack(recipe.result); // cookTime buffer.writeVarInt(recipe.cookTime); } public interface IFactory<T extends ObsidianForgeRecipe> { T create(ResourceLocation resourceLocation, String group, Ingredient ingredient, ItemStack result, int cookTime); } } link to my github: https://github.com/majesityreal/MajCraft Thank you for your time and help!
    • Please learn basic Java before writing mods.
    • I opend my minecraft launcher and i was about to click "play" until my laptop shutdown from lowbattery. As i restarted my laptop, i went back to minecraft launcher and clicked "play". The window changed to white and then gray and it went back to the menu while on the screen it said "game has crashed". I reinstalled minecraft and even Forge (also took all the mods out of mod file) but it still kept crashing. Forge worked before this and now it just crashes everytime i try to play with it.   Is there anyway to fix this?
    • Hello again, after a long time I got back onto this issue. I tried many things, and currently I found this function "this.setMotion(this.getMotion().add(0.0D, 0.08D, 0.0D));". But it still doesnt work, the entity just doesnt move and stays in air. Yes I tried changing the value to see if it was counter balanced by another use of this function in the code, but still nothing. package com.maxandcarl.inan.entities; import net.minecraft.entity.EntityType; import net.minecraft.entity.item.FallingBlockEntity; import net.minecraft.world.World; public class EndGravelBlockEntity extends FallingBlockEntity{ @Override public void tick() { this.setMotion(this.getMotion().add(0.0D, 0.08D, 0.0D)); } public EndGravelBlockEntity(EntityType<? extends FallingBlockEntity> type, World worldIn) { super(type, worldIn); } }  
  • Topics

  • Who's Online (See full list)