Jump to content

thelion1997

Members
  • Posts

    25
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • Personal Text
    I am new!

thelion1997's Achievements

Tree Puncher

Tree Puncher (2/8)

1

Reputation

  1. I was having the same issue. Make sure that you have set up the accesstransformer.cfg file under resources/META_INF You will also need to uncomment this line in the build.gradle file and reload your gradle project. accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') That should fix the access issue you are having.
  2. For some reason the canSpawnOn function wasn't running properly from the jar. It seems to have clashed with where I set spawn placement type to inWater. public static boolean canSpawnOn(final EntityType<? extends MobEntity> entity, final IWorld world, final SpawnReason reason, final BlockPos pos, final Random rand) { if (pos.getY() > 25) { Optional<RegistryKey<Biome>> optional = world.func_242406_i(pos); return (Objects.equals(optional, Optional.of(Biomes.OCEAN)) || Objects.equals(optional, Optional.of(Biomes.DEEP_OCEAN)) || Objects.equals(optional, Optional.of(Biomes.WARM_OCEAN)) || Objects.equals(optional, Optional.of(Biomes.DEEP_WARM_OCEAN)) || Objects.equals(optional, Optional.of(Biomes.LUKEWARM_OCEAN)) || Objects.equals(optional, Optional.of(Biomes.DEEP_LUKEWARM_OCEAN)) || Objects.equals(optional, Optional.of(Biomes.COLD_OCEAN)) || Objects.equals(optional, Optional.of(Biomes.DEEP_COLD_OCEAN)) || Objects.equals(optional, Optional.of(Biomes.DEEP_OCEAN))) && world.getFluidState(pos).isTagged(FluidTags.WATER); } else { return false; } } I got this code mostly from the dolphinEntity class but modified it slightly. I tried changing this and ended up with this. I also changed the name of the function as I think there may have been an inheritance issue. This is what I ended up with. public static boolean canHippocampusSpawnOn(final EntityType<? extends MobEntity> entity, final IWorld world, final SpawnReason reason, final BlockPos pos, final Random rand) { if (pos.getY() <= 25 || pos.getY() >= world.getSeaLevel()) { return false; } RegistryKey<Biome> biome = world.func_242406_i(pos).orElse(Biomes.PLAINS); return (BiomeDictionary.hasType(biome, BiomeDictionary.Type.OCEAN)) && world.getFluidState(pos).isTagged(FluidTags.WATER); } This seems to have fixed the issue. Thanks again!
  3. Nvm. I just figured it out. Not sure why it was working in the IDE.
  4. Just set up the repo. Here is the link: https://github.com/WindRunner7/GreekMyths
  5. I don't have a repo set up yet. It is the hippocampus entity which is not spawning. Here is the class which registers the entities if it is helpful. @Mod.EventBusSubscriber(modid = GreekMyths.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD) public class ModEntities { public static final EntityClassification MOD_FREINDLY = EntityClassification.create("ModFriendly", "ModFriendly", 20, true, true, 128); public static final EntityClassification MOD_WATER_CREATURE = EntityClassification.create("ModWater", "ModWater", 20, true, true, 128); public static final EntityClassification MOD_FREINDLY_CREATURE = EntityClassification.create("ModFriendlyCreature", "ModFriendlyCreature", 10, true, true, 128); public static final RegistryObject<EntityType<?>> GREEKVILLAGER = register("greekvillager_entity", () -> EntityType.Builder.create(GreekVillagerEntity::new, MOD_FREINDLY).build(new ResourceLocation(GreekMyths.MOD_ID, "greekvillager_entity").toString())); public static final RegistryObject<EntityType<?>> HIPPOCAMPUS = register("hippocampus_entity", () -> EntityType.Builder.create(HippocampusEntity::new, MOD_WATER_CREATURE).size(1.2f, 1.3f).build(new ResourceLocation(GreekMyths.MOD_ID, "hippocampus_entity").toString())); public static final RegistryObject<EntityType<?>> PEGASUS = register("pegasus_entity", () -> EntityType.Builder.create(PegasusEntity::new, MOD_FREINDLY_CREATURE).size(1.36f, 1.6f).build(new ResourceLocation(GreekMyths.MOD_ID, "pegasus_entity").toString())); // public static final RegistryObject<Item> GREEK_VILLAGER_SPAWN_EGG = Registration.ITEMS.register("greek_villager_spawn_egg", () -> // new SpawnEggItem(GREEKVILLAGER.get(), 0x2f5882, 0x6f1499, new Item.Properties().group(GreekMyths.ITEM_GROUP))); public static void register() { } public static <T extends EntityType<?>> RegistryObject<T> register(String name, Supplier<T> entity) { RegistryObject<T> ret = Registration.ENTITIES.register(name, entity); return ret; } @SubscribeEvent public static void setupEntityHandler(final FMLCommonSetupEvent event) { event.enqueueWork(() -> { setupEntity((EntityType<MobEntity>)GREEKVILLAGER.get(),GreekVillagerEntity::getAttributes, GreekVillagerEntity::canSpawnOn); setupEntity((EntityType<MobEntity>)HIPPOCAMPUS.get(), HippocampusEntity::getAttributes, HippocampusEntity::canSpawnOn); setupEntity((EntityType<MobEntity>)PEGASUS.get(), PegasusEntity::getAttributes, PegasusEntity::canSpawnOn); }); } public static <T extends MobEntity> void setupEntity(final EntityType<T> entityType, final Supplier<AttributeModifierMap.MutableAttribute> mapSupplier, @Nullable final EntitySpawnPlacementRegistry.IPlacementPredicate<T> placementPredicate){ GlobalEntityTypeAttributes.put((EntityType<? extends LivingEntity>) entityType, mapSupplier.get().create()); final EntitySpawnPlacementRegistry.PlacementType placementType = entityType.getClassification() == MOD_WATER_CREATURE ? EntitySpawnPlacementRegistry.PlacementType.IN_WATER : EntitySpawnPlacementRegistry.PlacementType.ON_GROUND; final EntitySpawnPlacementRegistry.IPlacementPredicate<T> placement = (entity, world, reason, pos, rand) -> placementPredicate.test(entity, world, reason, pos, rand); EntitySpawnPlacementRegistry.register(entityType, placementType, Heightmap.Type.MOTION_BLOCKING_NO_LEAVES, placement); } }
  6. Another this to note is that the lang file doesn't seem to load from the jar file either. Not sure if that is related or not...
  7. The new mob spawns properly when run from Intellij but not from the minecraft launcher using the jar. The strangest part is that the other two mobs I added spawn as expected in both cases. I have included the code used to register the spawns below. @Mod.EventBusSubscriber(modid = GreekMyths.MOD_ID, bus = Mod.EventBusSubscriber.Bus.FORGE) public class EntitySpawning { @SubscribeEvent(priority = EventPriority.HIGH) public static void addBiomeSpawns(final BiomeLoadingEvent event) { if(event.getCategory() == Biome.Category.OCEAN) { addSpawns(event, ModEntities.HIPPOCAMPUS.get(), 100, 1, 2); } addSpawns(event, ModEntities.GREEKVILLAGER.get(), 100, 1, 3); addSpawns(event, ModEntities.PEGASUS.get(), 100, 1, 3); } private static void addSpawns(final BiomeLoadingEvent biome, final EntityType<?> entity, final int chance, final int min, final int max) { if (biome.getCategory() == Biome.Category.NETHER) { } else if (biome.getCategory() == Biome.Category.THEEND) { } else { biome.getSpawns().withSpawner(entity.getClassification(), new MobSpawnInfo.Spawners(entity, chance, min, max)); } } } Also, you are still able to summon the mob using commands. Any thoughts?
  8. Thanks! I managed to get that working!
  9. Isn't that how you set the entity classification? For example, in order to run my code I have my entity registered through differed register as follows: public static final RegistryObject<EntityType<?>> GREEKVILLAGER = register("greekvillager_entity", () -> EntityType.Builder.create(GreekVillagerEntity::new, EntityClassification.CREATURE).build(new ResourceLocation(GreekMyths.MOD_ID, "greekvillager_entity").toString())); In that second field of the create method I am passing the EntityClassification.CREATURE What I would like is to create a different classification, lets say EntityClassification.MYMOBS and registier it as part of that instead. Is there a way to add additional Items to the EntityClassification Enum?
  10. Is there a replacement for the EnumHelper? I am trying to add an EntityClassification for my mobs but am used to using the EnumHelper for this. Any advice?
  11. I will give this a try. Thanks for the advice.
  12. I am trying to create a widget that is displayed in the corner of the screen but does not stop player movement. (much like the widget in the damage indicators mod) When I use a guiscreen it unbinds the mouse from the screen and stops the player from moving. Is there a easy way to do this?
  13. Not sure exactly what I did but it is working now. Thanks again.
  14. Oh well I will keep trying thanks for the help.
  15. I am. Here is the code. public final class RA_Blocks { public static final Block blockCoffeePlant = new BlockCoffeePlant(); public static final Block blockSpinachPlant = new BlockSpinachPlant(); public static void initBlocks() { GameRegistry.registerBlock(blockCoffeePlant, blockCoffeePlant.getUnlocalizedName().substring(5)); GameRegistry.registerBlock(blockSpinachPlant, blockSpinachPlant.getUnlocalizedName().substring(5)); } }
×
×
  • Create New...

Important Information

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