
Godis_apan
Members-
Content Count
79 -
Joined
-
Last visited
Community Reputation
12 GoodAbout Godis_apan
-
Rank
Stone Miner
Converted
-
Gender
Male
-
Location
Sweden, Lund
-
Personal Text
How wude!
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
-
Thanks!
-
Hello! I'm having trouble adding a drop to a vanilla mob (Silverfish) and I'm not sure how to fix it. I'm trying to use global loot modifiers but no success yet: Loot class: https://github.com/Phrille/Vanilla-Boom/blob/master/src/main/java/phrille/vanillaboom/util/LootTableHandler.java (initialise is called from the mod constructor) Loot json: https://github.com/Phrille/Vanilla-Boom/blob/master/src/main/resources/data/vanillaboom/loot_modifiers/silverfish.json global_loot_modifiers.json: https://github.com/Phrille/Vanilla-Boom/blob/master/src/main/resources/data/forge/loot_modifiers/global_loot_modifiers.json Can anybody see where I'm going wrong? Any help would be appreciated!
-
Anyone else have a solution?
-
Yes that's is what I'm already doing?? But I wanna check for specific Nether biomes such as Soul Sand Valley and only spawn in those. That is the question
-
Any info on this? Would really be appreciated!
-
Hello! I have to questions regarding World gen: 1. When adding features to a biome in BiomeLoadingEvent, how would you go about checking which biome you're adding that feature to? Right now I test it with: if(BiomeDictionary.hasType(biomeRegistryKey, BiomeDictionary.Type.NETHER)) but how about checking for if it is a Soul Sand Valley or Crimson Forest? This is my current solution but I don't like it since event.getName() can return null sometimes: if (biomeName.equals("soul_sand_valley")) 2. Where about in generation should I check my config boolean if it is enabled or not? Is this a good place to do it? This will allow the generation to be changed when a biome is loaded but it will not update if you are in game and change the config: @SubscribeEvent(priority = EventPriority.HIGH) public static void addFeaturesToBiomes(BiomeLoadingEvent event) { BiomeGenerationSettingsBuilder generation = event.getGeneration(); RegistryKey<Biome> biomeRegistryKey = RegistryKey.getOrCreateKey(ForgeRegistries.Keys.BIOMES, Objects.requireNonNull(event.getName(), "Biome registry name was null")); //Check here if feature is enabled/disabled in config if (MyConfig.isThisEnabaled && BiomeDictionary.hasType(biomeRegistryKey, BiomeDictionary.Type.OVERWORLD)) { generation.withFeature(GenerationStage.Decoration.VEGETAL_DECORATION, getFeature(ModConfiguredFeatures.ROSE_PATCHES)); } } Thanks for the help!
-
Hello again and thanks to everybody devoted to helping us modders. I'm having trouble finding a proper way to set a custom item to be received when middle clicking an entity in creative mode (like how you get a spawn egg, boat or minecart item when middle clicking those entities). I haven't found any methods in the Entity class that lets you do it, and can't find the client code responsible for handling this. Any help would be appreciated!
-
Crash when rendering painting entity [SOLVED]
Godis_apan replied to Godis_apan's topic in Modder Support
You are absolutely right, got it working perfectly now thanks! -
Trying to make an entity which extends upon PaintingEntity and PaintingRenderer. Getting a nullPointerException but I cannot for the life of me understand what is null. Code: ModEntities: @ObjectHolder(VanillaBoom.MOD_ID) public class ModEntities { public static final EntityType<PrismarineArrowEntity> PRISMARINE_ARROW = Utils._null(); public static final EntityType<CustomPaintingEntity> CUSTOM_PAINTING = Utils._null(); @Mod.EventBusSubscriber(modid = VanillaBoom.MOD_ID, bus = Bus.MOD) public static class RegistrationHandler { @SubscribeEvent public static void registerEntities(RegistryEvent.Register<EntityType<?>> event) { event.getRegistry().register(build(Names.PRISMARINE_ARROW, EntityType.Builder.<PrismarineArrowEntity>create(PrismarineArrowEntity::new, EntityClassification.MISC).setCustomClientFactory((spawnEntity, world) -> new PrismarineArrowEntity(PRISMARINE_ARROW, world)).size(0.5f, 0.5f))); event.getRegistry().register(build(Names.CUSTOM_PAINTING, EntityType.Builder.<CustomPaintingEntity>create(CustomPaintingEntity::new, EntityClassification.MISC).setCustomClientFactory((spawnEntity, world) -> new CustomPaintingEntity(CUSTOM_PAINTING, world)).size(0.5f, 0.5f))); } private static <T extends Entity> EntityType<T> build(String name, EntityType.Builder<T> builder) { ResourceLocation registryName = new ResourceLocation(VanillaBoom.MOD_ID, name); EntityType<T> entityType = builder.build(registryName.toString()); entityType.setRegistryName(registryName); return entityType; } } } ModRenderers: @Mod.EventBusSubscriber(modid = VanillaBoom.MOD_ID, value = Dist.CLIENT, bus = Bus.MOD) public class ModRenderers { @SubscribeEvent public static void register(FMLClientSetupEvent event) { RenderingRegistry.registerEntityRenderingHandler(ModEntities.PRISMARINE_ARROW, renderManager -> new PrismarineArrowRenderer(renderManager, new ResourceLocation(VanillaBoom.MOD_ID, "textures/entity/prismarine_arrow.png"))); RenderingRegistry.registerEntityRenderingHandler(ModEntities.CUSTOM_PAINTING, renderManager -> new PaintingRenderer(renderManager)); } } CustomPaintingEntity: public class CustomPaintingEntity extends PaintingEntity { public CustomPaintingEntity(EntityType<? extends CustomPaintingEntity> type, World world) { super(type, world); } public CustomPaintingEntity(World world, BlockPos pos, Direction facing) { super(world, pos, facing); } @OnlyIn(Dist.CLIENT) public CustomPaintingEntity(World worldIn, BlockPos pos, Direction facing, PaintingType artIn) { super(worldIn, pos, facing, artIn); } public void updateArt(PaintingType paintingType, Direction facing) { art = paintingType; updateFacingWithBoundingBox(facing); } @Override public void onBroken(@Nullable Entity brokenEntity) { if (world.getGameRules().getBoolean(GameRules.DO_ENTITY_DROPS)) { playSound(SoundEvents.ENTITY_PAINTING_BREAK, 1.0F, 1.0F); if (brokenEntity instanceof PlayerEntity) { PlayerEntity playerentity = (PlayerEntity) brokenEntity; if (playerentity.abilities.isCreativeMode) { return; } } entityDropItem(getDrop()); } } public Item getDrop() { return ModItems.SKULL_AND_ROSES_PAINTING; } @Override public EntityType<?> getType() { return ModEntities.CUSTOM_PAINTING; } @Override public IPacket<?> createSpawnPacket() { return NetworkHooks.getEntitySpawningPacket(this); } } Crashreport: https://pastebin.com/nfDxk0HV
-
Is there an onBroken event for paintings? [1.16.4]
Godis_apan replied to Godis_apan's topic in Modder Support
Yes I thought of that at first but decided against it to make my mod work as well as possible with vanilla. However it seems like this way was too much trouble so I guess I have to go with a custom painting entity. Many thanks for the help, you can consider this closed. -
Is there an onBroken event for paintings? [1.16.4]
Godis_apan replied to Godis_apan's topic in Modder Support
I've tried this now and i still run into an error. When the ItemEntity is spawned when the painting is hit, the paintings capabilities have already been removed. In the HangingEntity's tick() method, this.remove() is called first and then this.onBroken(). This means my code will crash when checking if the painting that was broken was a custom one: @SubscribeEvent public static void onEntityJoinTheWorld(EntityJoinWorldEvent event) { if (event.getEntity() instanceof ItemEntity && !event.getWorld().isRemote) { ItemEntity itemEntity = (ItemEntity) event.getEntity(); if (itemEntity.getItem() != null && itemEntity.getItem().getItem() == Items.PAINTING) { double posX = itemEntity.getPosX(); double posY = itemEntity.getPosY(); double posZ = itemEntity.getPosZ(); List<PaintingEntity> list = event.getWorld().getEntitiesWithinAABB(PaintingEntity.class, new AxisAlignedBB(posX-0.5D, posY, posZ-0.5D, posX+0.5D, posY, posZ+0.5D)); for (PaintingEntity painting : list) { //Crash here because the painting's capabilities have already been invalidated if (painting.getCapability(PaintingCapability.PAINTING_CAPABILITY).orElseThrow(NullPointerException::new).isCustom()) { painting.entityDropItem(ModItems.SKULL_AND_ROSES_PAINTING); event.setCanceled(true); } } } } } -
Is there an onBroken event for paintings? [1.16.4]
Godis_apan replied to Godis_apan's topic in Modder Support
Hmm still having problems, two of them. The first one is that since I have added a capability to paintings whether or not to drop my item, the game crashes when I try to look for it. The second problem is that the coordinates don't match from the old painting and the spawned item so i can't mark it for removal. Code here: @Mod.EventBusSubscriber(modid = VanillaBoom.MOD_ID) public class PaintingHandler { private static boolean paintingDestroyed; private static PaintingEntity paintingEntity = null; @SubscribeEvent public static void onAttachCapabilities(AttachCapabilitiesEvent<Entity> event) { if (event.getObject() instanceof PaintingEntity) { event.addCapability(new ResourceLocation(VanillaBoom.MOD_ID, "painting"), new PaintingCapability()); } } @SubscribeEvent public static void onEntityLeaveTheWorld(EntityLeaveWorldEvent event) { if (event.getEntity() instanceof PaintingEntity && !event.getWorld().isRemote) { PaintingEntity painting = (PaintingEntity) event.getEntity(); //This crashes since the capability is removed before the event is fired paintingDestroyed = painting.getCapability(PaintingCapability.PAINTING_CAPABILITY).orElseThrow(NullPointerException::new).isCustom(); if (paintingDestroyed) { paintingEntity = painting; } } } @SubscribeEvent public static void onEntityJoinTheWorld(EntityJoinWorldEvent event) { if (event.getEntity() instanceof ItemEntity && paintingDestroyed && !event.getWorld().isRemote) { ItemEntity itemEntity = (ItemEntity) event.getEntity(); if (itemEntity.getItem() != null && itemEntity.getItem().getItem() == Items.PAINTING) { if (paintingEntity != null) { //These do not match up if (paintingEntity.getPosX() == itemEntity.getPosX() && paintingEntity.getPosY() == itemEntity.getPosY() && paintingEntity.getPosZ() == itemEntity.getPosZ()) { event.setCanceled(true); paintingEntity.entityDropItem(ModItems.SKULL_AND_ROSES_PAINTING); paintingEntity = null; paintingDestroyed = false; } } } } } } -
Is there an onBroken event for paintings? [1.16.4]
Godis_apan replied to Godis_apan's topic in Modder Support
Will try this, sound like a good strategy, thanks! -
Hello! I'm currently trying to get PaintingEntities to drop a custom item but don't really know how to implement it. Paintings do not have a loot table json, the item drop is handled in the onBroken method in PaintingEntity, called from HangingEntity. Now there are a lot of conditions in which a HangingEntity calls the onBroken method: when it is attacked, moved, accelerated or not on a valid surface. It seems like a bad method to check for all these scenarios with different Forge events, cancelling them and spawning my own item there instead. Have I missed something or should i hardcorde it in? Thanks for any help!
-
Hi, So I'm looking for a good way to remove biomes. Since the previous "GameRegistry.removeBiome(biome)" no longer exists, I need a new method of removing them. It doesn't have to be legit, since the mod I'm currently devoloping isn't too friendly on the whole compatible thing. So, it doesn't really matter if the way of removing them conflicts with other mods. All help will be appriciated!