Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 10/05/19 in all areas

  1. In an ideal world, everyone would use Capabilities and not mess with the ItemStacks NBTTagCompound at all. So basically always use Capabilities. If we are talking computer performance, I think NBTTagCompound just boils down to a HashMap and a Capability is also stored in a HashMap. Capability are easier to read and NBT is sloppy. If we are talking the amount of time to write the code, it comes down to how much information, for small amounts NBT is faster to implement but larger amounts it's typically faster to create a Capability. In RAM NBT is a HashMap<String, INBT> where INBT is a single NBT attribute a Compound/HashMap, List/ArrayList, NBTInt/int, etc. Where as in a Capability you define your own object that is attached to a Object(Entity, ItemStack, World, etc) and you store it there in whatever manner you want(not NBT). On disk everything is converted to NBT and written in Minecraft's custom file format.
    1 point
  2. Interfaces are code-objects that describe what an object has or can do. Consider this example: Knobs expose a method called "twist": interacting with a knob involves twisting. - Dimmer switches are Knobs Toggles expose a method called "change state": interacting with a toggle involves changing its state from ON to OFF or vice versa. - Light switches are Toggles Buttons expose a method called "engage": interacting with a button involves changing its state from OFF to ON, and it automatically changes back when you stop. - Keyboard keys are Buttons A bathroom fan timer implements both Knob and Button in the sense that you interact to twist it, but it automatically turns back OFF after a duration because you've stopped interacting with it. Abstract classes are a code-object that exists halfway between a typical class and a typical interface, providing some default functionality, but leaving some up to its implementors. None of that is relevant to events, however. What D7 is referring to is that the PlayerInteractEvent is that it has subclasses that are more specific. Always use the most specific event for what you are doing.
    1 point
×
×
  • Create New...

Important Information

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