Jump to content

BlueFFlame

Members
  • Posts

    14
  • Joined

  • Last visited

  • Days Won

    1

BlueFFlame last won the day on February 14

BlueFFlame had the most liked content!

BlueFFlame's Achievements

Tree Puncher

Tree Puncher (2/8)

1

Reputation

  1. Ah yes, it worked. Thank you for the help! I do have another issue, but I may make another post for that as it's related to recipes rather than models. Thank you again!
  2. Hi, I'm having an issue with my block entities (it's currently two) where the model isn't rendering correctly. Not only is there no texture, but the custom model also isn't there; it appears as the standard Minecraft square. I'm not sure why this is happening, because I used the exact same method for another block entity and the model works perfectly fine. I checked the .json file and it's referencing everything correctly. Even weirder, the item model is completely fine; it's just an issue when I place it. Below I'll send the .json and the Block class of one of the block entities. If you need any more files, I'd be glad to send them! .json file: { "credit": "Made with Blockbench", "texture_size": [128, 128], "textures": { "0": "darkcollective:block/fabricatormk1", "particle": "darkcollective:block/fabricatormk1" }, "elements": [ { "name": "fabricator", "from": [1, 8, -6], "to": [2, 16, -5], "rotation": {"angle": 45, "axis": "x", "origin": [8, 0, 8]}, "faces": { "north": {"uv": [0.875, 0.125, 1, 1.125], "texture": "#0"}, "east": {"uv": [0.75, 0.125, 0.875, 1.125], "texture": "#0"}, "south": {"uv": [1.125, 0.125, 1.25, 1.125], "texture": "#0"}, "west": {"uv": [1, 0.125, 1.125, 1.125], "texture": "#0"}, "up": {"uv": [1, 0.125, 0.875, 0], "texture": "#0"}, "down": {"uv": [1.125, 0, 1, 0.125], "texture": "#0"} } }, { "name": "fabricator", "from": [0, 8, 0], "to": [16, 16, 16], "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { "north": {"uv": [2, 2, 4, 3], "texture": "#0"}, "east": {"uv": [0, 2, 2, 3], "texture": "#0"}, "south": {"uv": [6, 2, 8, 3], "texture": "#0"}, "west": {"uv": [4, 2, 6, 3], "texture": "#0"}, "up": {"uv": [4, 2, 2, 0], "texture": "#0"}, "down": {"uv": [6, 0, 4, 2], "texture": "#0"} } }, { "name": "fabricator", "from": [1, 0, 0], "to": [15, 8, 16], "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { "north": {"uv": [2, 5, 3.75, 6], "texture": "#0"}, "east": {"uv": [0, 5, 2, 6], "texture": "#0"}, "south": {"uv": [5.75, 5, 7.5, 6], "texture": "#0"}, "west": {"uv": [3.75, 5, 5.75, 6], "texture": "#0"}, "up": {"uv": [3.75, 5, 2, 3], "texture": "#0"}, "down": {"uv": [5.5, 3, 3.75, 5], "texture": "#0"} } }, { "name": "fabricator", "from": [15, 0, 4], "to": [16, 7, 12], "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { "north": {"uv": [4.25, 8.875, 4.375, 9.75], "texture": "#0"}, "east": {"uv": [3.25, 8.875, 4.25, 9.75], "texture": "#0"}, "south": {"uv": [5.375, 8.875, 5.5, 9.75], "texture": "#0"}, "west": {"uv": [4.375, 8.875, 5.375, 9.75], "texture": "#0"}, "up": {"uv": [4.375, 8.875, 4.25, 7.875], "texture": "#0"}, "down": {"uv": [4.5, 7.875, 4.375, 8.875], "texture": "#0"} } }, { "name": "fabricator", "from": [0, 0, 4], "to": [1, 7, 12], "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { "north": {"uv": [6.75, 8.5, 6.875, 9.375], "texture": "#0"}, "east": {"uv": [5.75, 8.5, 6.75, 9.375], "texture": "#0"}, "south": {"uv": [7.875, 8.5, 8, 9.375], "texture": "#0"}, "west": {"uv": [6.875, 8.5, 7.875, 9.375], "texture": "#0"}, "up": {"uv": [6.875, 8.5, 6.75, 7.5], "texture": "#0"}, "down": {"uv": [7, 7.5, 6.875, 8.5], "texture": "#0"} } }, { "name": "fabricator", "from": [1, 16, -14], "to": [2, 17, 2], "rotation": {"angle": 45, "axis": "x", "origin": [8, 0, 8]}, "faces": { "north": {"uv": [8, 3, 8.125, 3.125], "texture": "#0"}, "east": {"uv": [6, 3, 8, 3.125], "texture": "#0"}, "south": {"uv": [10.125, 3, 10.25, 3.125], "texture": "#0"}, "west": {"uv": [8.125, 3, 10.125, 3.125], "texture": "#0"}, "up": {"uv": [8.125, 3, 8, 1], "texture": "#0"}, "down": {"uv": [8.25, 1, 8.125, 3], "texture": "#0"} } }, { "name": "fabricator", "from": [0, 16, 3], "to": [16, 28, 5], "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { "north": {"uv": [2.5, 6.375, 4.5, 7.875], "texture": "#0"}, "east": {"uv": [2.25, 6.375, 2.5, 7.875], "texture": "#0"}, "south": {"uv": [4.75, 6.375, 6.75, 7.875], "texture": "#0"}, "west": {"uv": [4.5, 6.375, 4.75, 7.875], "texture": "#0"}, "up": {"uv": [4.5, 6.375, 2.5, 6.125], "texture": "#0"}, "down": {"uv": [6.5, 6.125, 4.5, 6.375], "texture": "#0"} } }, { "name": "fabricator", "from": [3, 17, 2], "to": [13, 27, 3], "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { "north": {"uv": [6.875, 6.25, 8.125, 7.5], "texture": "#0"}, "east": {"uv": [6.75, 6.25, 6.875, 7.5], "texture": "#0"}, "south": {"uv": [8.25, 6.25, 9.5, 7.5], "texture": "#0"}, "west": {"uv": [8.125, 6.25, 8.25, 7.5], "texture": "#0"}, "up": {"uv": [8.125, 6.25, 6.875, 6.125], "texture": "#0"}, "down": {"uv": [9.375, 6.125, 8.125, 6.25], "texture": "#0"} } }, { "name": "fabricator", "from": [14, 16, -14], "to": [15, 17, 2], "rotation": {"angle": 45, "axis": "x", "origin": [8, 0, 8]}, "faces": { "north": {"uv": [2, 8, 2.125, 8.125], "texture": "#0"}, "east": {"uv": [0, 8, 2, 8.125], "texture": "#0"}, "south": {"uv": [4.125, 8, 4.25, 8.125], "texture": "#0"}, "west": {"uv": [2.125, 8, 4.125, 8.125], "texture": "#0"}, "up": {"uv": [2.125, 8, 2, 6], "texture": "#0"}, "down": {"uv": [2.25, 6, 2.125, 8], "texture": "#0"} } }, { "name": "fabricator", "from": [14, 8, -6], "to": [15, 16, -5], "rotation": {"angle": 45, "axis": "x", "origin": [8, 0, 8]}, "faces": { "north": {"uv": [1.375, 0.125, 1.5, 1.125], "texture": "#0"}, "east": {"uv": [1.25, 0.125, 1.375, 1.125], "texture": "#0"}, "south": {"uv": [1.625, 0.125, 1.75, 1.125], "texture": "#0"}, "west": {"uv": [1.5, 0.125, 1.625, 1.125], "texture": "#0"}, "up": {"uv": [1.5, 0.125, 1.375, 0], "texture": "#0"}, "down": {"uv": [1.625, 0, 1.5, 0.125], "texture": "#0"} } }, { "name": "fabricator", "from": [7, 16, -14], "to": [9, 17, 2], "rotation": {"angle": 45, "axis": "x", "origin": [8, 0, 8]}, "faces": { "north": {"uv": [7.5, 6, 7.75, 6.125], "texture": "#0"}, "east": {"uv": [5.5, 6, 7.5, 6.125], "texture": "#0"}, "south": {"uv": [9.75, 6, 10, 6.125], "texture": "#0"}, "west": {"uv": [7.75, 6, 9.75, 6.125], "texture": "#0"}, "up": {"uv": [7.75, 6, 7.5, 4], "texture": "#0"}, "down": {"uv": [8, 4, 7.75, 6], "texture": "#0"} } }, { "name": "fabricator", "from": [7, 8, -6], "to": [9, 16, -5], "rotation": {"angle": 45, "axis": "x", "origin": [8, 0, 8]}, "faces": { "north": {"uv": [0.125, 0.125, 0.375, 1.125], "texture": "#0"}, "east": {"uv": [0, 0.125, 0.125, 1.125], "texture": "#0"}, "south": {"uv": [0.5, 0.125, 0.75, 1.125], "texture": "#0"}, "west": {"uv": [0.375, 0.125, 0.5, 1.125], "texture": "#0"}, "up": {"uv": [0.375, 0.125, 0.125, 0], "texture": "#0"}, "down": {"uv": [0.625, 0, 0.375, 0.125], "texture": "#0"} } } ], "display": { "thirdperson_righthand": { "rotation": [70, 0, 0], "translation": [0, 1, 0.25], "scale": [0.25, 0.25, 0.25] }, "thirdperson_lefthand": { "rotation": [70, 0, 0], "scale": [0.25, 0.25, 0.25] }, "firstperson_righthand": { "scale": [0.4, 0.4, 0.4] }, "firstperson_lefthand": { "scale": [0.4, 0.4, 0.4] }, "ground": { "scale": [0.4, 0.4, 0.4] }, "gui": { "rotation": [0, 126, 0], "translation": [0, -2.75, 0], "scale": [0.5, 0.5, 0.5] }, "fixed": { "translation": [0, -1.5, 0], "scale": [0.4, 0.4, 0.4] } }, "groups": [ { "name": "fabricator", "origin": [8, 0, 8], "color": 0, "children": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11] } ] } Block class: private static final VoxelShape SHAPE = makeShape(); public FabricatorMK1(BlockBehaviour.Properties properties) { super(properties); } @Override public VoxelShape getShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext ctx) { return SHAPE; } @Nullable @Override public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { return BlockEntityInit.FABRICATORMK1_ENTITY.get().create(pos, state); } @Override public void onRemove(BlockState state, Level level, BlockPos pos, BlockState newState, boolean isMoving) { if(state.getBlock() != newState.getBlock()){ BlockEntity blockEntity = level.getBlockEntity(pos); if (blockEntity instanceof FabricatorMK1Entity){ ((FabricatorMK1Entity) blockEntity).drops(); } } } @Override public RenderShape getRenderShape(BlockState state) { return RenderShape.MODEL; } @Override protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) { super.createBlockStateDefinition(builder); builder.add(HorizontalDirectionalBlock.FACING); } @Nullable @Override public BlockState getStateForPlacement(BlockPlaceContext ctx) { return defaultBlockState().setValue(HorizontalDirectionalBlock.FACING, ctx.getHorizontalDirection().getOpposite()); } @Override public InteractionResult use(BlockState state, Level level, BlockPos pos, Player player, InteractionHand interactionHand, BlockHitResult result) { if(!level.isClientSide()) { BlockEntity entity = level.getBlockEntity(pos); if (entity instanceof FabricatorMK1Entity) { NetworkHooks.openScreen(((ServerPlayer)player), (FabricatorMK1Entity)entity, pos); } else { throw new IllegalStateException("Our Container provider is missing!"); } } return InteractionResult.sidedSuccess(level.isClientSide()); } @Nullable @Override public <T extends BlockEntity> BlockEntityTicker<T> getTicker(Level level, BlockState state, BlockEntityType<T> type) { if(level.isClientSide()) { return null; } return createTickerHelper(type, BlockEntityInit.FABRICATORMK1_ENTITY.get(), (level1, pos, state1, blockEntity) -> blockEntity.tick(level1, pos, state1)); } public static VoxelShape makeShape(){ VoxelShape SHAPE = Shapes.empty(); SHAPE = Shapes.join(SHAPE, Shapes.box(0.0625, 0.5, -0.375, 0.125, 1, -0.3125), BooleanOp.OR); SHAPE = Shapes.join(SHAPE, Shapes.box(0, 0.5, 0, 1, 1, 1), BooleanOp.OR); SHAPE = Shapes.join(SHAPE, Shapes.box(0.0625, 0, 0, 0.9375, 0.5, 1), BooleanOp.OR); SHAPE = Shapes.join(SHAPE, Shapes.box(0.9375, 0, 0.25, 1, 0.4375, 0.75), BooleanOp.OR); SHAPE = Shapes.join(SHAPE, Shapes.box(0, 0, 0.25, 0.0625, 0.4375, 0.75), BooleanOp.OR); SHAPE = Shapes.join(SHAPE, Shapes.box(0.0625, 1, -0.875, 0.125, 1.0625, 0.125), BooleanOp.OR); SHAPE = Shapes.join(SHAPE, Shapes.box(0, 1, 0.1875, 1, 1.75, 0.3125), BooleanOp.OR); SHAPE = Shapes.join(SHAPE, Shapes.box(0.1875, 1.0625, 0.125, 0.8125, 1.6875, 0.1875), BooleanOp.OR); SHAPE = Shapes.join(SHAPE, Shapes.box(0.875, 1, -0.875, 0.9375, 1.0625, 0.125), BooleanOp.OR); SHAPE = Shapes.join(SHAPE, Shapes.box(0.875, 0.5, -0.375, 0.9375, 1, -0.3125), BooleanOp.OR); SHAPE = Shapes.join(SHAPE, Shapes.box(0.4375, 1, -0.875, 0.5625, 1.0625, 0.125), BooleanOp.OR); SHAPE = Shapes.join(SHAPE, Shapes.box(0.4375, 0.5, -0.375, 0.5625, 1, -0.3125), BooleanOp.OR); return SHAPE; } I also have a GitHub where you can find the necessary files for the Fabricator (Block entity in question):https://github.com/giornoggiovanna/DarkCollectiveGit Thanks for the help!
  3. Oh my god, thank you so much! It works perfectly now. Of course it was a typo. Was there anything else I should change in my code, to keep up with conventions and make the game run better? Again, I'm new to modding, so I don't know a lot about conventions so I'd like to learn.
  4. How's debugging going? Have you figured a root cause? I had an idea of what it was (recipe returning null), but I couldn't figure out why it was doing that. If you haven't had time to work on it don't worry, I'm not really in a time rush.
  5. Yeah, it's been on my list of things to learn. As of now, I haven't really had a need to create branches or do anything more than commiting, pushing and pulling. I'll probably create a new branch for the .gitignore; I could just look at how to do it.
  6. Ah, I realized my response didn't send. Would you be able to just copy and paste the necessary files into a new project? I didn't change much in my gradle files, basically just specifying the mod id (which can be seen in the main class) and the version of forge (40.0.14). If you're unable to do that, that's fine, but I may need some help with creating a new branch and working with Git since my Git expertise really only go up to branch merging.
  7. Ok, I just changed the .gitignore. Not sure if that also added the gradle files you needed, but it added something. If it doesn't, I can just send you the files that you need manually.
  8. Just checked with the tutorial, they’re doing the same thing. From what I understand, the non-null list is just storing the item that is in the input slot (in this case, the SimpleContainer slot 0). I can send the link to the tutorial GitHub: https://github.com/Tutorials-By-Kaupenjoe/Forge-Tutorial-1.20.X/tree/31-recipeTypes.
  9. Hmm, not sure. I can check with the tutorial. Again, I'm not 100% sure as to how the whole process functions, as the tutorial didn't really explain well. From what I understand, the recipes are gathered from the Json files and stored in the NonNullList.
  10. Quoting this becuase I realized I wasn’t quoting before.
  11. Just so you know, slot 0 its the input, and slot 1 is the output. Slot 2 is a fuel input (haven’t written functionality for that yet).
  12. Yeah, I’ve looked at it in the debugger. There’s no recipe found, as the getRecipeMethod is returning null. I’m not sure why though, as the inventory isn’t null: it’s detecting the correct item in the correct slot.
  13. Ah, ok. What forum should I post in for next time? Also, here's my GitHub link: https://github.com/giornoggiovanna/DarkCollectiveGit/tree/main/src/main
  14. Hello! I'm writing a Minecraft based on tech and machines, and I'm making a furnace-esque machine for processing ores. However, I can't seem to get the recipes to work. Whenever I put the ore into the slot, nothing happens. I added the inventory property to the watchlist and it showed that it was detecting the block in the right slot, but for some reason its not triggering crafting. I'm at a loss right now. Please note that I am new to modding, and I followed a tutorial for this code, so I don't really know code conventions yet. Also, there's no crashes at all. No errors thrown. It just doesn't do anything. Below is some of the associated code: 1) The .json files for the recipes { "type": "darkcollective:ore_refining", "ingredients": [ { "item": "darkcollective:aernium_ore" } ], "output": { "count": 2, "item": "darkcollective:aernium_ingot" } } 2) The code in the OreRefineryEntityClass that looks for the recipe and, if found, starts the crafting private boolean hasRecipe() { Optional<OreRefineryRecipe> recipe = getCurrentRecipe(); System.out.println(recipe); if(recipe.isEmpty()) { return false; } ItemStack result = recipe.get().getResultItem(getLevel().registryAccess()); return canInsertAmountIntoOutputSlot(result.getCount()) && canInsertItemIntoOutputSlot(result.getItem()); } private Optional<OreRefineryRecipe> getCurrentRecipe() { SimpleContainer inventory = new SimpleContainer(this.itemHandler.getSlots()); for(int i = 0; i < itemHandler.getSlots(); i++) { inventory.setItem(i, this.itemHandler.getStackInSlot(i)); } return this.level.getRecipeManager().getRecipeFor(OreRefineryRecipe.Type.INSTANCE, inventory, level); } 3) The code for the RecipeSerializer. public static class Serializer implements RecipeSerializer<OreRefineryRecipe>{ public static final Serializer INSTANCE = new Serializer(); public static final ResourceLocation ID = new ResourceLocation(DarkCollective.ModID, "ore_refining"); @Override public OreRefineryRecipe fromJson(ResourceLocation recipeId, JsonObject serializedRecipe) { ItemStack output = ShapedRecipe.itemStackFromJson(GsonHelper.getAsJsonObject(serializedRecipe, "result")); JsonArray ingredients = GsonHelper.getAsJsonArray(serializedRecipe, "ingredients"); NonNullList<Ingredient> inputs = NonNullList.withSize(1, Ingredient.EMPTY); for(int i = 0; i < inputs.size(); i++) { inputs.set(i, Ingredient.fromJson(ingredients.get(i))); } return new OreRefineryRecipe(inputs, output, recipeId); } @Override public @Nullable OreRefineryRecipe fromNetwork(ResourceLocation recipeID, FriendlyByteBuf buffer) { NonNullList<Ingredient> inputs = NonNullList.withSize(buffer.readInt(), Ingredient.EMPTY); for(int i = 0; i < inputs.size(); i++) { inputs.set(i, Ingredient.fromNetwork(buffer)); } ItemStack output = buffer.readItem(); return new OreRefineryRecipe(inputs, output, recipeID); } @Override public void toNetwork(FriendlyByteBuf buffer, OreRefineryRecipe recipe) { buffer.writeInt(recipe.inputItems.size()); for (Ingredient ingredient : recipe.getIngredients()) { ingredient.toNetwork(buffer); } buffer.writeItemStack(recipe.getResultItem(null), false); } } If there's anything I missed, just tell me and I'd be happy to send. Also, I'm on version 1.20. Thank you!
×
×
  • Create New...

Important Information

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