Skip to content

Commit

Permalink
dragonfly: Add lint-ignores for false positives.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sandertv committed Jun 24, 2020
1 parent aca8e53 commit ebd19b4
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions dragonfly/item/creative.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ func RegisterCreativeItem(item Stack) {
// RegisterCreativeItem.
var creativeItemStacks []Stack

//lint:ignore U1000 Type is used using compiler directives.
type creativeItemEntry struct {
ID int32
Meta int16
Expand All @@ -31,6 +32,7 @@ type creativeItemEntry struct {

// registerVanillaCreativeItems initialises the creative items, registering all creative items that have also
// been registered as normal items and are present in vanilla.
//lint:ignore U1000 Function is used using compiler directives.
//noinspection GoUnusedFunction
func registerVanillaCreativeItems() {
var temp map[string]interface{}
Expand Down
4 changes: 4 additions & 0 deletions dragonfly/item/enchantment.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,17 @@ var (

// enchantmentByID attempts to return an enchantment by the ID it was registered with. If found, the enchantment found
// is returned and the bool true.
//lint:ignore U1000 Function is used using compiler directives.
//noinspection GoUnusedFunction
func enchantmentByID(id int) (Enchantment, bool) {
enchantment, ok := enchantments[id]
return enchantment, ok
}

// idByEnchantment attempts to return the ID the enchantment was registered with. If found, the id is returned and
// the bool true.
//lint:ignore U1000 Function is used using compiler directives.
//noinspection GoUnusedFunction
func idByEnchantment(ench Enchantment) (int, bool) {
id, ok := enchantmentIds[reflect.TypeOf(ench)]
return id, ok
Expand Down
2 changes: 2 additions & 0 deletions dragonfly/item/stack.go
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,7 @@ func (s Stack) String() string {
}

// values returns all values associated with the stack by users.
//lint:ignore U1000 Function is used using compiler directives.
//noinspection GoUnusedFunction
func values(s Stack) map[string]interface{} {
return s.data
Expand All @@ -335,6 +336,7 @@ func newID() int32 {
}

// id returns the unique ID of the stack passed.
//lint:ignore U1000 Function is used using compiler directives.
//noinspection GoUnusedFunction
func id(s Stack) int32 {
if s.Empty() {
Expand Down
2 changes: 2 additions & 0 deletions dragonfly/world/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ func replaceable(w *World, c *chunk.Chunk, pos BlockPos, with Block) bool {

// allBlocks returns a list of all registered states of the server. The list is ordered according to the
// runtime ID that the blocks have.
//lint:ignore U1000 Function is used using compiler directives.
//noinspection GoUnusedFunction
func allBlocks() []Block {
return registeredStates
Expand Down Expand Up @@ -212,6 +213,7 @@ func blockByNameAndProperties(name string, properties map[string]interface{}) (b

// registerAllStates registers all block states present in the game, skipping ones that have already been
// registered before this is called.
//lint:ignore U1000 Function is used using compiler directives.
//noinspection GoUnusedFunction
func registerAllStates() {
var m []unimplementedBlock
Expand Down
3 changes: 3 additions & 0 deletions dragonfly/world/item.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ var names = map[int32]string{}

// itemByID attempts to return an item by the ID and meta it was registered with. If found, the item found is
// returned and the bool true.
//lint:ignore U1000 Function is used using compiler directives.
func itemByID(id int32, meta int16) (Item, bool) {
it, ok := items[(id<<4)|int32(meta)]
if !ok {
Expand All @@ -51,6 +52,7 @@ func itemByID(id int32, meta int16) (Item, bool) {
}

// itemByName attempts to return an item by a name and a metadata value, rather than an ID.
//lint:ignore U1000 Function is used using compiler directives.
//noinspection GoUnusedFunction
func itemByName(name string, meta int16) (Item, bool) {
id, ok := itemsNames[name]
Expand All @@ -61,6 +63,7 @@ func itemByName(name string, meta int16) (Item, bool) {
}

// itemToName encodes an item to its string ID and metadata value.
//lint:ignore U1000 Function is used using compiler directives.
//noinspection GoUnusedFunction
func itemToName(it Item) (name string, meta int16) {
id, meta := it.EncodeItem()
Expand Down
1 change: 1 addition & 0 deletions dragonfly/world/world.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ func (w *World) block(c *chunk.Chunk, pos BlockPos) (Block, error) {
}

// runtimeID gets the block runtime ID at a specific position in the world.
//lint:ignore U1000 Function is used using compiler directives.
//noinspection GoUnusedFunction
func runtimeID(w *World, pos BlockPos) uint32 {
if pos[1] < 0 || pos[1] > 255 {
Expand Down

0 comments on commit ebd19b4

Please sign in to comment.