Skip to content

Commit

Permalink
Merge pull request #29 from MultiCoreNetwork/issue#7-fix
Browse files Browse the repository at this point in the history
Invisible Item Frames drop normal Item Frames
  • Loading branch information
BisUmTo authored Mar 2, 2021
2 parents f9a4f05 + 2a32fc1 commit 971e8e2
Showing 1 changed file with 20 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,26 @@ __on_player_interacts_with_entity(player, entity, hand) -> (
if(item != 'phantom_membrane', return());
rotation = (7 + entity~'nbt':'ItemRotation') % 8;
modify(entity, 'nbt_merge', str('{ItemRotation:%s,Invisible:true}', rotation));
_drop_on_remove(entity);
if(player ~ 'gamemode' != 'creative',
inventory_set(player, if(hand == 'mainhand', player~'selected_slot', -1), count - 1, item, nbt)
)
)
);

// TODO: Custom LootTable

_drop_on_remove(entity) ->
entity_event(entity, 'on_removed',
_(e) -> spawn('item', pos(e), str('{Item:{id:"minecraft:phantom_membrane",Count:1b},PickupDelay:10,Motion:[%f,.2,%f]}', rand(0.2) - 0.1, rand(0.2) - 0.1))
);

_check_custom_drop(entity) ->
if(entity~'nbt':'Invisible',
_drop_on_remove(entity)
);

entity_load_handler('item_frame', '_check_custom_drop');
for(entity_list('item_frame'), _check_custom_drop(_));

entity_load_handler('glow_item_frame', '_check_custom_drop');
for(entity_list('glow_item_frame'), _check_custom_drop(_))

0 comments on commit 971e8e2

Please sign in to comment.