Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Rohzek

Forge Modder
  • Posts

    81
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by Rohzek

  1. I have two semi-related problems, both involving rendering.

    For the first situation I want to hide the air bubbles/breath bar when a particular piece of armor is worn. Previously I used 

    RenderGameOverlayEvent.Pre event

    and canceled the event if the element type was 

    ElementType.AIR

    which no longer exists in 1.17 it seems, and now I'm not sure how to recreate this functionality with the new system.

    For the second, I want to disable the under-lava-view fog when a particular piece of armor is worn. Previously I used 

    EntityViewRenderEvent.FogDensity event

    and

    RenderSystem.fogStart(0.0F);
    RenderSystem.fogEnd(1024F);
    event.setDensity(0.05F);
    event.setCanceled(true);

    to achieve the desired result.

    To be honest with you I don't remember how I came up with that solution anymore, only that fogStart and fogEnd became deprecated at some point before 1.16.5 (as I found out when finally updating my mod yesterday), and are completely removed now. For 1.17 I tried replacing those with 

    RenderSystem.setShaderFogStart(0.0F);
    RenderSystem.setShaderFogEnd(1024F);

    which has no effect, unless I'm missing something else for that to work. Not sure how to get the same effect here.

  2. The easiest way to explain what I mean is probably an illustration so I'll just do that:

     

    Here I use one item to "fill" two other items, and the crafting recipe works as intended; the two empty cups get removed and the empty mug stays

    Spoiler

    l1PmxKx.png

     

    But here, I want to "mix" two items and keep the same amount of "containers" but currently it duplicates them by leaving the container items behind and creating two more in the form of the output.

    Spoiler

    rnPl9LU.png

     

    Technically the ContainerItem code is working as "intended" but, is there a way to temporarily override the container item in this instance, or just remove the item from the crafting matrix after pulling the result out?

    And what if I want to do this with vanilla items, too (e.g. mixing a custom "bucket" item with a vanilla milk bucket, to where two new bucket items would pop out, and both of the leftover vanilla buckets containers should be removed

     

    I've tried doing both clear and decrStackSize on the PlayerEvent.ItemCraftedEvent.craftMatrix but neither seemed to work.

  3. 5 hours ago, Big_Bad_E said:

    public class Registery {

    You can tag this class as @Mod.EventBusSubscriber and not worry about calling the event bus registry in your proxy

     

    5 hours ago, Big_Bad_E said:

    @SubscribeEvent public void registerItems(RegistryEvent.Register<Item> event) {

    But this has to be static for that to happen

     

    5 hours ago, Big_Bad_E said:

    @Mod(modid = "cfb", name = "Cooking For Blockheads", version = "v1.0.0")

    But, what's going on here? You do know 'Cooking for Dummies' is close, but using 'Cooking For Blockheads' is literally just using the name of another mod?

  4. 4 hours ago, olscizorlo said:

    view them in eclipse

    1. Help > Eclipse Marketplace
    2. Search 'decompiler'
    3. Install Enhanced Class Decompiler (Or Bytecode Outline)
    4. Restart
    5. Open Package Explorer, right click on project
    6. Build Path > Configure Build Path > Libraries > Add External Jar > Add the mods jar file.
    7. Find files in Project > Referenced Libraries > modname.jar and open them like any other
  5. 29 minutes ago, loordgek said:

    Yes, I know that. And, as I said in the OP

     

    7 hours ago, Rohzek said:

    Adding aspects to items a la the ThaumcraftApi#registerObjectTag (and  #registerComplexObjectTag) method(s) works great for the unaffected items

    I'm using https://github.com/Azanor/thaumcraft-api/blob/master/ThaumcraftApi.java#L291 to add aspects to the other ores. Kind of implies I know of the API  already. Infact I even said:

     

    7 hours ago, Rohzek said:

    A quick search through the API (both on Github, and in Eclipse) hasn't really turned up anything obvious. Am I missing something/is there an easy way around this?

     

    What I'm not finding in it, is a method to remove/change/overwrite an item that's getting stuck with aspects through other sour- Just re-read the OP, I've already said all of this. 

  6. I know this isn't Forge related, but I figured I'd ask anyway, in case someone knows:

    I'm attempting to add limited Thaumcraft support to my mod, in the form of adding aspects to items, and am stuck on a small snag; Is there a way to overwrite/remove aspects from items that already have them, using the Thaumcraft API?

    Specifically my items/ores, which are tagged with (Thaumcraft supported) ore dictionary entries, are grabbed by Thaumcraft's automatic adding of ore dictionary items and have aspects applied to them, that I wish to tweak (small things such as adding 'Ignis' to nether ores) or change completely (in some cases, to better fit the item's purpose). Adding aspects to items a la the ThaumcraftApi#registerObjectTag (and  #registerComplexObjectTag) method(s) works great for the unaffected items, but does not seem to override or even concat the aspects on the items that are already tagged, regardless of when it's called (Pre-Init, Init, or Post-Init). A quick search through the API (both on Github, and in Eclipse) hasn't really turned up anything obvious. Am I missing something/is there an easy way around this?

  7. 2 minutes ago, grand_gibus said:

    Take a look at the minecraft flower pot! It uses blockstates. Might be simpler. :)

    I'm hoping to be able to support any modded flower (or at least ones which are subclasses of BlockFlower and BlockBush), which is why getting a block from an itemstack and rendering it seemed way more simple than blockstates, assuming it's possible.

     

  8. 1 hour ago, diesieben07 said:

    I don't see why you would want a TESR in the first place.

    Because I have no idea how to do what I want (render a block you place into a tile entity as a block in the world), but Googling "Forge modding render (anything) gets 50% results for rending a custom model, and 50% results for using a TESR. I started working with the one that seemed relevant.

  9. Trying to make a custom flowerpot; I have a TESR and it's Tile Entity stores an instance of  a BlockFlower or BlockBush as an itemstack.

    So far, I've only seen information on how to render something as an EntityItem, but how do I render the flower block as a normal block, instead?

  10. On 4/20/2017 at 4:48 PM, Terrails said:

    The problem now is how should I disable the ores that are not generated with my config/generator? (I want to disable the generation of ores that are specified in my config and than use my own generation so there aren't 2 generators doing the same thing)

    If it's vanilla ore, it's easy. You'll need to subscribe to OreGenEvent#GenerateMinable and block the events. I have an example of that you can look at here.

     

    When it comes to the other mods, hope that they have a config you can use to turn off their generation. Or, you'll have to load the mod as an external library and see if there's a getter/setter/public variable somewhere you can edit to turn off generation when your mod is installed. How they have their generation setup determines what you have to do. ...And that really only works if the mod author provides a source/dev version of the mod.

     

    Outside of editing the other mods' configs, you won't be able to just read a boolean out of your config and support blocking of any mod, you'll have to code support in for each mod manually.

    • Like 1
  11. That is the hardest possible way to do it, it seems. If you run into a block that's a subtype (e.g. forestry's apatite, copper, and tin are all just "forestry:resources" with a different metadata), you'll have to find some way for them to specify the metadata in your config too.

     

    To answer your specific question though, you'll need to get the mod id and use it to check to see if the mod is present, and if it is you can get the block with Block#getBlockFromName which will take an id and a block name (like "forestry:resources" or "minecraft:iron_ore") and then you can get the state from that to pass into your generation code. 

  12. 19 hours ago, diesieben07 said:

    You have to basically copy what they are doing, unless they are exposing their ore generation with some sort of API.

    I would imagine there would be a way to get the list of ores from the mods and pass those to my own generate methods, but how would I be able to stop their ores from spawning first? I'm assuming when checking for an ore to block, EventType.CUSTOM will block any WorldGenerator extended block that isn't a vanilla one?

     

  13. I have a mod that changes the way ores generate in the overworld by blocking the vanilla ore generation (using the OreGenEvent#GenerateMinable event), and adds nether and end ores.

     

    I know how to make my mod aware of other mods by checking the mod Id with Loader#isModLoaded, and using the @Optional tag, but I'm not sure where to go from here.

    The most requested feature is to add support for ores from other mods, but I'm not sure how to go about that exactly. Another thing that got requested recently is for my ore generation to be used in (dynamic?) dimensions added by another mod, and I'm not sure how to go about that either - or can I even do that?

  14. You say it works for two tabs, but not more. Then you still have not shown the problematic code, you have shown only two tabs.

     

    But that's just it. That's why this is getting even more confusing, since all of the creative tabs, are created exactly the same as the others. Literally the only thing that I've changed is the tab chosen in this line, in every class:

     

    setCreativeTab(Main.CUSTOM_TAB);
    

     

    At first it was set to all the individual tabs, where food items were going to my "Main.FOOD_TAB," and blocks into "Main.BLOCKS_TAB" etc, etc, and only the first two tabs I added worked.

     

    Then I commented out all but one while testing after submitting this, and changed all of the item classes' 'setCreativeTabs()' calls to list into the one that was left, and it worked fine; every item appeared like it should.

     

    And now, to make it worse, I've un-commented them all, and set them all back to the way it originally was, and even less of them are working, now.

     

    It has to be the order they're being loaded (in the main class) vs the item classes (through a registered as @Mod.EventBusSubscriber), or something. This literally makes no sense.

     

    Project on Github:

    Main (Creative Tab's Init)

    Custom Creative Tabs

    Example Food

    Example Item

    Example Tool

    Example Tool Registration

  15. Show how you apply your creative tab to your items and how you declared more than one.

     

    Right now, I have them all declared at the top of my main class, just like in the op, which probably isn't the correct way to do it.

    public static final CustomCreativeTab CUSTOM_TAB = new CustomCreativeTab("myCustomTab", Items.APPLE);
    public static final CustomCreativeTab CUSTOM_TAB_ONE = new CustomCreativeTab("myCustomTab1", Items.STICK);
    ... etc
    

    As for how I "apply" them my items, I have the different types separated by classes (Food, ingots, tools, etc) But in each, I just call setCreativeTab in their constructors, and tell it which tab it belongs in.

    public CustomItems(String names)
    {
    setNames(names);
    setCreativeTab(Main.CUSTOM_TAB);
    }
    
    private void setNames(String name)
    {
    setUnlocalizedName(name);
    setRegistryName(name);
    }
    

    Which works for the first two tabs, but not any more, which is weird. I'm assuming either the items, or the tabs are being initialized in an order that stops one of them from seeing the other. Not sure which way.

     

    I do this, works for me.

    public static CreativeTabs buildingBlocks = new CreativeTabs("moreBuildingBlocks"){
    	@Override
    	public Item getTabIconItem(){
    		return Item.getItemFromBlock(BBBlocks.cotswoldBricks);
    	}
    };

     

    Keep in mind this is 1.10.2, in 1.11 I believe you need to return a ItemStack

     

    Yeah. This is what I have:

    public class CustomCreativeTab extends CreativeTabs
    {
    private ItemStack iconItem;
    
    private ItemSorter itemSorter = new ItemSorter();
    
    public CustomCreativeTab(String label, Item item)
    {
    	super(label);
    	iconItem = new ItemStack(item);
    }
    
    @Override
    public ItemStack getTabIconItem() 
    {
    	return iconItem;
    }
    
    @Override
    public void displayAllRelevantItems(NonNullList<ItemStack> items) 
    {
    	super.displayAllRelevantItems(items);
    
    	Collections.sort(items, itemSorter);
    }
    
    // Sorts items in alphabetical order using their display names, blocks on top
    private static class ItemSorter implements Comparator<ItemStack> 
    {
    
    	@Override
    	public int compare(ItemStack o1, ItemStack o2) 
    	{
    		Item item1 = o1.getItem();
    		Item item2 = o2.getItem();
    
    		// If item1 is a block and item2 isn't, sort item1 before item2
    		if (((item1 instanceof ItemBlock)) && (!(item2 instanceof ItemBlock))) 
    		{
    			return -1;
    		}
    
    		// If item2 is a block and item1 isn't, sort item1 after item2
    		if (((item2 instanceof ItemBlock)) && (!(item1 instanceof ItemBlock)))
    		{
    			return 1;
    		}
    
    		String displayName1 = o1.getDisplayName();
    		String displayName2 = o2.getDisplayName();
    
    		int result = displayName1.compareToIgnoreCase(displayName2);
    
    		return result;
    	}
    }
    }
    

  16. What is the proper way of registering Creative Tabs?

     

    Right now, I have them at the top of my main class between declaring the instance, and the preinit event just, like this:

    public static final CustomCreativeTabs SP_TAB = new CustomCreativeTabs("myTab", Items.APPLE);
    

    Which works fine if I only have one of them. For some reason, though, If I try to make more than 2, not all of my items and blocks will show up in the last one. If I make 4 or more. no items or blocks show up in the 4th+

×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.