Add script to parse Minetweaker output

This commit is contained in:
Andrew Miner
2016-08-21 14:41:23 -07:00
parent aed8b15738
commit cbb3940360
7 changed files with 1494 additions and 9 deletions
+73
View File
@@ -0,0 +1,73 @@
FACADE_PATTERN = /^Facade: ([^(]*)$/
GATE_PATTERN = /^.*(OR|AND|Basic) Gate$/
HOLLOW_FACADE_PATTERN = /^Facade: ([^(]*) \(item.Facade.state_hollow\)/
exports.contains = (item)->
return false if item.minecraftId.mod.indexOf('BuildCraft') is -1
return false if item.displayName.match /^tile/
return true if item.displayName.match /Stone( Hollow)? Facade/
return false if item.displayName.match /Facade/
return false if item.displayName.match /(Water|Oil) Spring$/
return true
exports.normalizeName = (item, index=1)->
name = item.gameName
if match = name.match FACADE_PATTERN
return "#{match[1]} Facade"
if match = name.match GATE_PATTERN
switch index
when 2 then return "#{name} (Autarchic Pulsar)"
when 3 then return "#{name} (Clock Timer)"
when 4 then return "#{name} (Redstone Fader)"
if match = name.match HOLLOW_FACADE_PATTERN
return "#{match[1]} Hollow Facade"
if name is 'Redstone Board'
switch index
when 1 then return "Redstone Board (Bomber)"
when 2 then return "Redstone Board (Builder)"
when 3 then return "Redstone Board (Butcher)"
when 4 then return "Redstone Board (Carrier)"
when 5 then return "Redstone Board (Crafter)"
when 6 then return "Redstone Board (Delivery)"
when 7 then return "Redstone Board (Farmer)"
when 8 then return "Redstone Board (Knight)"
when 9 then return "Redstone Board (Harvester)"
when 10 then return "Redstone Board (Leaf Cutter)"
when 11 then return "Redstone Board (Lumberjack)"
when 12 then return "Redstone Board (Miner)"
when 13 then return "Redstone Board (Picker)"
when 14 then return "Redstone Board (Planter)"
when 15 then return "Redstone Board (Pump)"
when 16 then return "Redstone Board (Shovelman)"
when 17 then return "Redstone Board (Stripes)"
when 18 then return "Redstone Board (Tank)"
if name is 'Robot'
switch index
when 1 then return "Robot (Bomber)"
when 2 then return "Robot (Builder)"
when 3 then return "Robot (Butcher)"
when 4 then return "Robot (Carrier)"
when 5 then return "Robot (Crafter)"
when 6 then return "Robot (Delivery)"
when 7 then return "Robot (Farmer)"
when 8 then return "Robot (Knight)"
when 9 then return "Robot (Harvester)"
when 10 then return "Robot (Leaf Cutter)"
when 11 then return "Robot (Lumberjack)"
when 12 then return "Robot (Miner)"
when 13 then return "Robot (Picker)"
when 14 then return "Robot (Planter)"
when 15 then return "Robot (Pump)"
when 16 then return "Robot (Shovelman)"
when 17 then return "Robot (Stripes)"
when 18 then return "Robot (Tank)"
return name
+53
View File
@@ -0,0 +1,53 @@
WOOD_TYPES = [ 'Oak Wood', 'Birch', 'Spruce', 'Jungle', 'Acacia Wood', 'Dark Oak' ]
exports.slug = 'minecraft'
exports.version = '1.7.10'
exports.contains = (item)->
return false if item.minecraftId.mod.indexOf('minecraft') is -1
return false if item.minecraftId.name in [ 'end_portal', 'portal', 'mob_spawner', 'monster_egg', 'spawn_egg' ]
return true
exports.correctItem = (item)->
item.isGatherable = true if item.gameName in [
'Coal', 'Diamond', 'Emerald', 'Lapis Lazuli', 'Nether Quartz', 'Redstone', 'Stone', 'Wheat', 'Wool'
]
item.isGatherable = true if item.minecraftId.name in [
'melon_block'
]
item.isGatherable = false if item.gameName in [
'Bottle o\' Enchanting', 'Command Block', 'Farmland', 'Lava', 'Water', 'Written Book'
]
exports.normalizeName = (item)->
name = item.gameName
switch item.minecraftId.name
when 'clay' then name = 'Clay (block)'
when 'clay_ball' then name = 'Clay (item)'
when 'filled_map' then name = 'Map (filled)'
when 'melon_block' then name = 'Melon (block)'
when 'netherbrick' then name = 'Nether Brick (item)'
when 'nether_brick' then name = 'Nether Brick (block)'
when 'planks'
index = item.minecraftId.meta || 0
name = "#{WOOD_TYPES[index]} Planks"
when 'stone_button' then name = 'Button (stone)'
when 'stone_pressure_plate' then name = 'Pressure Plate (stone)'
when 'wooden_button' then name = 'Button (wooden)'
when 'wooden_pressure_plate' then name = 'Pressure Plate (wooden)'
when 'wooden_slab'
index = item.minecraftId.meta || 0
name = "#{WOOD_TYPES[index]} Slab"
return name
exports.shouldNormalizeGrid = (item, grid)->
return true if item.gameName in [
'Bed', 'Bowl', 'Boat', 'Brewing Stand', 'Bucket', 'Cobblestone Slab', 'Diamond Boots', 'Diamond Helmet',
'Minecart', 'Oak Wood Slab', 'Stone Slab', 'Trapdoor', 'Weighted Pressure Plate (Heavy)',
'Weighted Pressure Plate (Light)'
]
return false