package wge3.model;

import com.badlogic.gdx.math.MathUtils;

public class ItemInstance extends Entity {
    
    private final Item type;
    private boolean canBePickedUp;
    
    public ItemInstance(Item type) {
        super((int) (Item.cfg.getFloat(type.getType(), "size") * Tile.size));
        this.type = type;
        canBePickedUp = true;
        
        int offsetX = MathUtils.random(Item.cfg.getInt(type.getType(), "spriteMultiplicity") - 1);
        setSprite(Item.cfg.getIntX(type.getType(), "spritePos") + offsetX,
                  Item.cfg.getIntY(type.getType(), "spritePos"));
    }
    
    public ItemInstance(String itemType) {
        this(Item.get(itemType));
    }
    
    public Item getType() {
        return type;
    }
    
    public boolean canBePickedUp() {
        return canBePickedUp;
    }
    
    void setCanBePickedUp(boolean newState) {
        canBePickedUp = newState;
    }
}

@@ -1,8 +1,214 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public%0A * License, v. 2.0. If a copy of the MPL was not distributed with this%0A * file, You can obtain one at http://mozilla.org/MPL/2.0/. */%0A%0A
 package 

Add missing license header to ItemInstance.java