Jump to content
Search In
  • More options...
Find results that contain...
Find results in...


  • Posts

  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

vntlyy007's Achievements

Tree Puncher

Tree Puncher (2/8)



  1. Thanks a lot man you helped me a lot! I seem to have figured everything out, cleaned the code and everything works) My final code is:
  2. There are two serverTick voids. These two options are the basis of what I did (they don't work) in which you can do everything from scratch if you need to. I have one version where smelting is possible, but with a bunch of unfinished stuff, such as the need for coal for smelting. public static void serverTick(Level pLevel, BlockPos pPos, BlockState pState, MixingBlockEntity pBlockEntity) { if (pBlockEntity.isLit()) { --pBlockEntity.litTime; System.out.println("GOOD"); } boolean flag = pBlockEntity.isLit(); boolean flag1 = false; ItemStack itemstack = pBlockEntity.items.get(1); if(pBlockEntity.isLit() || hasRecipe(pBlockEntity)) { if (!pBlockEntity.isLit() && pBlockEntity.canBurn(pBlockEntity)) { pBlockEntity.litTime = pBlockEntity.getBurnDuration(itemstack); pBlockEntity.litDuration = pBlockEntity.litTime; timeSet(pBlockEntity); //TRUE if (pBlockEntity.isLit()) { System.out.println('A'); flag1 = true; itemstack.shrink(1); } } if (pBlockEntity.isLit() && pBlockEntity.canBurn(pBlockEntity)) { System.out.println('B'); ++pBlockEntity.cookingProgress; if (pBlockEntity.cookingProgress == pBlockEntity.cookingTotalTime) { pBlockEntity.cookingProgress = 0; craftItem(pBlockEntity); timeSet(pBlockEntity); flag1 = true; } } } else if (!pBlockEntity.isLit() && pBlockEntity.cookingProgress > 0) { System.out.println('C'); pBlockEntity.cookingProgress = Mth.clamp(pBlockEntity.cookingProgress - 2, 0, pBlockEntity.cookingTotalTime); } if (flag1) { setChanged(pLevel, pPos, pState); } } I'm trying to add a dependence on coal by using, but it does not work: if(pBlockEntity.isLit() || hasRecipe(pBlockEntity) && !itemstack.isEmpty()) { As far as I understand, the problem is that this option of getting a slot does not work in this method(it was copied from AbstractFurnaceBlockEntity) So you can use this void to try find a problem The code of mod in GIT maximally simplified and in methods where it is necessary to obtain some information (for example: getTotalCookingTime always gives 400, etc.) I have a done code for obtaining these data from the recipe, so this is not a problem to get it if you need
  3. GIT, I'll be grateful for any help)
  4. public static void serverTick(Level p_155014_, BlockPos p_155015_, BlockState p_155016_, MixingBlockEntity p_155017_) { boolean flag = p_155017_.isLit(); boolean flag1 = false; if (p_155017_.isLit()) { System.out.println('1'); --p_155017_.litTime; } if (p_155017_.canBurn(p_155017_)) { System.out.println('B'); } // HERE ItemStack itemstack = p_155017_.items.get(1); if (p_155017_.isLit() || !itemstack.isEmpty() && !p_155017_.items.get(0).isEmpty()) { if (!p_155017_.isLit() && p_155017_.canBurn(p_155017_)) { p_155017_.litTime = p_155017_.getBurnDuration(itemstack); p_155017_.litDuration = p_155017_.litTime; if (p_155017_.isLit()) { flag1 = true; if (itemstack.hasContainerItem()) p_155017_.items.set(1, itemstack.getContainerItem()); else if (!itemstack.isEmpty()) { Item item = itemstack.getItem(); itemstack.shrink(1); if (itemstack.isEmpty()) { p_155017_.items.set(1, itemstack.getContainerItem()); } } } } if (p_155017_.isLit() && p_155017_.canBurn(p_155017_)) { ++p_155017_.cookingProgress; if (p_155017_.cookingProgress == p_155017_.cookingTotalTime) { p_155017_.cookingProgress = 0; craftItem(p_155017_); p_155017_.cookingTotalTime = getTotalCookTime(p_155017_); flag1 = true; } } else { p_155017_.cookingProgress = 0; } } else if (!p_155017_.isLit() && p_155017_.cookingProgress > 0) { p_155017_.cookingProgress = Mth.clamp(p_155017_.cookingProgress - 2, 0, p_155017_.cookingTotalTime); } if (flag != p_155017_.isLit()) { flag1 = true; p_155016_ = p_155016_.setValue(AbstractFurnaceBlock.LIT, Boolean.valueOf(p_155017_.isLit())); p_155014_.setBlock(p_155015_, p_155016_, 3); } if (flag1) { System.out.println('1'); setChanged(p_155014_, p_155015_, p_155016_); } } It's strange, idk, i didn't change anything))
  5. Okay, even when getBurmDuration return the 200, my code still doesn't work. It's sad
  6. Wood and coal How can i pass it? I don't really understand))
  7. Hi man, i have: 0 - input slot 1 - fuel slot 2 - output slot 3 - addition slot I've just checked debug mod, so it doesnt work: protected int getBurnDuration(ItemStack p_58343_) { if (p_58343_.isEmpty()) { return 0; } else { Item item = p_58343_.getItem(); return net.minecraftforge.common.ForgeHooks.getBurnTime(p_58343_, null); } } it return 0* My server tick using this int: ItemStack itemstack = p_155017_.items.get(1); p_155017_.litTime = p_155017_.getBurnDuration(itemstack); p_155017_.litDuration = p_155017_.litTime;
  8. Hi guys, i have a not default furnace (with one extra slot), but it has default furnace code in basic I cant set lit the furnace(smth with serverTick or components in it) The result - System.out.println('P') Annotated code is my version of serverTick Not annotated - AbstractFurnaceBlockEnity
  9. Hopper takes items from input slot, i tried to clone the code of vanilla containers, but it doesn't work BlockEntity:
  10. I have completed two tasks, it remains to add the time in json. But I still have a problem with Hopper. It takes items from input slots (I still haven't figured out what I was advised to do with getCapabilities) I tried all my ideas to reproduce it, so I still will be grateful for help BlockEntity:
  11. HOWEVER, actualy there are more things My furnace more like crafting table, but with time - cleaning of fossil ores with special item with durability everything is in order: 1)to prevent items from the output slot from moving into the hopper 2)to be able to put in the slot only items with a special tag (like furnace fuel) 3)remove the ability to discard a finished smelting item back to output slot through use quick move 4) add the ability to add smelting time in json recipe(it's the easier) GITHub There is my project, if somebody want/can, I will be grateful for your help < 3
  12. I found this code in my custom block entity: public class CleaningTableBlockEntity extends BlockEntity implements MenuProvider { @Nonnull @Override public <T> LazyOptional<T> getCapability(@Nonnull Capability<T> cap, @javax.annotation.Nullable Direction side) { if (cap == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) { return lazyItemHandler.cast(); } return super.getCapability(cap, side); } } but actually idk what should i do about this?) i tried deleted it(but slots dont load) Or what do you mean by "do not expose the capability at all"? Also, I have another thing I'm trying to do is be able to put in the slot only items with a special tag (like furnace fuel)
  13. Hi guys) I have a custom furnace, and an idea that is impossible to implement if it is possible to move items from there to somewhere using a hopper (automatic farm or something), so I need to prevent the item from exiting to third-party objects (ie, not the player)
  14. I want to add a separate slot for oil and other cooking substances in the new furnace, and in order to replace the vanilla style, I decided to get rid of the smoker)
  • Create New...

Important Information

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