TARDIS

TARDIS

228k Downloads

Add a custom doors api to allow for custom interior doors

doctormysterio12 opened this issue ยท 5 comments

commented

Describe the feature request

Off the back of FuzzyLeo giving us the classic door, it would be cool to add an API to allow us to add custom interior doors. Similar to the custom models

The config for each door could have:

door name, string
a flag for if the door is animated or not, true/false
a flag for now many frames the animation consists of, integer
the file path of the closed door
the file path of each frame in the animation
config for the the open sound effect
config for the closing sound effect

Also I noticed the 3D doors open when clicked on regardless if the door is locked, or inflight.
When testing this I also realised the keys can't lock the door when left clicking on a 3D door or exterior

Describe alternatives you've considered

Switch the models out with the original door, but it only allows 1 per server

commented

When testing this I also realised the keys can't lock the door when left clicking on a 3D door or exterior

This is a limitation of the police box being an armour stand and the Spigot API event that the plugin listens to (PlayerInteractAtEntityEvent) only has a getRightClicked() method - left-clicks are not available in the event.

Maybe we can use the EntityDamageByEntityEvent, but I'm not sure it is called for armour stands...

commented

Definitely not called for invisible armour stands...

commented

custom_doors.yml

# this entry is the police box door, but centred on a block
centred:
  # the material of the door item display - MUST be an unused POTTERY_SHERD, one of:
  # ANGLER_POTTERY_SHERD, ARCHER_POTTERY_SHERD, ARMS_UP_POTTERY_SHERD, BLADE_POTTERY_SHERD,
  # BREWER_POTTERY_SHERD, BURN_POTTERY_SHERD, DANGER_POTTERY_SHERD, EXPLORER_POTTERY_SHERD,
  # FRIEND_POTTERY_SHERD, HEART_POTTERY_SHERD, HEARTBREAK_POTTERY_SHERD, HOWL_POTTERY_SHERD,
  # MINER_POTTERY_SHERD, MOURNER_POTTERY_SHERD, PLENTY_POTTERY_SHERD, PRIZE_POTTERY_SHERD,
  # SHEAF_POTTERY_SHERD, SHELTER_POTTERY_SHERD, SKULL_POTTERY_SHERD, SNORT_POTTERY_SHERD
  # 1.21+ FLOW_POTTERY_SHERD, GUSTER_POTTERY_SHERD, SCRAPE_POTTERY_SHERD
  # open/closed/animation states will need to be set with "custom_model_data" predicates
  # in assets/minecraft/models/item/[xxx_pottery_sherd].json starting at 10000
  material: ANGLER_POTTERY_SHERD
  # a comma separated list of frame numbers where the
  # number is added to the starting (closed) animation frame to
  # get the "custom_model_data" predicate e.g. 10000 + 3 = 10003
  # in this example, 0 => closed, 4 => fully open, but for a simple door
  # 0,1 would be just closed and open
  animation_sequence: 0,1,2,3,4
  # the animation frame rate in ticks
  frame_rate: 6
  # whether the door has a third state activated by crouch-right-clicking
  # e.g. the double police door has one side open, closed, and a third "both sides open" state
  # the "custom_model_data" predicate for this state should be 1 greater than
  # the highest value of the animation_sequence, for this example it would be 5
  has_extra: true
  # sfx - if using new custom sounds, you will need to add entries to assets/minecraft/sounds.json
  # and save .ogg files to assets/tardis/sounds/ in the resource pack
  # the sound for when the door opens
  open_sound: tardis_door_open
  # the sound for when the door closes
  close_sound: tardis_door_close
commented

Build 2839

commented

angler_pottery_sherd.json

{
  "parent": "minecraft:item/generated",
  "textures": {
    "layer0": "minecraft:item/angler_pottery_sherd"
  },
  "overrides": [
    {"predicate": {"custom_model_data":10000}, "model": "tardis:block/tardis/police_box_door_0"},
    {"predicate": {"custom_model_data":10001}, "model": "tardis:block/tardis/police_box_door_1"},
    {"predicate": {"custom_model_data":10002}, "model": "tardis:block/tardis/police_box_door_2"},
    {"predicate": {"custom_model_data":10003}, "model": "tardis:block/tardis/police_box_door_3"},
    {"predicate": {"custom_model_data":10004}, "model": "tardis:block/tardis/police_box_door_4"},
    {"predicate": {"custom_model_data":10005}, "model": "tardis:block/tardis/police_box_door_both"}
  ]
}