Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 04/30/17 in all areas

  1. I explain how to use nullability annotations to help avoid null ItemStacks here.
    2 points
  2. Oh jesus. Get Eclipse. It's freaking free. Or IntelliJ. You wouldn't use Notepad++ to edit a website, so why are you doing it for Java?
    1 point
  3. Just have the server send a packet to the player's client in PlayerEvent.PlayerLoggedInEvent. There shouldn't be any need for a request packet here.
    1 point
  4. http://mcforge.readthedocs.io/en/latest/gettingstarted/
    1 point
  5. I fixed this. @SubscribeEvent public void onQuit(ClientDisconnectionFromServerEvent event) { } @SubscribeEvent public void onQuit(ClientDisconnectionFromServerEvent event) { }
    1 point
  6. Look at the way it is done in vanilla (you will mostly be looking at the ContainerWorkbench). The craftMatrix field, slot initialization and the onCraftMatrixChanged are the things that you will need to build your own functional "crafting container". The most difficult part of it I guess is the CraftingManager as you have mentioned, but you could create a new recipe class that will implement IRecipe, have a Shaped/ShapelessOreRecipe stored in there for the 3x3 matrix and a string representing the oredict id of your pan/whatever you want the recipe to work with. Then you would add your recipes to some kind of array/list so in your container you could iterate through them to find the matching one. You do not need the full functionality of the CraftingManager class But it still would be a good idea to implement those which are related to crafting. Sounds confusing enough? Here is a very simple example: public class YourRecipe implements IRecipe { public final IRecipe craftMatrixRecipe; public final String penItem; ... public YourRecipe(...){...} public boolean matches(InventoryCrafting inv, ItemStack fryingPenItemStack, World w) { return yourCheckThatFryingPenItemStackParamIsThePenItemYouWant && this.craftMatrixRecipe.matches(inv, w); } ...All other implemented methods. You can see how they are handled in vanilla & forge recipes. There is nothing special to them } public class SimpleCraftingManager { public static List<YourRecipe> allMyRecipes = Lists.newArrayList(); public static void register(YourRecipe rec) { allMyRecipes.add(rec); } public static ItemStack findMatchingRecipe(InventoryCrafting craftMatrix, ItemStack penItem, World worldIn) { for (YourRecipe rec : allMyRecipes) { if (rec.matches(craftMatrix, penItem, worldIn)) { return rec; } } return ItemStack.EMPTY; } ...All other implemented methods you need } Or you could even make your instance of InventoryMatrix have a not 3x3 height/width and have 1 less method as you will be able to use the regular IRecipe::matches In your container then you would simply reference your CraftingManager instead of vanilla's. Note that if you want NEI/JEI/Whatever integration you will need your own handlers for that.
    1 point
  7. Something on line 435 of TileHunterBench was null when you tried to access a field or call a method on it. If you don't know what was null, set a breakpoint on that line and run Minecraft in debug mode. When the breakpoint is hit, look at the values used on that line to see which is null.
    1 point
×
×
  • Create New...

Important Information

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