Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 02/22/20 in all areas

  1. public static GameRules.RuleKey<GameRules.BooleanValue> doAttackCooldown; @SubscribeEvent public void init(FMLClientSetupEvent event) { doAttackCooldown = GameRules.register("doAttackCooldown", new GameRules(new GameRules.RuleType<GameRules.BooleanValue>(), true)); } I'm trying to add a new gamerule, but I'm stuck at the first argument of new GameRules(). I'm not sure what to put here. I originally just followed the Vanilla format of: register("doFireTick", GameRules.BooleanValue.create(true)); However, the create function is private for all GameRule value types. Thank you in advance.
    1 point
  2. Hello, I've made a simple custom ItemEntity that can't catch on fire. Here's the code for it: package zorochase.yanm.item; import net.minecraft.entity.EntityType; import net.minecraft.entity.item.ItemEntity; import net.minecraft.item.ItemStack; import net.minecraft.util.DamageSource; import net.minecraft.world.World; public class FireproofItemEntity extends ItemEntity { public FireproofItemEntity(World worldIn, double x, double y, double z, ItemStack stack) { super(worldIn, x, y, z, stack); } public FireproofItemEntity(EntityType<?> entityType, World world) { super((EntityType<? extends ItemEntity>)entityType, world); } @Override public boolean attackEntityFrom(DamageSource p_70097_1_, float p_70097_2_) { if (!p_70097_1_.isFireDamage()) { return super.attackEntityFrom(p_70097_1_, p_70097_2_); } return false; } } Here's how it was registered (taken from my main mod class): @Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD) public static class RegistryEvents { @SubscribeEvent public static void onEntityRegistry(final RegistryEvent.Register<EntityType<?>> entityRegistryEvent) { entityRegistryEvent.getRegistry().register( EntityType.Builder .create(FireproofItemEntity::new, EntityClassification.MISC) .build(YetAnotherNetheriteMod.MODID + ":fireproof_item_entity") .setRegistryName(YetAnotherNetheriteMod.MODID, "fireproof_item_entity") ); } } I also have a FireproofItem class that I use for all items I want to be fireproof when dropped, here's its code: package zorochase.yanm.item; import net.minecraft.entity.Entity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.world.World; import zorochase.yanm.YetAnotherNetheriteMod; import javax.annotation.Nullable; public class FireproofItem extends Item { public FireproofItem(String registryName) { super(new Item.Properties().group(YetAnotherNetheriteMod.MOD_TAB)); setRegistryName(YetAnotherNetheriteMod.MODID, registryName); } @Nullable @Override public Entity createEntity(World world, Entity location, ItemStack itemstack) { FireproofItemEntity custom = new FireproofItemEntity(world, location.posX, location.posY, location.posZ, itemstack); custom.setMotion(location.getMotion()); custom.setDefaultPickupDelay(); return custom; } @Override public boolean hasCustomEntity(ItemStack stack) { return true; } } All of this works just fine, so long as I don't leave a FireproofItem on the ground before quitting the game/to the main menu. If I do, and I try to load the world again, it freezes on 100%. I have no idea what could be causing this. Somebody else on these forums had the same issue a few months ago, but it seems they were also unable to figure it out. That or if they did they never replied with their fix. Any help would really be appreciated, as this is a feature I'd really rather not leave out.
    1 point
  3. An ItemEntity is the entity that's created when you drop an item in the world, when a block breaks drops itself, etc..
    1 point
  4. I suppose that's an ideal workaround, thanks for letting me know (and thanks @Cadiboo), I'll try something somewhat similar.
    1 point
  5. yep i have never used github so i will look in to it. thank you
    1 point
  6. I haven't tried this using RegistryObject yet, but I believe Cadiboo has a custom spawn egg that takes a Supplier in the constructor in his example mod on github. https://github.com/Cadiboo/Example-Mod/blob/1.15.2/src/main/java/io/github/cadiboo/examplemod/item/ModdedSpawnEggItem.java I haven't messed with it myself, so your mileage may vary, but seems like a good place to start until something proper is done about the spawn egg mess.
    1 point
  7. @Cadiboo You should definitely message a forum moderator to get your link pinned as a thread! I think many people would be appreciative.
    1 point
  8. I just downloaded the recommended 1.7.10 forge source and tried to run ".\gradlew tasks" in Windows PowerShell when following a modding tutorial. It immediately failed with the error "Could not determine java version from '11.0.1'." I have no idea what to do now since the tutorial does not encounter this error and provides no way to fix it.
    0 points
×
×
  • Create New...

Important Information

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