
Godis_apan
Members-
Posts
109 -
Joined
-
Last visited
-
Days Won
1
Everything posted by Godis_apan
-
Github repo for reference: json: https://github.com/Phrille/Vanilla-Boom/blob/master/src/main/resources/data/vanillaboom/loot_modifiers/fishing.json GLM class: https://github.com/Phrille/Vanilla-Boom/blob/master/src/main/java/phrille/vanillaboom/loot/LootTableHandler.java
-
Yeah this is new to me too and I gotta say I find the fishing loot table case kind of confusing since it passes the conditions in code instead of handling it within the json. Anyways I think I'll keep experimenting with it and pass in a few more conditions in my GLM to make it more foolproof. Thanks for the help!
-
It passes both I think? .withParameter(LootParameters.KILLER_ENTITY, this.func_234616_v_()).withParameter(LootParameters.THIS_ENTITY, this)
-
Hmm it seems to be handled in FishingBobberEntity#handleHookRetraction where it build the loot conditions. These are not specified in the fishing.json only in code. It seems to be checking a lot of stuff: origin vector, tool type, which entity it is, the killer entity and adding a random chance. I don't know how to check all these thing in the json conditions but what I got so far is: "conditions": [ { "condition": "match_tool", "predicate": { "item": "minecraft:fishing_rod" } }, { "condition": "minecraft:entity_properties", "predicate": { "type": "minecraft:fishing_bobber" }, "entity": "this" } ] Maybe it is enough?
-
Hello! I'm trying to add some more loot to fishing using GLM but I'm struggling to find a loot condition for when the player has fished something up. How would I check this to add my entry just to the fishing loot table and not all the other loot tables? Do I need a custom loot condition to check when the player has stopped fishing or something like that? Thanks.
-
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!
-
[Solved][1.7.2]Arranging items in creative gui?
Godis_apan replied to Naiten's topic in Modder Support
It's in the order you add them. But if you rearrange them you will have to create a new world to make them pop up in the right order i believe. -
[Solved][1.7.2]Crash on opening a GUI
Godis_apan replied to MasterAbdoTGM50's topic in Modder Support
Yes he is missing a GuiHandler, this is how it looks: public class GuiHandler implements IGuiHandler { @Override public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { if (ID == 0) { return new MyContainer(); } else { return null; } } @Override public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { if (ID == 0) { return new MyGui(); } else { return null; } } } I main mod class: NetworkRegistry.INSTANCE.registerGuiHandler(this.instance, new GuiHandler()); -
[1.6.4]Custom Mobs Tutorials? Any Help Appreciated!
Godis_apan replied to RetsuWolf's topic in Modder Support
Big props to TGG for making this blog about minecraft modding - so note: This is not my work, if there is someone you should thank for this it's TheGreyGhost. Here it is, think you'll find some nice help here: http://greyminecraftcoder.blogspot.se/ Again thank TGG for this. Great work man! -
Ohh yeah! Definitely do that, thanks forgot to add it
-
int onCreated() method you will have to do something like this: public int textureIndex = 0; public MyItem() { } @Override public void onCreated(ItemStack stack, World world, EntityPlayer player) { stack.stackTagCompound = new NBTTagCompound(); textureIndex = world.rand.nextInt(10); //or something stack.stackTagCompound.setByte("TextureIndex", (byte) textureIndex); } @SideOnly(Side.CLIENT) @Override public IIcon getIconIndex(ItemStack stack) { if (stack.hasTagCompound()) { textureIndex = stack.stackTagCompound.getByte("TextureIndex"); return myIcon[ textureIndex ]; } return itemIcon; }