Jump to content

FrostBytes

Members
  • Posts

    21
  • Joined

  • Last visited

Posts posted by FrostBytes

  1. 8 hours ago, diesieben07 said:

    No. How are you currently creating your drop?

    I’m not. I was just asking in case I started to do something and then someone presented a solution for something else.

    7 hours ago, DavidM said:

    The easiest way would be to create an event handler for LivingDropsEvent, and detect the item held in the player's hand. If all conditions match, spawn the drop(s) at the position of the event (the position of the EntityLiving that was killed).

    I’ll try that when I can.

  2. Just now, diesieben07 said:

    DamageSource#getTrueSource will give you the entity causing the damage, if there is any. You can then check if it's a living entity (instanceof EntityLivingBase) and if so use EntityLivingBase#getHeldItemMainhand to get the held item. Check if that item is yours and if so, increase the drop chance.

    How would I "increase the drop chance?"

    Currently I have no loot tables or any of the sort set up. Would it just be spawning the item entity?

  3. 1 hour ago, Cadiboo said:

    Because there are better ways of doing this than the one you’re trying. For example, putting the item into the container from the container. This is super easy if the container has something that runs every tick (like an Entity or a TileEntity).

    What you’re trying to do is always relevant, because there’s usually a better way of doing it.

    Wow. Never really thought of that. Thanks.

  4. 14 minutes ago, Cadiboo said:

    That much is obvious. What will this achieve for an end user perspective?

    It's going to just be code that randomly checks if there is a certain container nearby and move the itemstack into it. Not sure how that would contribute to this.

  5. 14 hours ago, Laike_Endaril said:

    If you're trying to do something that changes at a constant rate over time, you can do it using timestamps.  What exactly is the goal?

    I’m trying to run code every tick for every itemstack currently loaded.

  6. 47 minutes ago, DavidM said:

    In this case you need to use different method fr each. I don't think this is possible with the chest inventory though (in which case you have to create your own chest).

    As for on the floor, override Item#onEntityItemUpdate.

    Would it be possible to override functionality of the vanilla chest from the mod?

  7. 50 minutes ago, DavidM said:

    When? When in the player's inventory? Please clarify.

    To call a function every tick when the item stack is in the player's inventory, override Item#onUpdate.

    Generally anywhere. Like if it's in a player inventory, or a chest inventory (as long as it's loaded) or on the floor?

  8. 5 hours ago, diesieben07 said:

    What kind of data do you want to change? It would help if you could explain what you are actually trying to achieve.

    I’m not trying to achieve anything atm. I just want to know what I can do with it and how. I just want someone to break down some of the information provided in the documents because I don’t really understand it. But, because it will be a complete waste of time rewording everything, lets just say I want to make power levels for an item. This item carrys only a single integer that cannot be higher than 20. How would I implement the capability system to do such thing?

    • Like 1
  9. Alright, may have jumped to conclusions there. But why is SOOCH null? According to the Forge Documentation:
    "After the Register<Block> event has fired, all ObjectHolder annotations are refreshed, and after Register<Item> has fired they are refreshed again."
    Which means that SOOCH should've been injected, but it's null.
     

    Spoiler
    
    @ObjectHolder(Soochcraft.MODID)
    public class SoochItems {
        public static final ItemSooch SOOCH = null;
    }

     

    Is it not injecting because of the uppercased SOOCH variable? I was told before that it automatically lowercases and *then* checks for injection.

  10. So, I have two SubscribeEvent methods. One registers all my items (1 so far) and the other registers the models on the client. From many other tutorials, I've seen many styles of this, but they are all different. I'm using this one from cubicoder's tutorial.

    Spoiler
    
    public class SoochModelRegEvents { // this is only registered on client and in preinit (placing the register call anywhere else will cause the handler to miss the modelreg events)
        @SubscribeEvent
        public static void registerModels(ModelRegistryEvent event) {
            registerModel(SoochItems.SOOCH);
        }
    
        private static void registerModel(Item item) {
            ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(item.getRegistryName(), "inventory"));
        }
    }

     

    Spoiler
    
    public class SoochRegisterEvents {
        @SubscribeEvent
        public static void registerItems(Register<Item> event) {
            final Item[] items = {
                    new ItemSooch()
            };
    
            event.getRegistry().registerAll(items);
        }
    }

     

    Here's the problem though. Item registering comes after the model registries. Which means that SoochItems.SOOCH is null when the model register events are called.
    How do I handle this? Should I just initialize all of my items in an array? This gets rid of the entire point of ObjectHolder, so I wasn't tempted to do it. As I said, every tutorial I can find conflicts in some way. What do I do?

  11. You can always just generate your own JavaDocs. The Forge source (at least from GradleForge) seldom has JavaDoc comments, and the comments that are there are limited in information. If you really want to comprehend everything, build your own JavaDocs.

    2 hours ago, JavaMan7 said:

    1. add this line apply plugin: 'eclipse' to build.gradle just under   apply plugin: 'net.minecraftforge.gradle'

    2. run gradlew eclipse

    3.if eclipse is open restart it 

    NOTE: you must build first.

    That's not how you build JavaDocs in Eclipse, at least from the time I used the program.
    Project > Generate JavaDocs

    • Like 1
  12. I am aware of the single-player internal server concept. At least from what I've been reading, single-player worlds are really just local listen servers. But I have a question. Lets take an event:

    public class BlockEvent extends Event

    What is with this event? Is the event only called on the server, or on both clients? And how about other events? How do I know if some are called on the client or server?

×
×
  • Create New...

Important Information

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