Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mod:entity {
- id = "item_drop",
- properties = {
- visual = {
- type = "inventorycube",
- size = 0.25,
- origin = {0.125, 0.125, 0.125},
- },
- is_rotatable = true,
- animation = {
- {
- type = "rotation",
- axis = {0, 0, 1},
- angle = 0.5
- },
- {
- type = "translation",
- delta = {0, 0, -0.0005},
- min = -0.2,
- max = 0,
- loop = true
- }
- },
- hitbox = {0, 0, 0, 0.25, 0.25, 0.25},
- },
- on_spawn = function(entity, data)
- entity:set_properties({
- visual = {
- block_id = data.item_id,
- },
- itemstack = {data.item_id, data.item_amount},
- })
- entity:set_position(data.position[0], data.position[1], data.position[2])
- entity:set_dimension(data.dimension)
- return true
- end,
- on_collision = function(entity, other)
- if other:type() == "player" then
- other:inventory():add_item(entity:properties():itemstack())
- end
- end,
- }
- openminer:add_listener(EventType.OnBlockDigged, function(pos, block, player, world, client, server)
- openminer:spawn_entity("default:item_drop", {
- position = {pos.x, pos.y, pos.z},
- dimension = world:dimension():id(),
- item_id = block:string_id(),
- item_amount = 1,
- })
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement