• Recently Browsing

    No registered users viewing this page.

  • Posts

    • every time I go to download forge for 1.8.9 and click the button install client it says these libraries failed to download please try again
    • Thanks a ton, that was a massive help. I've got the behavior I'm looking for (though I did change some of your stuff around).  Also, thanks for introducing me to the Map class!   Do you know of a less janky way to tell if the ItemEntity is a sapling? I'm still using the .toString().contains(SAPLING) method. I've tried a few other ways, but can't figure it out.   I still have other behaviors to implement, like different sapling entities planting their respective trees, respawning the stack with one less sapling, etc. I'm also sure that there's potential bugs to iron out with non soild blocks.   Source code for those interested: package com.asdf.tutorialmod.events; import java.util.ConcurrentModificationException; import java.util.HashMap; import java.util.Map; import com.asdf.tutorialmod.TutorialMod; import net.minecraft.block.Blocks; import net.minecraft.block.GrassBlock; import net.minecraft.entity.item.ItemEntity; import net.minecraft.item.ItemStack; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.event.TickEvent.WorldTickEvent; import net.minecraftforge.event.entity.EntityJoinWorldEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus; @Mod.EventBusSubscriber(modid=TutorialMod.MOD_ID, bus=Bus.FORGE) public class SaplingHitsGrass { private static final CharSequence SAPLING=new StringBuffer("sapling"); private static final int TICKS_TILL_PLANT=600; private static Map<ItemEntity,Integer> map=new HashMap<ItemEntity,Integer>(); @SubscribeEvent public static void saplingHitsGrass(WorldTickEvent tick) { World world=tick.world; if(map!=null) { if(!map.isEmpty()) { try { map.forEach((item,timeLeft)->{ if(!item.isAlive()) { map.remove(item); TutorialMod.LOGGER.info("Sapling removed from queue prematurely"); } else if(timeLeft>1) { map.put(item, timeLeft-1); } else { map.remove(item); TutorialMod.LOGGER.info("Sapling removed from queue"); BlockPos pos= item.getPosition(); if(world.getBlockState(pos.add(0, -1, 0)).getBlock() instanceof GrassBlock) { world.setBlockState(pos, Blocks.OAK_SAPLING.getDefaultState()); } } }); } catch(ConcurrentModificationException e) { e.getStackTrace(); } } } } @SubscribeEvent public static void populateMap(EntityJoinWorldEvent event) { if(event.getEntity() instanceof ItemEntity) { ItemEntity item=(ItemEntity) event.getEntity(); ItemStack stack=item.getItem(); if(stack!=null&&stack.toString().contains(SAPLING)) { map.put(item,TICKS_TILL_PLANT); TutorialMod.LOGGER.info("Sapling added to queue"); } } } }  
    • Hey! I'm new to modding and I was just wandering how would you go about making an items with data values like wool:1 or wool:2 and have that make a difference? I have no clue how to handle data values nor create them. Any help would be appreciated! Thanks! 😄
    • This has been an issue that I have been looking on the forums for an answer to for what I'd say has been about a week or so now. I haven't been able to find the answer to my question, so I made an account. My friend has the same version  of Forge, and the same issue that I do. Any help would be greatly appreciated!!
  • Topics

  • Who's Online (See full list)